diff --git a/resource-manager/apimanagement/2024-05-01/api/README.md b/resource-manager/apimanagement/2024-05-01/api/README.md index 2936b255234..71be688fe0e 100644 --- a/resource-manager/apimanagement/2024-05-01/api/README.md +++ b/resource-manager/apimanagement/2024-05-01/api/README.md @@ -142,13 +142,9 @@ if err := client.WorkspaceApiCreateOrUpdateThenPoll(ctx, id, payload, api.Defaul ctx := context.TODO() id := api.NewWorkspaceApiID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceName", "workspaceId", "apiId") -read, err := client.WorkspaceApiDelete(ctx, id, api.DefaultWorkspaceApiDeleteOperationOptions()) -if err != nil { +if err := client.WorkspaceApiDeleteThenPoll(ctx, id, api.DefaultWorkspaceApiDeleteOperationOptions()); err != nil { // handle the error } -if model := read.Model; model != nil { - // do something with the model/response object -} ``` diff --git a/resource-manager/apimanagement/2024-05-01/api/method_workspaceapidelete.go b/resource-manager/apimanagement/2024-05-01/api/method_workspaceapidelete.go index 719631183af..ae9c542c5b0 100644 --- a/resource-manager/apimanagement/2024-05-01/api/method_workspaceapidelete.go +++ b/resource-manager/apimanagement/2024-05-01/api/method_workspaceapidelete.go @@ -6,6 +6,8 @@ import ( "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" ) @@ -13,6 +15,7 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type WorkspaceApiDeleteOperationResponse struct { + Poller pollers.Poller HttpResponse *http.Response OData *odata.OData } @@ -53,6 +56,7 @@ func (c ApiClient) WorkspaceApiDelete(ctx context.Context, id WorkspaceApiId, op opts := client.RequestOptions{ ContentType: "application/json; charset=utf-8", ExpectedStatusCodes: []int{ + http.StatusAccepted, http.StatusNoContent, http.StatusOK, }, @@ -76,5 +80,24 @@ func (c ApiClient) WorkspaceApiDelete(ctx context.Context, id WorkspaceApiId, op return } + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + return } + +// WorkspaceApiDeleteThenPoll performs WorkspaceApiDelete then polls until it's completed +func (c ApiClient) WorkspaceApiDeleteThenPoll(ctx context.Context, id WorkspaceApiId, options WorkspaceApiDeleteOperationOptions) error { + result, err := c.WorkspaceApiDelete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing WorkspaceApiDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after WorkspaceApiDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/README.md b/resource-manager/compute/2025-04-01/availabilitysets/README.md new file mode 100644 index 00000000000..82bb92825ff --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/README.md @@ -0,0 +1,221 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/availabilitysets` Documentation + +The `availabilitysets` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/availabilitysets" +``` + + +### Client Initialization + +```go +client := availabilitysets.NewAvailabilitySetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AvailabilitySetsClient.CancelMigrationToVirtualMachineScaleSet` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +read, err := client.CancelMigrationToVirtualMachineScaleSet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.ConvertToVirtualMachineScaleSet` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.ConvertToVirtualMachineScaleSetInput{ + // ... +} + + +if err := client.ConvertToVirtualMachineScaleSetThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AvailabilitySetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.AvailabilitySet{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.Delete` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.Get` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +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: `AvailabilitySetsClient.List` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AvailabilitySetsClient.ListAvailableSizes` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +// alternatively `client.ListAvailableSizes(ctx, id)` can be used to do batched pagination +items, err := client.ListAvailableSizesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AvailabilitySetsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, availabilitysets.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, availabilitysets.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AvailabilitySetsClient.StartMigrationToVirtualMachineScaleSet` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.MigrateToVirtualMachineScaleSetInput{ + // ... +} + + +read, err := client.StartMigrationToVirtualMachineScaleSet(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.Update` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.AvailabilitySetUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.ValidateMigrationToVirtualMachineScaleSet` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.MigrateToVirtualMachineScaleSetInput{ + // ... +} + + +read, err := client.ValidateMigrationToVirtualMachineScaleSet(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2025-04-01/availabilitysets/client.go b/resource-manager/compute/2025-04-01/availabilitysets/client.go new file mode 100644 index 00000000000..8bc85925a49 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/client.go @@ -0,0 +1,26 @@ +package availabilitysets + +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 AvailabilitySetsClient struct { + Client *resourcemanager.Client +} + +func NewAvailabilitySetsClientWithBaseURI(sdkApi sdkEnv.Api) (*AvailabilitySetsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "availabilitysets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AvailabilitySetsClient: %+v", err) + } + + return &AvailabilitySetsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/constants.go b/resource-manager/compute/2025-04-01/availabilitysets/constants.go new file mode 100644 index 00000000000..4ddc7488363 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/constants.go @@ -0,0 +1,54 @@ +package availabilitysets + +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 StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_cancelmigrationtovirtualmachinescaleset.go b/resource-manager/compute/2025-04-01/availabilitysets/method_cancelmigrationtovirtualmachinescaleset.go new file mode 100644 index 00000000000..b3597b0c4c6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_cancelmigrationtovirtualmachinescaleset.go @@ -0,0 +1,48 @@ +package availabilitysets + +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 CancelMigrationToVirtualMachineScaleSetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CancelMigrationToVirtualMachineScaleSet ... +func (c AvailabilitySetsClient) CancelMigrationToVirtualMachineScaleSet(ctx context.Context, id commonids.AvailabilitySetId) (result CancelMigrationToVirtualMachineScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/cancelMigrationToVirtualMachineScaleSet", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_converttovirtualmachinescaleset.go b/resource-manager/compute/2025-04-01/availabilitysets/method_converttovirtualmachinescaleset.go new file mode 100644 index 00000000000..51549e21578 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_converttovirtualmachinescaleset.go @@ -0,0 +1,74 @@ +package availabilitysets + +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/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 ConvertToVirtualMachineScaleSetOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ConvertToVirtualMachineScaleSet ... +func (c AvailabilitySetsClient) ConvertToVirtualMachineScaleSet(ctx context.Context, id commonids.AvailabilitySetId, input ConvertToVirtualMachineScaleSetInput) (result ConvertToVirtualMachineScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/convertToVirtualMachineScaleSet", 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 +} + +// ConvertToVirtualMachineScaleSetThenPoll performs ConvertToVirtualMachineScaleSet then polls until it's completed +func (c AvailabilitySetsClient) ConvertToVirtualMachineScaleSetThenPoll(ctx context.Context, id commonids.AvailabilitySetId, input ConvertToVirtualMachineScaleSetInput) error { + result, err := c.ConvertToVirtualMachineScaleSet(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConvertToVirtualMachineScaleSet: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConvertToVirtualMachineScaleSet: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_createorupdate.go b/resource-manager/compute/2025-04-01/availabilitysets/method_createorupdate.go new file mode 100644 index 00000000000..0fd3b44fe2c --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_createorupdate.go @@ -0,0 +1,58 @@ +package availabilitysets + +import ( + "context" + "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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AvailabilitySet +} + +// CreateOrUpdate ... +func (c AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, id commonids.AvailabilitySetId, input AvailabilitySet) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AvailabilitySet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_delete.go b/resource-manager/compute/2025-04-01/availabilitysets/method_delete.go new file mode 100644 index 00000000000..e89779e3039 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_delete.go @@ -0,0 +1,48 @@ +package availabilitysets + +import ( + "context" + "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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c AvailabilitySetsClient) Delete(ctx context.Context, id commonids.AvailabilitySetId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_get.go b/resource-manager/compute/2025-04-01/availabilitysets/method_get.go new file mode 100644 index 00000000000..5331c2457d7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_get.go @@ -0,0 +1,54 @@ +package availabilitysets + +import ( + "context" + "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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AvailabilitySet +} + +// Get ... +func (c AvailabilitySetsClient) Get(ctx context.Context, id commonids.AvailabilitySetId) (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 AvailabilitySet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_list.go b/resource-manager/compute/2025-04-01/availabilitysets/method_list.go new file mode 100644 index 00000000000..f5a12a32b9e --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_list.go @@ -0,0 +1,106 @@ +package availabilitysets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AvailabilitySet +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []AvailabilitySet +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c AvailabilitySetsClient) List(ctx context.Context, id commonids.ResourceGroupId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/availabilitySets", 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 *[]AvailabilitySet `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c AvailabilitySetsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, AvailabilitySetOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AvailabilitySetsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AvailabilitySetOperationPredicate) (result ListCompleteResult, err error) { + items := make([]AvailabilitySet, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_listavailablesizes.go b/resource-manager/compute/2025-04-01/availabilitysets/method_listavailablesizes.go new file mode 100644 index 00000000000..150cf0166a6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_listavailablesizes.go @@ -0,0 +1,106 @@ +package availabilitysets + +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 ListAvailableSizesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineSize +} + +type ListAvailableSizesCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineSize +} + +type ListAvailableSizesCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListAvailableSizesCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListAvailableSizes ... +func (c AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, id commonids.AvailabilitySetId) (result ListAvailableSizesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListAvailableSizesCustomPager{}, + Path: fmt.Sprintf("%s/vmSizes", 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 *[]VirtualMachineSize `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAvailableSizesComplete retrieves all the results into a single object +func (c AvailabilitySetsClient) ListAvailableSizesComplete(ctx context.Context, id commonids.AvailabilitySetId) (ListAvailableSizesCompleteResult, error) { + return c.ListAvailableSizesCompleteMatchingPredicate(ctx, id, VirtualMachineSizeOperationPredicate{}) +} + +// ListAvailableSizesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AvailabilitySetsClient) ListAvailableSizesCompleteMatchingPredicate(ctx context.Context, id commonids.AvailabilitySetId, predicate VirtualMachineSizeOperationPredicate) (result ListAvailableSizesCompleteResult, err error) { + items := make([]VirtualMachineSize, 0) + + resp, err := c.ListAvailableSizes(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 = ListAvailableSizesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_listbysubscription.go b/resource-manager/compute/2025-04-01/availabilitysets/method_listbysubscription.go new file mode 100644 index 00000000000..44f1ba6844b --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_listbysubscription.go @@ -0,0 +1,135 @@ +package availabilitysets + +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 *[]AvailabilitySet +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []AvailabilitySet +} + +type ListBySubscriptionOperationOptions struct { + Expand *string +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +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 AvailabilitySetsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/availabilitySets", 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 *[]AvailabilitySet `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 AvailabilitySetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, AvailabilitySetOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AvailabilitySetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate AvailabilitySetOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]AvailabilitySet, 0) + + resp, err := c.ListBySubscription(ctx, id, options) + 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/resource-manager/compute/2025-04-01/availabilitysets/method_startmigrationtovirtualmachinescaleset.go b/resource-manager/compute/2025-04-01/availabilitysets/method_startmigrationtovirtualmachinescaleset.go new file mode 100644 index 00000000000..321194795c6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_startmigrationtovirtualmachinescaleset.go @@ -0,0 +1,52 @@ +package availabilitysets + +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 StartMigrationToVirtualMachineScaleSetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// StartMigrationToVirtualMachineScaleSet ... +func (c AvailabilitySetsClient) StartMigrationToVirtualMachineScaleSet(ctx context.Context, id commonids.AvailabilitySetId, input MigrateToVirtualMachineScaleSetInput) (result StartMigrationToVirtualMachineScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/startMigrationToVirtualMachineScaleSet", 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 + } + + return +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_update.go b/resource-manager/compute/2025-04-01/availabilitysets/method_update.go new file mode 100644 index 00000000000..8eb2093ecd2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_update.go @@ -0,0 +1,58 @@ +package availabilitysets + +import ( + "context" + "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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AvailabilitySet +} + +// Update ... +func (c AvailabilitySetsClient) Update(ctx context.Context, id commonids.AvailabilitySetId, input AvailabilitySetUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AvailabilitySet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/method_validatemigrationtovirtualmachinescaleset.go b/resource-manager/compute/2025-04-01/availabilitysets/method_validatemigrationtovirtualmachinescaleset.go new file mode 100644 index 00000000000..e21fce7027c --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/method_validatemigrationtovirtualmachinescaleset.go @@ -0,0 +1,52 @@ +package availabilitysets + +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 ValidateMigrationToVirtualMachineScaleSetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// ValidateMigrationToVirtualMachineScaleSet ... +func (c AvailabilitySetsClient) ValidateMigrationToVirtualMachineScaleSet(ctx context.Context, id commonids.AvailabilitySetId, input MigrateToVirtualMachineScaleSetInput) (result ValidateMigrationToVirtualMachineScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validateMigrationToVirtualMachineScaleSet", 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 + } + + return +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_allinstancesdown.go b/resource-manager/compute/2025-04-01/availabilitysets/model_allinstancesdown.go new file mode 100644 index 00000000000..a679835fe36 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_allinstancesdown.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AllInstancesDown struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_availabilityset.go b/resource-manager/compute/2025-04-01/availabilitysets/model_availabilityset.go new file mode 100644 index 00000000000..32fb7fdd2a2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_availabilityset.go @@ -0,0 +1,19 @@ +package availabilitysets + +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 AvailabilitySet struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *AvailabilitySetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_availabilitysetproperties.go b/resource-manager/compute/2025-04-01/availabilitysets/model_availabilitysetproperties.go new file mode 100644 index 00000000000..4cca9bf01c9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_availabilitysetproperties.go @@ -0,0 +1,14 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetProperties struct { + PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"` + PlatformUpdateDomainCount *int64 `json:"platformUpdateDomainCount,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ScheduledEventsPolicy *ScheduledEventsPolicy `json:"scheduledEventsPolicy,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VirtualMachineScaleSetMigrationInfo *VirtualMachineScaleSetMigrationInfo `json:"virtualMachineScaleSetMigrationInfo,omitempty"` + VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_availabilitysetupdate.go b/resource-manager/compute/2025-04-01/availabilitysets/model_availabilitysetupdate.go new file mode 100644 index 00000000000..04ce035cd46 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_availabilitysetupdate.go @@ -0,0 +1,10 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetUpdate struct { + Properties *AvailabilitySetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_converttovirtualmachinescalesetinput.go b/resource-manager/compute/2025-04-01/availabilitysets/model_converttovirtualmachinescalesetinput.go new file mode 100644 index 00000000000..6ac9107691d --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_converttovirtualmachinescalesetinput.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConvertToVirtualMachineScaleSetInput struct { + VirtualMachineScaleSetName *string `json:"virtualMachineScaleSetName,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_defaultvirtualmachinescalesetinfo.go b/resource-manager/compute/2025-04-01/availabilitysets/model_defaultvirtualmachinescalesetinfo.go new file mode 100644 index 00000000000..08f3416fc48 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_defaultvirtualmachinescalesetinfo.go @@ -0,0 +1,9 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DefaultVirtualMachineScaleSetInfo struct { + ConstrainedMaximumCapacity *bool `json:"constrainedMaximumCapacity,omitempty"` + DefaultVirtualMachineScaleSet *SubResource `json:"defaultVirtualMachineScaleSet,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_eventgridandresourcegraph.go b/resource-manager/compute/2025-04-01/availabilitysets/model_eventgridandresourcegraph.go new file mode 100644 index 00000000000..8eb95548a8d --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_eventgridandresourcegraph.go @@ -0,0 +1,9 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventGridAndResourceGraph struct { + Enable *bool `json:"enable,omitempty"` + ScheduledEventsApiVersion *string `json:"scheduledEventsApiVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/availabilitysets/model_instanceviewstatus.go new file mode 100644 index 00000000000..038a3c1dd32 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package availabilitysets + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_migratetovirtualmachinescalesetinput.go b/resource-manager/compute/2025-04-01/availabilitysets/model_migratetovirtualmachinescalesetinput.go new file mode 100644 index 00000000000..18f5c9adb62 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_migratetovirtualmachinescalesetinput.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrateToVirtualMachineScaleSetInput struct { + VirtualMachineScaleSetFlexible SubResource `json:"virtualMachineScaleSetFlexible"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_scheduledeventsadditionalpublishingtargets.go b/resource-manager/compute/2025-04-01/availabilitysets/model_scheduledeventsadditionalpublishingtargets.go new file mode 100644 index 00000000000..b59b4ed3a89 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_scheduledeventsadditionalpublishingtargets.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsAdditionalPublishingTargets struct { + EventGridAndResourceGraph *EventGridAndResourceGraph `json:"eventGridAndResourceGraph,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_scheduledeventspolicy.go b/resource-manager/compute/2025-04-01/availabilitysets/model_scheduledeventspolicy.go new file mode 100644 index 00000000000..dc6aee1ca94 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_scheduledeventspolicy.go @@ -0,0 +1,11 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsPolicy struct { + AllInstancesDown *AllInstancesDown `json:"allInstancesDown,omitempty"` + ScheduledEventsAdditionalPublishingTargets *ScheduledEventsAdditionalPublishingTargets `json:"scheduledEventsAdditionalPublishingTargets,omitempty"` + UserInitiatedReboot *UserInitiatedReboot `json:"userInitiatedReboot,omitempty"` + UserInitiatedRedeploy *UserInitiatedRedeploy `json:"userInitiatedRedeploy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_sku.go b/resource-manager/compute/2025-04-01/availabilitysets/model_sku.go new file mode 100644 index 00000000000..9e275b34b2a --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_sku.go @@ -0,0 +1,10 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_subresource.go b/resource-manager/compute/2025-04-01/availabilitysets/model_subresource.go new file mode 100644 index 00000000000..9890abb18c9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_subresource.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_userinitiatedreboot.go b/resource-manager/compute/2025-04-01/availabilitysets/model_userinitiatedreboot.go new file mode 100644 index 00000000000..29506a0c958 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_userinitiatedreboot.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedReboot struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_userinitiatedredeploy.go b/resource-manager/compute/2025-04-01/availabilitysets/model_userinitiatedredeploy.go new file mode 100644 index 00000000000..a84f4fb1b66 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_userinitiatedredeploy.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedRedeploy struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_virtualmachinescalesetmigrationinfo.go b/resource-manager/compute/2025-04-01/availabilitysets/model_virtualmachinescalesetmigrationinfo.go new file mode 100644 index 00000000000..930ca8a508f --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_virtualmachinescalesetmigrationinfo.go @@ -0,0 +1,9 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetMigrationInfo struct { + DefaultVirtualMachineScaleSetInfo *DefaultVirtualMachineScaleSetInfo `json:"defaultVirtualMachineScaleSetInfo,omitempty"` + MigrateToVirtualMachineScaleSet *SubResource `json:"migrateToVirtualMachineScaleSet,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/model_virtualmachinesize.go b/resource-manager/compute/2025-04-01/availabilitysets/model_virtualmachinesize.go new file mode 100644 index 00000000000..d9b2adc3758 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/model_virtualmachinesize.go @@ -0,0 +1,13 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSize struct { + MaxDataDiskCount *int64 `json:"maxDataDiskCount,omitempty"` + MemoryInMB *int64 `json:"memoryInMB,omitempty"` + Name *string `json:"name,omitempty"` + NumberOfCores *int64 `json:"numberOfCores,omitempty"` + OsDiskSizeInMB *int64 `json:"osDiskSizeInMB,omitempty"` + ResourceDiskSizeInMB *int64 `json:"resourceDiskSizeInMB,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/predicates.go b/resource-manager/compute/2025-04-01/availabilitysets/predicates.go new file mode 100644 index 00000000000..2c1e19c9c85 --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/predicates.go @@ -0,0 +1,70 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AvailabilitySetOperationPredicate) Matches(input AvailabilitySet) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type VirtualMachineSizeOperationPredicate struct { + MaxDataDiskCount *int64 + MemoryInMB *int64 + Name *string + NumberOfCores *int64 + OsDiskSizeInMB *int64 + ResourceDiskSizeInMB *int64 +} + +func (p VirtualMachineSizeOperationPredicate) Matches(input VirtualMachineSize) bool { + + if p.MaxDataDiskCount != nil && (input.MaxDataDiskCount == nil || *p.MaxDataDiskCount != *input.MaxDataDiskCount) { + return false + } + + if p.MemoryInMB != nil && (input.MemoryInMB == nil || *p.MemoryInMB != *input.MemoryInMB) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.NumberOfCores != nil && (input.NumberOfCores == nil || *p.NumberOfCores != *input.NumberOfCores) { + return false + } + + if p.OsDiskSizeInMB != nil && (input.OsDiskSizeInMB == nil || *p.OsDiskSizeInMB != *input.OsDiskSizeInMB) { + return false + } + + if p.ResourceDiskSizeInMB != nil && (input.ResourceDiskSizeInMB == nil || *p.ResourceDiskSizeInMB != *input.ResourceDiskSizeInMB) { + return false + } + + return true +} diff --git a/resource-manager/compute/2025-04-01/availabilitysets/version.go b/resource-manager/compute/2025-04-01/availabilitysets/version.go new file mode 100644 index 00000000000..9d1a343764e --- /dev/null +++ b/resource-manager/compute/2025-04-01/availabilitysets/version.go @@ -0,0 +1,10 @@ +package availabilitysets + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/availabilitysets/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/README.md b/resource-manager/compute/2025-04-01/capacityreservationgroups/README.md new file mode 100644 index 00000000000..1860f39b1a7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/README.md @@ -0,0 +1,129 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/capacityreservationgroups` Documentation + +The `capacityreservationgroups` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/capacityreservationgroups" +``` + + +### Client Initialization + +```go +client := capacityreservationgroups.NewCapacityReservationGroupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapacityReservationGroupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := capacityreservationgroups.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +payload := capacityreservationgroups.CapacityReservationGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.Delete` + +```go +ctx := context.TODO() +id := capacityreservationgroups.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.Get` + +```go +ctx := context.TODO() +id := capacityreservationgroups.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +read, err := client.Get(ctx, id, capacityreservationgroups.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, capacityreservationgroups.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, capacityreservationgroups.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, capacityreservationgroups.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, capacityreservationgroups.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.Update` + +```go +ctx := context.TODO() +id := capacityreservationgroups.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +payload := capacityreservationgroups.CapacityReservationGroupUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/client.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/client.go new file mode 100644 index 00000000000..088a08cf103 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/client.go @@ -0,0 +1,26 @@ +package capacityreservationgroups + +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 CapacityReservationGroupsClient struct { + Client *resourcemanager.Client +} + +func NewCapacityReservationGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*CapacityReservationGroupsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "capacityreservationgroups", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CapacityReservationGroupsClient: %+v", err) + } + + return &CapacityReservationGroupsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/constants.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/constants.go new file mode 100644 index 00000000000..f20c10b3d82 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/constants.go @@ -0,0 +1,218 @@ +package capacityreservationgroups + +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 CapacityReservationGroupInstanceViewTypes string + +const ( + CapacityReservationGroupInstanceViewTypesInstanceView CapacityReservationGroupInstanceViewTypes = "instanceView" +) + +func PossibleValuesForCapacityReservationGroupInstanceViewTypes() []string { + return []string{ + string(CapacityReservationGroupInstanceViewTypesInstanceView), + } +} + +func (s *CapacityReservationGroupInstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCapacityReservationGroupInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCapacityReservationGroupInstanceViewTypes(input string) (*CapacityReservationGroupInstanceViewTypes, error) { + vals := map[string]CapacityReservationGroupInstanceViewTypes{ + "instanceview": CapacityReservationGroupInstanceViewTypesInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CapacityReservationGroupInstanceViewTypes(input) + return &out, nil +} + +type ExpandTypesForGetCapacityReservationGroups string + +const ( + ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef ExpandTypesForGetCapacityReservationGroups = "virtualMachineScaleSetVMs/$ref" + ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef ExpandTypesForGetCapacityReservationGroups = "virtualMachines/$ref" +) + +func PossibleValuesForExpandTypesForGetCapacityReservationGroups() []string { + return []string{ + string(ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef), + string(ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef), + } +} + +func (s *ExpandTypesForGetCapacityReservationGroups) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpandTypesForGetCapacityReservationGroups(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExpandTypesForGetCapacityReservationGroups(input string) (*ExpandTypesForGetCapacityReservationGroups, error) { + vals := map[string]ExpandTypesForGetCapacityReservationGroups{ + "virtualmachinescalesetvms/$ref": ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef, + "virtualmachines/$ref": ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpandTypesForGetCapacityReservationGroups(input) + return &out, nil +} + +type ReservationType string + +const ( + ReservationTypeBlock ReservationType = "Block" + ReservationTypeTargeted ReservationType = "Targeted" +) + +func PossibleValuesForReservationType() []string { + return []string{ + string(ReservationTypeBlock), + string(ReservationTypeTargeted), + } +} + +func (s *ReservationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReservationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseReservationType(input string) (*ReservationType, error) { + vals := map[string]ReservationType{ + "block": ReservationTypeBlock, + "targeted": ReservationTypeTargeted, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ReservationType(input) + return &out, nil +} + +type ResourceIdOptionsForGetCapacityReservationGroups string + +const ( + ResourceIdOptionsForGetCapacityReservationGroupsAll ResourceIdOptionsForGetCapacityReservationGroups = "All" + ResourceIdOptionsForGetCapacityReservationGroupsCreatedInSubscription ResourceIdOptionsForGetCapacityReservationGroups = "CreatedInSubscription" + ResourceIdOptionsForGetCapacityReservationGroupsSharedWithSubscription ResourceIdOptionsForGetCapacityReservationGroups = "SharedWithSubscription" +) + +func PossibleValuesForResourceIdOptionsForGetCapacityReservationGroups() []string { + return []string{ + string(ResourceIdOptionsForGetCapacityReservationGroupsAll), + string(ResourceIdOptionsForGetCapacityReservationGroupsCreatedInSubscription), + string(ResourceIdOptionsForGetCapacityReservationGroupsSharedWithSubscription), + } +} + +func (s *ResourceIdOptionsForGetCapacityReservationGroups) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceIdOptionsForGetCapacityReservationGroups(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceIdOptionsForGetCapacityReservationGroups(input string) (*ResourceIdOptionsForGetCapacityReservationGroups, error) { + vals := map[string]ResourceIdOptionsForGetCapacityReservationGroups{ + "all": ResourceIdOptionsForGetCapacityReservationGroupsAll, + "createdinsubscription": ResourceIdOptionsForGetCapacityReservationGroupsCreatedInSubscription, + "sharedwithsubscription": ResourceIdOptionsForGetCapacityReservationGroupsSharedWithSubscription, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceIdOptionsForGetCapacityReservationGroups(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/id_capacityreservationgroup.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/id_capacityreservationgroup.go new file mode 100644 index 00000000000..edd8c309cf2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/id_capacityreservationgroup.go @@ -0,0 +1,130 @@ +package capacityreservationgroups + +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(&CapacityReservationGroupId{}) +} + +var _ resourceids.ResourceId = &CapacityReservationGroupId{} + +// CapacityReservationGroupId is a struct representing the Resource ID for a Capacity Reservation Group +type CapacityReservationGroupId struct { + SubscriptionId string + ResourceGroupName string + CapacityReservationGroupName string +} + +// NewCapacityReservationGroupID returns a new CapacityReservationGroupId struct +func NewCapacityReservationGroupID(subscriptionId string, resourceGroupName string, capacityReservationGroupName string) CapacityReservationGroupId { + return CapacityReservationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CapacityReservationGroupName: capacityReservationGroupName, + } +} + +// ParseCapacityReservationGroupID parses 'input' into a CapacityReservationGroupId +func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCapacityReservationGroupIDInsensitively parses 'input' case-insensitively into a CapacityReservationGroupId +// note: this method should only be used for API response data and not user input +func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReservationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationGroupId) 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.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) + } + + return nil +} + +// ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID +func ValidateCapacityReservationGroupID(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 := ParseCapacityReservationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Reservation Group ID +func (id CapacityReservationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/capacityReservationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CapacityReservationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Reservation Group ID +func (id CapacityReservationGroupId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticCapacityReservationGroups", "capacityReservationGroups", "capacityReservationGroups"), + resourceids.UserSpecifiedSegment("capacityReservationGroupName", "capacityReservationGroupName"), + } +} + +// String returns a human-readable description of this Capacity Reservation Group ID +func (id CapacityReservationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Capacity Reservation Group Name: %q", id.CapacityReservationGroupName), + } + return fmt.Sprintf("Capacity Reservation Group (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/id_capacityreservationgroup_test.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/id_capacityreservationgroup_test.go new file mode 100644 index 00000000000..aac88ae1e0b --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/id_capacityreservationgroup_test.go @@ -0,0 +1,282 @@ +package capacityreservationgroups + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &CapacityReservationGroupId{} + +func TestNewCapacityReservationGroupID(t *testing.T) { + id := NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CapacityReservationGroupName != "capacityReservationGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'CapacityReservationGroupName'", id.CapacityReservationGroupName, "capacityReservationGroupName") + } +} + +func TestFormatCapacityReservationGroupID(t *testing.T) { + actual := NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCapacityReservationGroupID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationGroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationGroupID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + } +} + +func TestParseCapacityReservationGroupIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationGroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CapacityReservationGroupName: "cApAcItYrEsErVaTiOnGrOuPnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationGroupIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + } +} + +func TestSegmentsForCapacityReservationGroupId(t *testing.T) { + segments := CapacityReservationGroupId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CapacityReservationGroupId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/method_createorupdate.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_createorupdate.go new file mode 100644 index 00000000000..b2779f3d9df --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_createorupdate.go @@ -0,0 +1,58 @@ +package capacityreservationgroups + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CapacityReservationGroup +} + +// CreateOrUpdate ... +func (c CapacityReservationGroupsClient) CreateOrUpdate(ctx context.Context, id CapacityReservationGroupId, input CapacityReservationGroup) (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 + } + + var model CapacityReservationGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/method_delete.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_delete.go new file mode 100644 index 00000000000..2ae30c459f7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_delete.go @@ -0,0 +1,47 @@ +package capacityreservationgroups + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c CapacityReservationGroupsClient) Delete(ctx context.Context, id CapacityReservationGroupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/method_get.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_get.go new file mode 100644 index 00000000000..40ec743fa1e --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_get.go @@ -0,0 +1,83 @@ +package capacityreservationgroups + +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 *CapacityReservationGroup +} + +type GetOperationOptions struct { + Expand *CapacityReservationGroupInstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c CapacityReservationGroupsClient) Get(ctx context.Context, id CapacityReservationGroupId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 CapacityReservationGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/method_listbyresourcegroup.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_listbyresourcegroup.go new file mode 100644 index 00000000000..471bfa93e53 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_listbyresourcegroup.go @@ -0,0 +1,135 @@ +package capacityreservationgroups + +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 *[]CapacityReservationGroup +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []CapacityReservationGroup +} + +type ListByResourceGroupOperationOptions struct { + Expand *ExpandTypesForGetCapacityReservationGroups +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByResourceGroupOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByResourceGroupOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +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 CapacityReservationGroupsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/capacityReservationGroups", 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 *[]CapacityReservationGroup `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 CapacityReservationGroupsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, CapacityReservationGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CapacityReservationGroupsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate CapacityReservationGroupOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]CapacityReservationGroup, 0) + + resp, err := c.ListByResourceGroup(ctx, id, options) + 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/resource-manager/compute/2025-04-01/capacityreservationgroups/method_listbysubscription.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_listbysubscription.go new file mode 100644 index 00000000000..ef48698b737 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_listbysubscription.go @@ -0,0 +1,139 @@ +package capacityreservationgroups + +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 *[]CapacityReservationGroup +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []CapacityReservationGroup +} + +type ListBySubscriptionOperationOptions struct { + Expand *ExpandTypesForGetCapacityReservationGroups + ResourceIdsOnly *ResourceIdOptionsForGetCapacityReservationGroups +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.ResourceIdsOnly != nil { + out.Append("resourceIdsOnly", fmt.Sprintf("%v", *o.ResourceIdsOnly)) + } + return &out +} + +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 CapacityReservationGroupsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/capacityReservationGroups", 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 *[]CapacityReservationGroup `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 CapacityReservationGroupsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, CapacityReservationGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CapacityReservationGroupsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate CapacityReservationGroupOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]CapacityReservationGroup, 0) + + resp, err := c.ListBySubscription(ctx, id, options) + 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/resource-manager/compute/2025-04-01/capacityreservationgroups/method_update.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_update.go new file mode 100644 index 00000000000..0ab0ca706c1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/method_update.go @@ -0,0 +1,57 @@ +package capacityreservationgroups + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CapacityReservationGroup +} + +// Update ... +func (c CapacityReservationGroupsClient) Update(ctx context.Context, id CapacityReservationGroupId, input CapacityReservationGroupUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model CapacityReservationGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroup.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroup.go new file mode 100644 index 00000000000..5d553a43b13 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroup.go @@ -0,0 +1,20 @@ +package capacityreservationgroups + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationGroup struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CapacityReservationGroupProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroupinstanceview.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroupinstanceview.go new file mode 100644 index 00000000000..1276e3654d0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroupinstanceview.go @@ -0,0 +1,9 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationGroupInstanceView struct { + CapacityReservations *[]CapacityReservationInstanceViewWithName `json:"capacityReservations,omitempty"` + SharedSubscriptionIds *[]SubResourceReadOnly `json:"sharedSubscriptionIds,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroupproperties.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroupproperties.go new file mode 100644 index 00000000000..0127deaf9e6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroupproperties.go @@ -0,0 +1,12 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationGroupProperties struct { + CapacityReservations *[]SubResourceReadOnly `json:"capacityReservations,omitempty"` + InstanceView *CapacityReservationGroupInstanceView `json:"instanceView,omitempty"` + ReservationType *ReservationType `json:"reservationType,omitempty"` + SharingProfile *ResourceSharingProfile `json:"sharingProfile,omitempty"` + VirtualMachinesAssociated *[]SubResourceReadOnly `json:"virtualMachinesAssociated,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroupupdate.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroupupdate.go new file mode 100644 index 00000000000..d1f847c4e8f --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationgroupupdate.go @@ -0,0 +1,9 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationGroupUpdate struct { + Properties *CapacityReservationGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationinstanceviewwithname.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationinstanceviewwithname.go new file mode 100644 index 00000000000..95a760be66a --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationinstanceviewwithname.go @@ -0,0 +1,10 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationInstanceViewWithName struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + UtilizationInfo *CapacityReservationUtilization `json:"utilizationInfo,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationutilization.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationutilization.go new file mode 100644 index 00000000000..453c4d0ea1f --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_capacityreservationutilization.go @@ -0,0 +1,9 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationUtilization struct { + CurrentCapacity *int64 `json:"currentCapacity,omitempty"` + VirtualMachinesAllocated *[]SubResourceReadOnly `json:"virtualMachinesAllocated,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_instanceviewstatus.go new file mode 100644 index 00000000000..666443e0020 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package capacityreservationgroups + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_resourcesharingprofile.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_resourcesharingprofile.go new file mode 100644 index 00000000000..b50488d95b0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_resourcesharingprofile.go @@ -0,0 +1,8 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSharingProfile struct { + SubscriptionIds *[]SubResource `json:"subscriptionIds,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_subresource.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_subresource.go new file mode 100644 index 00000000000..c7c2e0ed790 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_subresource.go @@ -0,0 +1,8 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/model_subresourcereadonly.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_subresourcereadonly.go new file mode 100644 index 00000000000..4fc514b46ac --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservationgroups/predicates.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/predicates.go new file mode 100644 index 00000000000..d33edd6ae80 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/predicates.go @@ -0,0 +1,32 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CapacityReservationGroupOperationPredicate) Matches(input CapacityReservationGroup) 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/resource-manager/compute/2025-04-01/capacityreservationgroups/version.go b/resource-manager/compute/2025-04-01/capacityreservationgroups/version.go new file mode 100644 index 00000000000..260d4556275 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservationgroups/version.go @@ -0,0 +1,10 @@ +package capacityreservationgroups + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/capacityreservationgroups/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/README.md b/resource-manager/compute/2025-04-01/capacityreservations/README.md new file mode 100644 index 00000000000..3390f5188ba --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/capacityreservations` Documentation + +The `capacityreservations` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/capacityreservations" +``` + + +### Client Initialization + +```go +client := capacityreservations.NewCapacityReservationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapacityReservationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := capacityreservations.NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + +payload := capacityreservations.CapacityReservation{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacityReservationsClient.Delete` + +```go +ctx := context.TODO() +id := capacityreservations.NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacityReservationsClient.Get` + +```go +ctx := context.TODO() +id := capacityreservations.NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + +read, err := client.Get(ctx, id, capacityreservations.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityReservationsClient.ListByCapacityReservationGroup` + +```go +ctx := context.TODO() +id := capacityreservations.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +// alternatively `client.ListByCapacityReservationGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByCapacityReservationGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CapacityReservationsClient.Update` + +```go +ctx := context.TODO() +id := capacityreservations.NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + +payload := capacityreservations.CapacityReservationUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/capacityreservations/client.go b/resource-manager/compute/2025-04-01/capacityreservations/client.go new file mode 100644 index 00000000000..46407a5fa33 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/client.go @@ -0,0 +1,26 @@ +package capacityreservations + +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 CapacityReservationsClient struct { + Client *resourcemanager.Client +} + +func NewCapacityReservationsClientWithBaseURI(sdkApi sdkEnv.Api) (*CapacityReservationsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "capacityreservations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CapacityReservationsClient: %+v", err) + } + + return &CapacityReservationsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/constants.go b/resource-manager/compute/2025-04-01/capacityreservations/constants.go new file mode 100644 index 00000000000..d8475a2ee90 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/constants.go @@ -0,0 +1,92 @@ +package capacityreservations + +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 CapacityReservationInstanceViewTypes string + +const ( + CapacityReservationInstanceViewTypesInstanceView CapacityReservationInstanceViewTypes = "instanceView" +) + +func PossibleValuesForCapacityReservationInstanceViewTypes() []string { + return []string{ + string(CapacityReservationInstanceViewTypesInstanceView), + } +} + +func (s *CapacityReservationInstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCapacityReservationInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCapacityReservationInstanceViewTypes(input string) (*CapacityReservationInstanceViewTypes, error) { + vals := map[string]CapacityReservationInstanceViewTypes{ + "instanceview": CapacityReservationInstanceViewTypesInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CapacityReservationInstanceViewTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservation.go b/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservation.go new file mode 100644 index 00000000000..fc4e90461a0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservation.go @@ -0,0 +1,139 @@ +package capacityreservations + +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(&CapacityReservationId{}) +} + +var _ resourceids.ResourceId = &CapacityReservationId{} + +// CapacityReservationId is a struct representing the Resource ID for a Capacity Reservation +type CapacityReservationId struct { + SubscriptionId string + ResourceGroupName string + CapacityReservationGroupName string + CapacityReservationName string +} + +// NewCapacityReservationID returns a new CapacityReservationId struct +func NewCapacityReservationID(subscriptionId string, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string) CapacityReservationId { + return CapacityReservationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CapacityReservationGroupName: capacityReservationGroupName, + CapacityReservationName: capacityReservationName, + } +} + +// ParseCapacityReservationID parses 'input' into a CapacityReservationId +func ParseCapacityReservationID(input string) (*CapacityReservationId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCapacityReservationIDInsensitively parses 'input' case-insensitively into a CapacityReservationId +// note: this method should only be used for API response data and not user input +func ParseCapacityReservationIDInsensitively(input string) (*CapacityReservationId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationId) 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.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) + } + + if id.CapacityReservationName, ok = input.Parsed["capacityReservationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", input) + } + + return nil +} + +// ValidateCapacityReservationID checks that 'input' can be parsed as a Capacity Reservation ID +func ValidateCapacityReservationID(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 := ParseCapacityReservationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Reservation ID +func (id CapacityReservationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/capacityReservationGroups/%s/capacityReservations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CapacityReservationGroupName, id.CapacityReservationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Reservation ID +func (id CapacityReservationId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticCapacityReservationGroups", "capacityReservationGroups", "capacityReservationGroups"), + resourceids.UserSpecifiedSegment("capacityReservationGroupName", "capacityReservationGroupName"), + resourceids.StaticSegment("staticCapacityReservations", "capacityReservations", "capacityReservations"), + resourceids.UserSpecifiedSegment("capacityReservationName", "capacityReservationName"), + } +} + +// String returns a human-readable description of this Capacity Reservation ID +func (id CapacityReservationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Capacity Reservation Group Name: %q", id.CapacityReservationGroupName), + fmt.Sprintf("Capacity Reservation Name: %q", id.CapacityReservationName), + } + return fmt.Sprintf("Capacity Reservation (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservation_test.go b/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservation_test.go new file mode 100644 index 00000000000..f82b679396f --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservation_test.go @@ -0,0 +1,327 @@ +package capacityreservations + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &CapacityReservationId{} + +func TestNewCapacityReservationID(t *testing.T) { + id := NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CapacityReservationGroupName != "capacityReservationGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'CapacityReservationGroupName'", id.CapacityReservationGroupName, "capacityReservationGroupName") + } + + if id.CapacityReservationName != "capacityReservationName" { + t.Fatalf("Expected %q but got %q for Segment 'CapacityReservationName'", id.CapacityReservationName, "capacityReservationName") + } +} + +func TestFormatCapacityReservationID(t *testing.T) { + actual := NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCapacityReservationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName", + Expected: &CapacityReservationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + CapacityReservationName: "capacityReservationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + if actual.CapacityReservationName != v.Expected.CapacityReservationName { + t.Fatalf("Expected %q but got %q for CapacityReservationName", v.Expected.CapacityReservationName, actual.CapacityReservationName) + } + + } +} + +func TestParseCapacityReservationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/cApAcItYrEsErVaTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName", + Expected: &CapacityReservationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + CapacityReservationName: "capacityReservationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/cApAcItYrEsErVaTiOnS/cApAcItYrEsErVaTiOnNaMe", + Expected: &CapacityReservationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CapacityReservationGroupName: "cApAcItYrEsErVaTiOnGrOuPnAmE", + CapacityReservationName: "cApAcItYrEsErVaTiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/cApAcItYrEsErVaTiOnS/cApAcItYrEsErVaTiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + if actual.CapacityReservationName != v.Expected.CapacityReservationName { + t.Fatalf("Expected %q but got %q for CapacityReservationName", v.Expected.CapacityReservationName, actual.CapacityReservationName) + } + + } +} + +func TestSegmentsForCapacityReservationId(t *testing.T) { + segments := CapacityReservationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CapacityReservationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservationgroup.go b/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservationgroup.go new file mode 100644 index 00000000000..4154498a52c --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservationgroup.go @@ -0,0 +1,130 @@ +package capacityreservations + +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(&CapacityReservationGroupId{}) +} + +var _ resourceids.ResourceId = &CapacityReservationGroupId{} + +// CapacityReservationGroupId is a struct representing the Resource ID for a Capacity Reservation Group +type CapacityReservationGroupId struct { + SubscriptionId string + ResourceGroupName string + CapacityReservationGroupName string +} + +// NewCapacityReservationGroupID returns a new CapacityReservationGroupId struct +func NewCapacityReservationGroupID(subscriptionId string, resourceGroupName string, capacityReservationGroupName string) CapacityReservationGroupId { + return CapacityReservationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CapacityReservationGroupName: capacityReservationGroupName, + } +} + +// ParseCapacityReservationGroupID parses 'input' into a CapacityReservationGroupId +func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCapacityReservationGroupIDInsensitively parses 'input' case-insensitively into a CapacityReservationGroupId +// note: this method should only be used for API response data and not user input +func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReservationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationGroupId) 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.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) + } + + return nil +} + +// ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID +func ValidateCapacityReservationGroupID(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 := ParseCapacityReservationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Reservation Group ID +func (id CapacityReservationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/capacityReservationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CapacityReservationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Reservation Group ID +func (id CapacityReservationGroupId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticCapacityReservationGroups", "capacityReservationGroups", "capacityReservationGroups"), + resourceids.UserSpecifiedSegment("capacityReservationGroupName", "capacityReservationGroupName"), + } +} + +// String returns a human-readable description of this Capacity Reservation Group ID +func (id CapacityReservationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Capacity Reservation Group Name: %q", id.CapacityReservationGroupName), + } + return fmt.Sprintf("Capacity Reservation Group (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservationgroup_test.go b/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservationgroup_test.go new file mode 100644 index 00000000000..c0075b134a8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/id_capacityreservationgroup_test.go @@ -0,0 +1,282 @@ +package capacityreservations + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &CapacityReservationGroupId{} + +func TestNewCapacityReservationGroupID(t *testing.T) { + id := NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CapacityReservationGroupName != "capacityReservationGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'CapacityReservationGroupName'", id.CapacityReservationGroupName, "capacityReservationGroupName") + } +} + +func TestFormatCapacityReservationGroupID(t *testing.T) { + actual := NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCapacityReservationGroupID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationGroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationGroupID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + } +} + +func TestParseCapacityReservationGroupIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationGroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CapacityReservationGroupName: "cApAcItYrEsErVaTiOnGrOuPnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationGroupIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + } +} + +func TestSegmentsForCapacityReservationGroupId(t *testing.T) { + segments := CapacityReservationGroupId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CapacityReservationGroupId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/method_createorupdate.go b/resource-manager/compute/2025-04-01/capacityreservations/method_createorupdate.go new file mode 100644 index 00000000000..4cc71a324c2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/method_createorupdate.go @@ -0,0 +1,75 @@ +package capacityreservations + +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 *CapacityReservation +} + +// CreateOrUpdate ... +func (c CapacityReservationsClient) CreateOrUpdate(ctx context.Context, id CapacityReservationId, input CapacityReservation) (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 CapacityReservationsClient) CreateOrUpdateThenPoll(ctx context.Context, id CapacityReservationId, input CapacityReservation) 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/resource-manager/compute/2025-04-01/capacityreservations/method_delete.go b/resource-manager/compute/2025-04-01/capacityreservations/method_delete.go new file mode 100644 index 00000000000..7f0da68dfea --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/method_delete.go @@ -0,0 +1,71 @@ +package capacityreservations + +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 CapacityReservationsClient) Delete(ctx context.Context, id CapacityReservationId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CapacityReservationsClient) DeleteThenPoll(ctx context.Context, id CapacityReservationId) 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/resource-manager/compute/2025-04-01/capacityreservations/method_get.go b/resource-manager/compute/2025-04-01/capacityreservations/method_get.go new file mode 100644 index 00000000000..b9d6e655ff4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/method_get.go @@ -0,0 +1,83 @@ +package capacityreservations + +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 *CapacityReservation +} + +type GetOperationOptions struct { + Expand *CapacityReservationInstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c CapacityReservationsClient) Get(ctx context.Context, id CapacityReservationId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 CapacityReservation + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/method_listbycapacityreservationgroup.go b/resource-manager/compute/2025-04-01/capacityreservations/method_listbycapacityreservationgroup.go new file mode 100644 index 00000000000..074ae89d791 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/method_listbycapacityreservationgroup.go @@ -0,0 +1,105 @@ +package capacityreservations + +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 ListByCapacityReservationGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CapacityReservation +} + +type ListByCapacityReservationGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []CapacityReservation +} + +type ListByCapacityReservationGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByCapacityReservationGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByCapacityReservationGroup ... +func (c CapacityReservationsClient) ListByCapacityReservationGroup(ctx context.Context, id CapacityReservationGroupId) (result ListByCapacityReservationGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByCapacityReservationGroupCustomPager{}, + Path: fmt.Sprintf("%s/capacityReservations", 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 *[]CapacityReservation `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByCapacityReservationGroupComplete retrieves all the results into a single object +func (c CapacityReservationsClient) ListByCapacityReservationGroupComplete(ctx context.Context, id CapacityReservationGroupId) (ListByCapacityReservationGroupCompleteResult, error) { + return c.ListByCapacityReservationGroupCompleteMatchingPredicate(ctx, id, CapacityReservationOperationPredicate{}) +} + +// ListByCapacityReservationGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CapacityReservationsClient) ListByCapacityReservationGroupCompleteMatchingPredicate(ctx context.Context, id CapacityReservationGroupId, predicate CapacityReservationOperationPredicate) (result ListByCapacityReservationGroupCompleteResult, err error) { + items := make([]CapacityReservation, 0) + + resp, err := c.ListByCapacityReservationGroup(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 = ListByCapacityReservationGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/method_update.go b/resource-manager/compute/2025-04-01/capacityreservations/method_update.go new file mode 100644 index 00000000000..40dc175553a --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/method_update.go @@ -0,0 +1,75 @@ +package capacityreservations + +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 *CapacityReservation +} + +// Update ... +func (c CapacityReservationsClient) Update(ctx context.Context, id CapacityReservationId, input CapacityReservationUpdate) (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 CapacityReservationsClient) UpdateThenPoll(ctx context.Context, id CapacityReservationId, input CapacityReservationUpdate) 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/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservation.go b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservation.go new file mode 100644 index 00000000000..99c0631f5df --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservation.go @@ -0,0 +1,21 @@ +package capacityreservations + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservation struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CapacityReservationProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationinstanceview.go b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationinstanceview.go new file mode 100644 index 00000000000..e8f63035da7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationinstanceview.go @@ -0,0 +1,9 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationInstanceView struct { + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + UtilizationInfo *CapacityReservationUtilization `json:"utilizationInfo,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationproperties.go b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationproperties.go new file mode 100644 index 00000000000..91e2ed4cb70 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationproperties.go @@ -0,0 +1,45 @@ +package capacityreservations + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationProperties struct { + InstanceView *CapacityReservationInstanceView `json:"instanceView,omitempty"` + PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProvisioningTime *string `json:"provisioningTime,omitempty"` + ReservationId *string `json:"reservationId,omitempty"` + ScheduleProfile *ScheduleProfile `json:"scheduleProfile,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + VirtualMachinesAssociated *[]SubResourceReadOnly `json:"virtualMachinesAssociated,omitempty"` +} + +func (o *CapacityReservationProperties) GetProvisioningTimeAsTime() (*time.Time, error) { + if o.ProvisioningTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *CapacityReservationProperties) SetProvisioningTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningTime = &formatted +} + +func (o *CapacityReservationProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *CapacityReservationProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationupdate.go b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationupdate.go new file mode 100644 index 00000000000..0da9bad6a4d --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationupdate.go @@ -0,0 +1,10 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationUpdate struct { + Properties *CapacityReservationProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationutilization.go b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationutilization.go new file mode 100644 index 00000000000..5e0a10e4ffa --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/model_capacityreservationutilization.go @@ -0,0 +1,9 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationUtilization struct { + CurrentCapacity *int64 `json:"currentCapacity,omitempty"` + VirtualMachinesAllocated *[]SubResourceReadOnly `json:"virtualMachinesAllocated,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/capacityreservations/model_instanceviewstatus.go new file mode 100644 index 00000000000..6ba65f8c44f --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package capacityreservations + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/model_scheduleprofile.go b/resource-manager/compute/2025-04-01/capacityreservations/model_scheduleprofile.go new file mode 100644 index 00000000000..16a46895a28 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/model_scheduleprofile.go @@ -0,0 +1,9 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleProfile struct { + End *string `json:"end,omitempty"` + Start *string `json:"start,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/model_sku.go b/resource-manager/compute/2025-04-01/capacityreservations/model_sku.go new file mode 100644 index 00000000000..21a19282ce3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/model_sku.go @@ -0,0 +1,10 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/model_subresourcereadonly.go b/resource-manager/compute/2025-04-01/capacityreservations/model_subresourcereadonly.go new file mode 100644 index 00000000000..7d380adbea1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/capacityreservations/predicates.go b/resource-manager/compute/2025-04-01/capacityreservations/predicates.go new file mode 100644 index 00000000000..6c17efdaf33 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/predicates.go @@ -0,0 +1,32 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CapacityReservationOperationPredicate) Matches(input CapacityReservation) 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/resource-manager/compute/2025-04-01/capacityreservations/version.go b/resource-manager/compute/2025-04-01/capacityreservations/version.go new file mode 100644 index 00000000000..f6ec046a4d2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/capacityreservations/version.go @@ -0,0 +1,10 @@ +package capacityreservations + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/capacityreservations/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/client.go b/resource-manager/compute/2025-04-01/client.go new file mode 100644 index 00000000000..4a330ae7612 --- /dev/null +++ b/resource-manager/compute/2025-04-01/client.go @@ -0,0 +1,199 @@ +package v2025_04_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/availabilitysets" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/capacityreservationgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/capacityreservations" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/computerps" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/dedicatedhostgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/dedicatedhosts" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/images" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/proximityplacementgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/restorepointcollections" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/restorepoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/rollingupgradestatusinfos" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/sshpublickeyresources" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachineextensions" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachineruncommands" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachines" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesets" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesetvms" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AvailabilitySets *availabilitysets.AvailabilitySetsClient + CapacityReservationGroups *capacityreservationgroups.CapacityReservationGroupsClient + CapacityReservations *capacityreservations.CapacityReservationsClient + ComputeRPS *computerps.ComputeRPSClient + DedicatedHostGroups *dedicatedhostgroups.DedicatedHostGroupsClient + DedicatedHosts *dedicatedhosts.DedicatedHostsClient + Images *images.ImagesClient + ProximityPlacementGroups *proximityplacementgroups.ProximityPlacementGroupsClient + RestorePointCollections *restorepointcollections.RestorePointCollectionsClient + RestorePoints *restorepoints.RestorePointsClient + RollingUpgradeStatusInfos *rollingupgradestatusinfos.RollingUpgradeStatusInfosClient + SshPublicKeyResources *sshpublickeyresources.SshPublicKeyResourcesClient + VirtualMachineExtensions *virtualmachineextensions.VirtualMachineExtensionsClient + VirtualMachineRunCommands *virtualmachineruncommands.VirtualMachineRunCommandsClient + VirtualMachineScaleSetExtensions *virtualmachinescalesetextensions.VirtualMachineScaleSetExtensionsClient + VirtualMachineScaleSetVMExtensions *virtualmachinescalesetvmextensions.VirtualMachineScaleSetVMExtensionsClient + VirtualMachineScaleSetVMRunCommands *virtualmachinescalesetvmruncommands.VirtualMachineScaleSetVMRunCommandsClient + VirtualMachineScaleSetVMs *virtualmachinescalesetvms.VirtualMachineScaleSetVMsClient + VirtualMachineScaleSets *virtualmachinescalesets.VirtualMachineScaleSetsClient + VirtualMachines *virtualmachines.VirtualMachinesClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + availabilitySetsClient, err := availabilitysets.NewAvailabilitySetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AvailabilitySets client: %+v", err) + } + configureFunc(availabilitySetsClient.Client) + + capacityReservationGroupsClient, err := capacityreservationgroups.NewCapacityReservationGroupsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CapacityReservationGroups client: %+v", err) + } + configureFunc(capacityReservationGroupsClient.Client) + + capacityReservationsClient, err := capacityreservations.NewCapacityReservationsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CapacityReservations client: %+v", err) + } + configureFunc(capacityReservationsClient.Client) + + computeRPSClient, err := computerps.NewComputeRPSClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ComputeRPS client: %+v", err) + } + configureFunc(computeRPSClient.Client) + + dedicatedHostGroupsClient, err := dedicatedhostgroups.NewDedicatedHostGroupsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DedicatedHostGroups client: %+v", err) + } + configureFunc(dedicatedHostGroupsClient.Client) + + dedicatedHostsClient, err := dedicatedhosts.NewDedicatedHostsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DedicatedHosts client: %+v", err) + } + configureFunc(dedicatedHostsClient.Client) + + imagesClient, err := images.NewImagesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Images client: %+v", err) + } + configureFunc(imagesClient.Client) + + proximityPlacementGroupsClient, err := proximityplacementgroups.NewProximityPlacementGroupsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ProximityPlacementGroups client: %+v", err) + } + configureFunc(proximityPlacementGroupsClient.Client) + + restorePointCollectionsClient, err := restorepointcollections.NewRestorePointCollectionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building RestorePointCollections client: %+v", err) + } + configureFunc(restorePointCollectionsClient.Client) + + restorePointsClient, err := restorepoints.NewRestorePointsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building RestorePoints client: %+v", err) + } + configureFunc(restorePointsClient.Client) + + rollingUpgradeStatusInfosClient, err := rollingupgradestatusinfos.NewRollingUpgradeStatusInfosClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building RollingUpgradeStatusInfos client: %+v", err) + } + configureFunc(rollingUpgradeStatusInfosClient.Client) + + sshPublicKeyResourcesClient, err := sshpublickeyresources.NewSshPublicKeyResourcesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SshPublicKeyResources client: %+v", err) + } + configureFunc(sshPublicKeyResourcesClient.Client) + + virtualMachineExtensionsClient, err := virtualmachineextensions.NewVirtualMachineExtensionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineExtensions client: %+v", err) + } + configureFunc(virtualMachineExtensionsClient.Client) + + virtualMachineRunCommandsClient, err := virtualmachineruncommands.NewVirtualMachineRunCommandsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineRunCommands client: %+v", err) + } + configureFunc(virtualMachineRunCommandsClient.Client) + + virtualMachineScaleSetExtensionsClient, err := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSetExtensions client: %+v", err) + } + configureFunc(virtualMachineScaleSetExtensionsClient.Client) + + virtualMachineScaleSetVMExtensionsClient, err := virtualmachinescalesetvmextensions.NewVirtualMachineScaleSetVMExtensionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSetVMExtensions client: %+v", err) + } + configureFunc(virtualMachineScaleSetVMExtensionsClient.Client) + + virtualMachineScaleSetVMRunCommandsClient, err := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVMRunCommandsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSetVMRunCommands client: %+v", err) + } + configureFunc(virtualMachineScaleSetVMRunCommandsClient.Client) + + virtualMachineScaleSetVMsClient, err := virtualmachinescalesetvms.NewVirtualMachineScaleSetVMsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSetVMs client: %+v", err) + } + configureFunc(virtualMachineScaleSetVMsClient.Client) + + virtualMachineScaleSetsClient, err := virtualmachinescalesets.NewVirtualMachineScaleSetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSets client: %+v", err) + } + configureFunc(virtualMachineScaleSetsClient.Client) + + virtualMachinesClient, err := virtualmachines.NewVirtualMachinesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachines client: %+v", err) + } + configureFunc(virtualMachinesClient.Client) + + return &Client{ + AvailabilitySets: availabilitySetsClient, + CapacityReservationGroups: capacityReservationGroupsClient, + CapacityReservations: capacityReservationsClient, + ComputeRPS: computeRPSClient, + DedicatedHostGroups: dedicatedHostGroupsClient, + DedicatedHosts: dedicatedHostsClient, + Images: imagesClient, + ProximityPlacementGroups: proximityPlacementGroupsClient, + RestorePointCollections: restorePointCollectionsClient, + RestorePoints: restorePointsClient, + RollingUpgradeStatusInfos: rollingUpgradeStatusInfosClient, + SshPublicKeyResources: sshPublicKeyResourcesClient, + VirtualMachineExtensions: virtualMachineExtensionsClient, + VirtualMachineRunCommands: virtualMachineRunCommandsClient, + VirtualMachineScaleSetExtensions: virtualMachineScaleSetExtensionsClient, + VirtualMachineScaleSetVMExtensions: virtualMachineScaleSetVMExtensionsClient, + VirtualMachineScaleSetVMRunCommands: virtualMachineScaleSetVMRunCommandsClient, + VirtualMachineScaleSetVMs: virtualMachineScaleSetVMsClient, + VirtualMachineScaleSets: virtualMachineScaleSetsClient, + VirtualMachines: virtualMachinesClient, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/computerps/README.md b/resource-manager/compute/2025-04-01/computerps/README.md new file mode 100644 index 00000000000..adaf5f7274d --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/README.md @@ -0,0 +1,380 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/computerps` Documentation + +The `computerps` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/computerps" +``` + + +### Client Initialization + +```go +client := computerps.NewComputeRPSClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ComputeRPSClient.LogAnalyticsExportRequestRateByInterval` + +```go +ctx := context.TODO() +id := computerps.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +payload := computerps.RequestRateByIntervalInput{ + // ... +} + + +if err := client.LogAnalyticsExportRequestRateByIntervalThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ComputeRPSClient.LogAnalyticsExportThrottledRequests` + +```go +ctx := context.TODO() +id := computerps.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +payload := computerps.LogAnalyticsInputBase{ + // ... +} + + +if err := client.LogAnalyticsExportThrottledRequestsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ComputeRPSClient.UsageList` + +```go +ctx := context.TODO() +id := computerps.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.UsageList(ctx, id)` can be used to do batched pagination +items, err := client.UsageListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineExtensionImagesGet` + +```go +ctx := context.TODO() +id := computerps.NewVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName", "versionName") + +read, err := client.VirtualMachineExtensionImagesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineExtensionImagesListTypes` + +```go +ctx := context.TODO() +id := computerps.NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName") + +read, err := client.VirtualMachineExtensionImagesListTypes(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineExtensionImagesListVersions` + +```go +ctx := context.TODO() +id := computerps.NewTypeID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName") + +read, err := client.VirtualMachineExtensionImagesListVersions(ctx, id, computerps.DefaultVirtualMachineExtensionImagesListVersionsOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesEdgeZoneGet` + +```go +ctx := context.TODO() +id := computerps.NewOfferSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName", "versionName") + +read, err := client.VirtualMachineImagesEdgeZoneGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesEdgeZoneList` + +```go +ctx := context.TODO() +id := computerps.NewOfferSkuID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName") + +read, err := client.VirtualMachineImagesEdgeZoneList(ctx, id, computerps.DefaultVirtualMachineImagesEdgeZoneListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesEdgeZoneListOffers` + +```go +ctx := context.TODO() +id := computerps.NewEdgeZonePublisherID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName") + +read, err := client.VirtualMachineImagesEdgeZoneListOffers(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesEdgeZoneListPublishers` + +```go +ctx := context.TODO() +id := computerps.NewEdgeZoneID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName") + +read, err := client.VirtualMachineImagesEdgeZoneListPublishers(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesEdgeZoneListSkus` + +```go +ctx := context.TODO() +id := computerps.NewVMImageOfferID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName") + +read, err := client.VirtualMachineImagesEdgeZoneListSkus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesGet` + +```go +ctx := context.TODO() +id := computerps.NewSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName", "versionName") + +read, err := client.VirtualMachineImagesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesList` + +```go +ctx := context.TODO() +id := computerps.NewSkuID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName") + +read, err := client.VirtualMachineImagesList(ctx, id, computerps.DefaultVirtualMachineImagesListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesListByEdgeZone` + +```go +ctx := context.TODO() +id := computerps.NewEdgeZoneID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName") + +// alternatively `client.VirtualMachineImagesListByEdgeZone(ctx, id)` can be used to do batched pagination +items, err := client.VirtualMachineImagesListByEdgeZoneComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesListOffers` + +```go +ctx := context.TODO() +id := computerps.NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName") + +read, err := client.VirtualMachineImagesListOffers(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesListPublishers` + +```go +ctx := context.TODO() +id := computerps.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +read, err := client.VirtualMachineImagesListPublishers(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineImagesListSkus` + +```go +ctx := context.TODO() +id := computerps.NewOfferID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName") + +read, err := client.VirtualMachineImagesListSkus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineRunCommandsGet` + +```go +ctx := context.TODO() +id := computerps.NewRunCommandID("12345678-1234-9876-4563-123456789012", "locationName", "commandId") + +read, err := client.VirtualMachineRunCommandsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineRunCommandsList` + +```go +ctx := context.TODO() +id := computerps.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.VirtualMachineRunCommandsList(ctx, id)` can be used to do batched pagination +items, err := client.VirtualMachineRunCommandsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineScaleSetsListByLocation` + +```go +ctx := context.TODO() +id := computerps.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.VirtualMachineScaleSetsListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.VirtualMachineScaleSetsListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachineSizesList` + +```go +ctx := context.TODO() +id := computerps.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.VirtualMachineSizesList(ctx, id)` can be used to do batched pagination +items, err := client.VirtualMachineSizesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ComputeRPSClient.VirtualMachinesListByLocation` + +```go +ctx := context.TODO() +id := computerps.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.VirtualMachinesListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.VirtualMachinesListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/compute/2025-04-01/computerps/client.go b/resource-manager/compute/2025-04-01/computerps/client.go new file mode 100644 index 00000000000..1c5fb46f90d --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/client.go @@ -0,0 +1,26 @@ +package computerps + +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 ComputeRPSClient struct { + Client *resourcemanager.Client +} + +func NewComputeRPSClientWithBaseURI(sdkApi sdkEnv.Api) (*ComputeRPSClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "computerps", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ComputeRPSClient: %+v", err) + } + + return &ComputeRPSClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/computerps/constants.go b/resource-manager/compute/2025-04-01/computerps/constants.go new file mode 100644 index 00000000000..d4c0071f153 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/constants.go @@ -0,0 +1,2932 @@ +package computerps + +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 AllocationStrategy string + +const ( + AllocationStrategyCapacityOptimized AllocationStrategy = "CapacityOptimized" + AllocationStrategyLowestPrice AllocationStrategy = "LowestPrice" + AllocationStrategyPrioritized AllocationStrategy = "Prioritized" +) + +func PossibleValuesForAllocationStrategy() []string { + return []string{ + string(AllocationStrategyCapacityOptimized), + string(AllocationStrategyLowestPrice), + string(AllocationStrategyPrioritized), + } +} + +func (s *AllocationStrategy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAllocationStrategy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAllocationStrategy(input string) (*AllocationStrategy, error) { + vals := map[string]AllocationStrategy{ + "capacityoptimized": AllocationStrategyCapacityOptimized, + "lowestprice": AllocationStrategyLowestPrice, + "prioritized": AllocationStrategyPrioritized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllocationStrategy(input) + return &out, nil +} + +type AlternativeType string + +const ( + AlternativeTypeNone AlternativeType = "None" + AlternativeTypeOffer AlternativeType = "Offer" + AlternativeTypePlan AlternativeType = "Plan" +) + +func PossibleValuesForAlternativeType() []string { + return []string{ + string(AlternativeTypeNone), + string(AlternativeTypeOffer), + string(AlternativeTypePlan), + } +} + +func (s *AlternativeType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlternativeType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAlternativeType(input string) (*AlternativeType, error) { + vals := map[string]AlternativeType{ + "none": AlternativeTypeNone, + "offer": AlternativeTypeOffer, + "plan": AlternativeTypePlan, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AlternativeType(input) + return &out, nil +} + +type ArchitectureTypes string + +const ( + ArchitectureTypesArmSixFour ArchitectureTypes = "Arm64" + ArchitectureTypesXSixFour ArchitectureTypes = "x64" +) + +func PossibleValuesForArchitectureTypes() []string { + return []string{ + string(ArchitectureTypesArmSixFour), + string(ArchitectureTypesXSixFour), + } +} + +func (s *ArchitectureTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseArchitectureTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseArchitectureTypes(input string) (*ArchitectureTypes, error) { + vals := map[string]ArchitectureTypes{ + "arm64": ArchitectureTypesArmSixFour, + "x64": ArchitectureTypesXSixFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ArchitectureTypes(input) + return &out, nil +} + +type CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentName string + +const ( + ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentName = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentName() []string { + return []string{ + string(ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentName(input string) (*ComponentName, error) { + vals := map[string]ComponentName{ + "microsoft-windows-shell-setup": ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentName(input) + return &out, nil +} + +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +func PossibleValuesForDeleteOptions() []string { + return []string{ + string(DeleteOptionsDelete), + string(DeleteOptionsDetach), + } +} + +func (s *DeleteOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeleteOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeleteOptions(input string) (*DeleteOptions, error) { + vals := map[string]DeleteOptions{ + "delete": DeleteOptionsDelete, + "detach": DeleteOptionsDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeleteOptions(input) + return &out, nil +} + +type DiffDiskOptions string + +const ( + DiffDiskOptionsLocal DiffDiskOptions = "Local" +) + +func PossibleValuesForDiffDiskOptions() []string { + return []string{ + string(DiffDiskOptionsLocal), + } +} + +func (s *DiffDiskOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskOptions(input string) (*DiffDiskOptions, error) { + vals := map[string]DiffDiskOptions{ + "local": DiffDiskOptionsLocal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskOptions(input) + return &out, nil +} + +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" + DiffDiskPlacementNVMeDisk DiffDiskPlacement = "NvmeDisk" + DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" +) + +func PossibleValuesForDiffDiskPlacement() []string { + return []string{ + string(DiffDiskPlacementCacheDisk), + string(DiffDiskPlacementNVMeDisk), + string(DiffDiskPlacementResourceDisk), + } +} + +func (s *DiffDiskPlacement) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskPlacement(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) { + vals := map[string]DiffDiskPlacement{ + "cachedisk": DiffDiskPlacementCacheDisk, + "nvmedisk": DiffDiskPlacementNVMeDisk, + "resourcedisk": DiffDiskPlacementResourceDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskPlacement(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + DiskCreateOptionTypesCopy DiskCreateOptionTypes = "Copy" + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" + DiskCreateOptionTypesRestore DiskCreateOptionTypes = "Restore" +) + +func PossibleValuesForDiskCreateOptionTypes() []string { + return []string{ + string(DiskCreateOptionTypesAttach), + string(DiskCreateOptionTypesCopy), + string(DiskCreateOptionTypesEmpty), + string(DiskCreateOptionTypesFromImage), + string(DiskCreateOptionTypesRestore), + } +} + +func (s *DiskCreateOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskCreateOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskCreateOptionTypes(input string) (*DiskCreateOptionTypes, error) { + vals := map[string]DiskCreateOptionTypes{ + "attach": DiskCreateOptionTypesAttach, + "copy": DiskCreateOptionTypesCopy, + "empty": DiskCreateOptionTypesEmpty, + "fromimage": DiskCreateOptionTypesFromImage, + "restore": DiskCreateOptionTypesRestore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskCreateOptionTypes(input) + return &out, nil +} + +type DiskDeleteOptionTypes string + +const ( + DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete" + DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach" +) + +func PossibleValuesForDiskDeleteOptionTypes() []string { + return []string{ + string(DiskDeleteOptionTypesDelete), + string(DiskDeleteOptionTypesDetach), + } +} + +func (s *DiskDeleteOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDeleteOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDeleteOptionTypes(input string) (*DiskDeleteOptionTypes, error) { + vals := map[string]DiskDeleteOptionTypes{ + "delete": DiskDeleteOptionTypesDelete, + "detach": DiskDeleteOptionTypesDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDeleteOptionTypes(input) + return &out, nil +} + +type DiskDetachOptionTypes string + +const ( + DiskDetachOptionTypesForceDetach DiskDetachOptionTypes = "ForceDetach" +) + +func PossibleValuesForDiskDetachOptionTypes() []string { + return []string{ + string(DiskDetachOptionTypesForceDetach), + } +} + +func (s *DiskDetachOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDetachOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDetachOptionTypes(input string) (*DiskDetachOptionTypes, error) { + vals := map[string]DiskDetachOptionTypes{ + "forcedetach": DiskDetachOptionTypesForceDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDetachOptionTypes(input) + return &out, nil +} + +type DomainNameLabelScopeTypes string + +const ( + DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse" + DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse" + DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse" + DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse" +) + +func PossibleValuesForDomainNameLabelScopeTypes() []string { + return []string{ + string(DomainNameLabelScopeTypesNoReuse), + string(DomainNameLabelScopeTypesResourceGroupReuse), + string(DomainNameLabelScopeTypesSubscriptionReuse), + string(DomainNameLabelScopeTypesTenantReuse), + } +} + +func (s *DomainNameLabelScopeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDomainNameLabelScopeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDomainNameLabelScopeTypes(input string) (*DomainNameLabelScopeTypes, error) { + vals := map[string]DomainNameLabelScopeTypes{ + "noreuse": DomainNameLabelScopeTypesNoReuse, + "resourcegroupreuse": DomainNameLabelScopeTypesResourceGroupReuse, + "subscriptionreuse": DomainNameLabelScopeTypesSubscriptionReuse, + "tenantreuse": DomainNameLabelScopeTypesTenantReuse, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DomainNameLabelScopeTypes(input) + return &out, nil +} + +type HighSpeedInterconnectPlacement string + +const ( + HighSpeedInterconnectPlacementNone HighSpeedInterconnectPlacement = "None" + HighSpeedInterconnectPlacementTrunk HighSpeedInterconnectPlacement = "Trunk" +) + +func PossibleValuesForHighSpeedInterconnectPlacement() []string { + return []string{ + string(HighSpeedInterconnectPlacementNone), + string(HighSpeedInterconnectPlacementTrunk), + } +} + +func (s *HighSpeedInterconnectPlacement) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHighSpeedInterconnectPlacement(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHighSpeedInterconnectPlacement(input string) (*HighSpeedInterconnectPlacement, error) { + vals := map[string]HighSpeedInterconnectPlacement{ + "none": HighSpeedInterconnectPlacementNone, + "trunk": HighSpeedInterconnectPlacementTrunk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HighSpeedInterconnectPlacement(input) + return &out, nil +} + +type HyperVGenerationType string + +const ( + HyperVGenerationTypeVOne HyperVGenerationType = "V1" + HyperVGenerationTypeVTwo HyperVGenerationType = "V2" +) + +func PossibleValuesForHyperVGenerationType() []string { + return []string{ + string(HyperVGenerationTypeVOne), + string(HyperVGenerationTypeVTwo), + } +} + +func (s *HyperVGenerationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationType(input string) (*HyperVGenerationType, error) { + vals := map[string]HyperVGenerationType{ + "v1": HyperVGenerationTypeVOne, + "v2": HyperVGenerationTypeVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationType(input) + return &out, nil +} + +type HyperVGenerationTypes string + +const ( + HyperVGenerationTypesVOne HyperVGenerationTypes = "V1" + HyperVGenerationTypesVTwo HyperVGenerationTypes = "V2" +) + +func PossibleValuesForHyperVGenerationTypes() []string { + return []string{ + string(HyperVGenerationTypesVOne), + string(HyperVGenerationTypesVTwo), + } +} + +func (s *HyperVGenerationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationTypes(input string) (*HyperVGenerationTypes, error) { + vals := map[string]HyperVGenerationTypes{ + "v1": HyperVGenerationTypesVOne, + "v2": HyperVGenerationTypesVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationTypes(input) + return &out, nil +} + +type IPVersion string + +const ( + IPVersionIPvFour IPVersion = "IPv4" + IPVersionIPvSix IPVersion = "IPv6" +) + +func PossibleValuesForIPVersion() []string { + return []string{ + string(IPVersionIPvFour), + string(IPVersionIPvSix), + } +} + +func (s *IPVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersion(input string) (*IPVersion, error) { + vals := map[string]IPVersion{ + "ipv4": IPVersionIPvFour, + "ipv6": IPVersionIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersion(input) + return &out, nil +} + +type IPVersions string + +const ( + IPVersionsIPvFour IPVersions = "IPv4" + IPVersionsIPvSix IPVersions = "IPv6" +) + +func PossibleValuesForIPVersions() []string { + return []string{ + string(IPVersionsIPvFour), + string(IPVersionsIPvSix), + } +} + +func (s *IPVersions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersions(input string) (*IPVersions, error) { + vals := map[string]IPVersions{ + "ipv4": IPVersionsIPvFour, + "ipv6": IPVersionsIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersions(input) + return &out, nil +} + +type ImageState string + +const ( + ImageStateActive ImageState = "Active" + ImageStateDeprecated ImageState = "Deprecated" + ImageStateScheduledForDeprecation ImageState = "ScheduledForDeprecation" +) + +func PossibleValuesForImageState() []string { + return []string{ + string(ImageStateActive), + string(ImageStateDeprecated), + string(ImageStateScheduledForDeprecation), + } +} + +func (s *ImageState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseImageState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseImageState(input string) (*ImageState, error) { + vals := map[string]ImageState{ + "active": ImageStateActive, + "deprecated": ImageStateDeprecated, + "scheduledfordeprecation": ImageStateScheduledForDeprecation, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ImageState(input) + return &out, nil +} + +type IntervalInMins string + +const ( + IntervalInMinsFiveMins IntervalInMins = "FiveMins" + IntervalInMinsSixtyMins IntervalInMins = "SixtyMins" + IntervalInMinsThirtyMins IntervalInMins = "ThirtyMins" + IntervalInMinsThreeMins IntervalInMins = "ThreeMins" +) + +func PossibleValuesForIntervalInMins() []string { + return []string{ + string(IntervalInMinsFiveMins), + string(IntervalInMinsSixtyMins), + string(IntervalInMinsThirtyMins), + string(IntervalInMinsThreeMins), + } +} + +func (s *IntervalInMins) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIntervalInMins(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIntervalInMins(input string) (*IntervalInMins, error) { + vals := map[string]IntervalInMins{ + "fivemins": IntervalInMinsFiveMins, + "sixtymins": IntervalInMinsSixtyMins, + "thirtymins": IntervalInMinsThirtyMins, + "threemins": IntervalInMinsThreeMins, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IntervalInMins(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type MaintenanceOperationResultCodeTypes string + +const ( + MaintenanceOperationResultCodeTypesMaintenanceAborted MaintenanceOperationResultCodeTypes = "MaintenanceAborted" + MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted" + MaintenanceOperationResultCodeTypesNone MaintenanceOperationResultCodeTypes = "None" + MaintenanceOperationResultCodeTypesRetryLater MaintenanceOperationResultCodeTypes = "RetryLater" +) + +func PossibleValuesForMaintenanceOperationResultCodeTypes() []string { + return []string{ + string(MaintenanceOperationResultCodeTypesMaintenanceAborted), + string(MaintenanceOperationResultCodeTypesMaintenanceCompleted), + string(MaintenanceOperationResultCodeTypesNone), + string(MaintenanceOperationResultCodeTypesRetryLater), + } +} + +func (s *MaintenanceOperationResultCodeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMaintenanceOperationResultCodeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMaintenanceOperationResultCodeTypes(input string) (*MaintenanceOperationResultCodeTypes, error) { + vals := map[string]MaintenanceOperationResultCodeTypes{ + "maintenanceaborted": MaintenanceOperationResultCodeTypesMaintenanceAborted, + "maintenancecompleted": MaintenanceOperationResultCodeTypesMaintenanceCompleted, + "none": MaintenanceOperationResultCodeTypesNone, + "retrylater": MaintenanceOperationResultCodeTypesRetryLater, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MaintenanceOperationResultCodeTypes(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type NetworkApiVersion string + +const ( + NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne NetworkApiVersion = "2022-11-01" + NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne NetworkApiVersion = "2020-11-01" +) + +func PossibleValuesForNetworkApiVersion() []string { + return []string{ + string(NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne), + string(NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne), + } +} + +func (s *NetworkApiVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkApiVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkApiVersion(input string) (*NetworkApiVersion, error) { + vals := map[string]NetworkApiVersion{ + "2022-11-01": NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne, + "2020-11-01": NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkApiVersion(input) + return &out, nil +} + +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliaryMode() []string { + return []string{ + string(NetworkInterfaceAuxiliaryModeAcceleratedConnections), + string(NetworkInterfaceAuxiliaryModeFloating), + string(NetworkInterfaceAuxiliaryModeNone), + } +} + +func (s *NetworkInterfaceAuxiliaryMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliaryMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliaryMode(input string) (*NetworkInterfaceAuxiliaryMode, error) { + vals := map[string]NetworkInterfaceAuxiliaryMode{ + "acceleratedconnections": NetworkInterfaceAuxiliaryModeAcceleratedConnections, + "floating": NetworkInterfaceAuxiliaryModeFloating, + "none": NetworkInterfaceAuxiliaryModeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliaryMode(input) + return &out, nil +} + +type NetworkInterfaceAuxiliarySku string + +const ( + NetworkInterfaceAuxiliarySkuAEight NetworkInterfaceAuxiliarySku = "A8" + NetworkInterfaceAuxiliarySkuAFour NetworkInterfaceAuxiliarySku = "A4" + NetworkInterfaceAuxiliarySkuAOne NetworkInterfaceAuxiliarySku = "A1" + NetworkInterfaceAuxiliarySkuATwo NetworkInterfaceAuxiliarySku = "A2" + NetworkInterfaceAuxiliarySkuNone NetworkInterfaceAuxiliarySku = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliarySku() []string { + return []string{ + string(NetworkInterfaceAuxiliarySkuAEight), + string(NetworkInterfaceAuxiliarySkuAFour), + string(NetworkInterfaceAuxiliarySkuAOne), + string(NetworkInterfaceAuxiliarySkuATwo), + string(NetworkInterfaceAuxiliarySkuNone), + } +} + +func (s *NetworkInterfaceAuxiliarySku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliarySku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliarySku(input string) (*NetworkInterfaceAuxiliarySku, error) { + vals := map[string]NetworkInterfaceAuxiliarySku{ + "a8": NetworkInterfaceAuxiliarySkuAEight, + "a4": NetworkInterfaceAuxiliarySkuAFour, + "a1": NetworkInterfaceAuxiliarySkuAOne, + "a2": NetworkInterfaceAuxiliarySkuATwo, + "none": NetworkInterfaceAuxiliarySkuNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliarySku(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type OrchestrationMode string + +const ( + OrchestrationModeFlexible OrchestrationMode = "Flexible" + OrchestrationModeUniform OrchestrationMode = "Uniform" +) + +func PossibleValuesForOrchestrationMode() []string { + return []string{ + string(OrchestrationModeFlexible), + string(OrchestrationModeUniform), + } +} + +func (s *OrchestrationMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationMode(input string) (*OrchestrationMode, error) { + vals := map[string]OrchestrationMode{ + "flexible": OrchestrationModeFlexible, + "uniform": OrchestrationModeUniform, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationMode(input) + return &out, nil +} + +type PassName string + +const ( + PassNameOobeSystem PassName = "OobeSystem" +) + +func PossibleValuesForPassName() []string { + return []string{ + string(PassNameOobeSystem), + } +} + +func (s *PassName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassName(input string) (*PassName, error) { + vals := map[string]PassName{ + "oobesystem": PassNameOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassName(input) + return &out, nil +} + +type PatchOperationStatus string + +const ( + PatchOperationStatusCompletedWithWarnings PatchOperationStatus = "CompletedWithWarnings" + PatchOperationStatusFailed PatchOperationStatus = "Failed" + PatchOperationStatusInProgress PatchOperationStatus = "InProgress" + PatchOperationStatusSucceeded PatchOperationStatus = "Succeeded" + PatchOperationStatusUnknown PatchOperationStatus = "Unknown" +) + +func PossibleValuesForPatchOperationStatus() []string { + return []string{ + string(PatchOperationStatusCompletedWithWarnings), + string(PatchOperationStatusFailed), + string(PatchOperationStatusInProgress), + string(PatchOperationStatusSucceeded), + string(PatchOperationStatusUnknown), + } +} + +func (s *PatchOperationStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePatchOperationStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePatchOperationStatus(input string) (*PatchOperationStatus, error) { + vals := map[string]PatchOperationStatus{ + "completedwithwarnings": PatchOperationStatusCompletedWithWarnings, + "failed": PatchOperationStatusFailed, + "inprogress": PatchOperationStatusInProgress, + "succeeded": PatchOperationStatusSucceeded, + "unknown": PatchOperationStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PatchOperationStatus(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type PublicIPAddressSkuName string + +const ( + PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" + PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" +) + +func PossibleValuesForPublicIPAddressSkuName() []string { + return []string{ + string(PublicIPAddressSkuNameBasic), + string(PublicIPAddressSkuNameStandard), + } +} + +func (s *PublicIPAddressSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuName(input string) (*PublicIPAddressSkuName, error) { + vals := map[string]PublicIPAddressSkuName{ + "basic": PublicIPAddressSkuNameBasic, + "standard": PublicIPAddressSkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuName(input) + return &out, nil +} + +type PublicIPAddressSkuTier string + +const ( + PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" + PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" +) + +func PossibleValuesForPublicIPAddressSkuTier() []string { + return []string{ + string(PublicIPAddressSkuTierGlobal), + string(PublicIPAddressSkuTierRegional), + } +} + +func (s *PublicIPAddressSkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuTier(input string) (*PublicIPAddressSkuTier, error) { + vals := map[string]PublicIPAddressSkuTier{ + "global": PublicIPAddressSkuTierGlobal, + "regional": PublicIPAddressSkuTierRegional, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuTier(input) + return &out, nil +} + +type PublicIPAllocationMethod string + +const ( + PublicIPAllocationMethodDynamic PublicIPAllocationMethod = "Dynamic" + PublicIPAllocationMethodStatic PublicIPAllocationMethod = "Static" +) + +func PossibleValuesForPublicIPAllocationMethod() []string { + return []string{ + string(PublicIPAllocationMethodDynamic), + string(PublicIPAllocationMethodStatic), + } +} + +func (s *PublicIPAllocationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAllocationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAllocationMethod(input string) (*PublicIPAllocationMethod, error) { + vals := map[string]PublicIPAllocationMethod{ + "dynamic": PublicIPAllocationMethodDynamic, + "static": PublicIPAllocationMethodStatic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAllocationMethod(input) + return &out, nil +} + +type RebalanceBehavior string + +const ( + RebalanceBehaviorCreateBeforeDelete RebalanceBehavior = "CreateBeforeDelete" +) + +func PossibleValuesForRebalanceBehavior() []string { + return []string{ + string(RebalanceBehaviorCreateBeforeDelete), + } +} + +func (s *RebalanceBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRebalanceBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRebalanceBehavior(input string) (*RebalanceBehavior, error) { + vals := map[string]RebalanceBehavior{ + "createbeforedelete": RebalanceBehaviorCreateBeforeDelete, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RebalanceBehavior(input) + return &out, nil +} + +type RebalanceStrategy string + +const ( + RebalanceStrategyRecreate RebalanceStrategy = "Recreate" +) + +func PossibleValuesForRebalanceStrategy() []string { + return []string{ + string(RebalanceStrategyRecreate), + } +} + +func (s *RebalanceStrategy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRebalanceStrategy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRebalanceStrategy(input string) (*RebalanceStrategy, error) { + vals := map[string]RebalanceStrategy{ + "recreate": RebalanceStrategyRecreate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RebalanceStrategy(input) + return &out, nil +} + +type RepairAction string + +const ( + RepairActionReimage RepairAction = "Reimage" + RepairActionReplace RepairAction = "Replace" + RepairActionRestart RepairAction = "Restart" +) + +func PossibleValuesForRepairAction() []string { + return []string{ + string(RepairActionReimage), + string(RepairActionReplace), + string(RepairActionRestart), + } +} + +func (s *RepairAction) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRepairAction(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRepairAction(input string) (*RepairAction, error) { + vals := map[string]RepairAction{ + "reimage": RepairActionReimage, + "replace": RepairActionReplace, + "restart": RepairActionRestart, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RepairAction(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type Unit string + +const ( + UnitCount Unit = "Count" +) + +func PossibleValuesForUnit() []string { + return []string{ + string(UnitCount), + } +} + +func (s *Unit) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUnit(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUnit(input string) (*Unit, error) { + vals := map[string]Unit{ + "count": UnitCount, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Unit(input) + return &out, nil +} + +type UpgradeMode string + +const ( + UpgradeModeAutomatic UpgradeMode = "Automatic" + UpgradeModeManual UpgradeMode = "Manual" + UpgradeModeRolling UpgradeMode = "Rolling" +) + +func PossibleValuesForUpgradeMode() []string { + return []string{ + string(UpgradeModeAutomatic), + string(UpgradeModeManual), + string(UpgradeModeRolling), + } +} + +func (s *UpgradeMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUpgradeMode(input string) (*UpgradeMode, error) { + vals := map[string]UpgradeMode{ + "automatic": UpgradeModeAutomatic, + "manual": UpgradeModeManual, + "rolling": UpgradeModeRolling, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpgradeMode(input) + return &out, nil +} + +type VMDiskTypes string + +const ( + VMDiskTypesNone VMDiskTypes = "None" + VMDiskTypesUnmanaged VMDiskTypes = "Unmanaged" +) + +func PossibleValuesForVMDiskTypes() []string { + return []string{ + string(VMDiskTypesNone), + string(VMDiskTypesUnmanaged), + } +} + +func (s *VMDiskTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMDiskTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMDiskTypes(input string) (*VMDiskTypes, error) { + vals := map[string]VMDiskTypes{ + "none": VMDiskTypesNone, + "unmanaged": VMDiskTypesUnmanaged, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMDiskTypes(input) + return &out, nil +} + +type VirtualMachineEvictionPolicyTypes string + +const ( + VirtualMachineEvictionPolicyTypesDeallocate VirtualMachineEvictionPolicyTypes = "Deallocate" + VirtualMachineEvictionPolicyTypesDelete VirtualMachineEvictionPolicyTypes = "Delete" +) + +func PossibleValuesForVirtualMachineEvictionPolicyTypes() []string { + return []string{ + string(VirtualMachineEvictionPolicyTypesDeallocate), + string(VirtualMachineEvictionPolicyTypesDelete), + } +} + +func (s *VirtualMachineEvictionPolicyTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineEvictionPolicyTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineEvictionPolicyTypes(input string) (*VirtualMachineEvictionPolicyTypes, error) { + vals := map[string]VirtualMachineEvictionPolicyTypes{ + "deallocate": VirtualMachineEvictionPolicyTypesDeallocate, + "delete": VirtualMachineEvictionPolicyTypesDelete, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineEvictionPolicyTypes(input) + return &out, nil +} + +type VirtualMachinePriorityTypes string + +const ( + VirtualMachinePriorityTypesLow VirtualMachinePriorityTypes = "Low" + VirtualMachinePriorityTypesRegular VirtualMachinePriorityTypes = "Regular" + VirtualMachinePriorityTypesSpot VirtualMachinePriorityTypes = "Spot" +) + +func PossibleValuesForVirtualMachinePriorityTypes() []string { + return []string{ + string(VirtualMachinePriorityTypesLow), + string(VirtualMachinePriorityTypesRegular), + string(VirtualMachinePriorityTypesSpot), + } +} + +func (s *VirtualMachinePriorityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachinePriorityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachinePriorityTypes(input string) (*VirtualMachinePriorityTypes, error) { + vals := map[string]VirtualMachinePriorityTypes{ + "low": VirtualMachinePriorityTypesLow, + "regular": VirtualMachinePriorityTypesRegular, + "spot": VirtualMachinePriorityTypesSpot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachinePriorityTypes(input) + return &out, nil +} + +type VirtualMachineScaleSetScaleInRules string + +const ( + VirtualMachineScaleSetScaleInRulesDefault VirtualMachineScaleSetScaleInRules = "Default" + VirtualMachineScaleSetScaleInRulesNewestVM VirtualMachineScaleSetScaleInRules = "NewestVM" + VirtualMachineScaleSetScaleInRulesOldestVM VirtualMachineScaleSetScaleInRules = "OldestVM" +) + +func PossibleValuesForVirtualMachineScaleSetScaleInRules() []string { + return []string{ + string(VirtualMachineScaleSetScaleInRulesDefault), + string(VirtualMachineScaleSetScaleInRulesNewestVM), + string(VirtualMachineScaleSetScaleInRulesOldestVM), + } +} + +func (s *VirtualMachineScaleSetScaleInRules) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineScaleSetScaleInRules(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineScaleSetScaleInRules(input string) (*VirtualMachineScaleSetScaleInRules, error) { + vals := map[string]VirtualMachineScaleSetScaleInRules{ + "default": VirtualMachineScaleSetScaleInRulesDefault, + "newestvm": VirtualMachineScaleSetScaleInRulesNewestVM, + "oldestvm": VirtualMachineScaleSetScaleInRulesOldestVM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineScaleSetScaleInRules(input) + return &out, nil +} + +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicAFour VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesBasicAOne VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicAThree VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicATwo VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicAZero VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesStandardAEight VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardAEightVTwo VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardAEightmVTwo VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardAFive VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardAFour VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardAFourVTwo VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardAFourmVTwo VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardANine VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardAOne VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardAOneOne VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardAOneVTwo VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardAOneZero VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardASeven VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardASix VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardAThree VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardATwo VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardATwoVTwo VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardATwomVTwo VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardAZero VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardBEightms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardBFourms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardBOnems VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardBOnes VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardBTwoms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardBTwos VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardDEightVThree VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDEightsVThree VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardDFiveVTwo VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDFour VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardDFourVThree VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardDFourVTwo VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardDFoursVThree VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardDOne VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardDOneFiveVTwo VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardDOneFour VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardDOneFourVTwo VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardDOneOne VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardDOneOneVTwo VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardDOneSixVThree VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardDOneSixsVThree VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardDOneThree VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardDOneThreeVTwo VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardDOneTwo VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardDOneTwoVTwo VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardDOneVTwo VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardDSFiveVTwo VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardDSFour VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDSFourVTwo VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDSOne VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDSOneFiveVTwo VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDSOneFour VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDSOneFourVTwo VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDSOneOne VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDSOneOneVTwo VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDSOneThree VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDSOneThreeVTwo VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDSOneTwo VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDSOneTwoVTwo VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDSOneVTwo VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDSThree VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDSThreeVTwo VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDSTwo VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDSTwoVTwo VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDSixFourVThree VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardDSixFoursVThree VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardDThree VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardDThreeTwoVThree VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardDThreeTwosVThree VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardDThreeVTwo VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardDTwo VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardDTwoVThree VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardDTwoVTwo VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardDTwosVThree VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardEEightVThree VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardEEightsVThree VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardEFourVThree VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardEFoursVThree VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardEOneSixVThree VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardEOneSixsVThree VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardESixFourVThree VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardESixFoursVThree VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardEThreeTwoVThree VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardEThreeTwosVThree VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardETwoVThree VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardETwosVThree VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardFEight VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardFEights VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardFEightsVTwo VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardFFour VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardFFours VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardFFoursVTwo VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardFOne VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardFOneSix VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardFOneSixs VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardFOneSixsVTwo VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardFOnes VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardFSevenTwosVTwo VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardFSixFoursVTwo VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardFThreeTwosVTwo VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardFTwo VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardFTwos VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardFTwosVTwo VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardGFive VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGFour VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardGOne VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardGSFive VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGSFiveNegativeEight VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardGSFiveNegativeOneSix VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGSFour VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGSFourNegativeEight VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGSFourNegativeFour VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGSOne VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGSThree VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGSTwo VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGThree VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardGTwo VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardHEight VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardHEightm VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardHOneSix VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardHOneSixm VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardHOneSixmr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardHOneSixr VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardLEights VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardLFours VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardLOneSixs VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardLThreeTwos VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardMOneTwoEightms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardMOneTwoEights VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardMSixFourms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardMSixFours VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNCOneTwo VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNCOneTwosVThree VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNCOneTwosVTwo VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNCSix VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNCSixsVThree VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardNCSixsVTwo VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNCTwoFour VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNCTwoFourr VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNCTwoFourrsVThree VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNCTwoFourrsVTwo VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNCTwoFoursVThree VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNCTwoFoursVTwo VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNDOneTwos VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardNDSixs VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNDTwoFourrs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardNDTwoFours VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardNVOneTwo VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNVSix VirtualMachineSizeTypes = "Standard_NV6" + VirtualMachineSizeTypesStandardNVTwoFour VirtualMachineSizeTypes = "Standard_NV24" +) + +func PossibleValuesForVirtualMachineSizeTypes() []string { + return []string{ + string(VirtualMachineSizeTypesBasicAFour), + string(VirtualMachineSizeTypesBasicAOne), + string(VirtualMachineSizeTypesBasicAThree), + string(VirtualMachineSizeTypesBasicATwo), + string(VirtualMachineSizeTypesBasicAZero), + string(VirtualMachineSizeTypesStandardAEight), + string(VirtualMachineSizeTypesStandardAEightVTwo), + string(VirtualMachineSizeTypesStandardAEightmVTwo), + string(VirtualMachineSizeTypesStandardAFive), + string(VirtualMachineSizeTypesStandardAFour), + string(VirtualMachineSizeTypesStandardAFourVTwo), + string(VirtualMachineSizeTypesStandardAFourmVTwo), + string(VirtualMachineSizeTypesStandardANine), + string(VirtualMachineSizeTypesStandardAOne), + string(VirtualMachineSizeTypesStandardAOneOne), + string(VirtualMachineSizeTypesStandardAOneVTwo), + string(VirtualMachineSizeTypesStandardAOneZero), + string(VirtualMachineSizeTypesStandardASeven), + string(VirtualMachineSizeTypesStandardASix), + string(VirtualMachineSizeTypesStandardAThree), + string(VirtualMachineSizeTypesStandardATwo), + string(VirtualMachineSizeTypesStandardATwoVTwo), + string(VirtualMachineSizeTypesStandardATwomVTwo), + string(VirtualMachineSizeTypesStandardAZero), + string(VirtualMachineSizeTypesStandardBEightms), + string(VirtualMachineSizeTypesStandardBFourms), + string(VirtualMachineSizeTypesStandardBOnems), + string(VirtualMachineSizeTypesStandardBOnes), + string(VirtualMachineSizeTypesStandardBTwoms), + string(VirtualMachineSizeTypesStandardBTwos), + string(VirtualMachineSizeTypesStandardDEightVThree), + string(VirtualMachineSizeTypesStandardDEightsVThree), + string(VirtualMachineSizeTypesStandardDFiveVTwo), + string(VirtualMachineSizeTypesStandardDFour), + string(VirtualMachineSizeTypesStandardDFourVThree), + string(VirtualMachineSizeTypesStandardDFourVTwo), + string(VirtualMachineSizeTypesStandardDFoursVThree), + string(VirtualMachineSizeTypesStandardDOne), + string(VirtualMachineSizeTypesStandardDOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDOneFour), + string(VirtualMachineSizeTypesStandardDOneFourVTwo), + string(VirtualMachineSizeTypesStandardDOneOne), + string(VirtualMachineSizeTypesStandardDOneOneVTwo), + string(VirtualMachineSizeTypesStandardDOneSixVThree), + string(VirtualMachineSizeTypesStandardDOneSixsVThree), + string(VirtualMachineSizeTypesStandardDOneThree), + string(VirtualMachineSizeTypesStandardDOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDOneTwo), + string(VirtualMachineSizeTypesStandardDOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDOneVTwo), + string(VirtualMachineSizeTypesStandardDSFiveVTwo), + string(VirtualMachineSizeTypesStandardDSFour), + string(VirtualMachineSizeTypesStandardDSFourVTwo), + string(VirtualMachineSizeTypesStandardDSOne), + string(VirtualMachineSizeTypesStandardDSOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDSOneFour), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneOne), + string(VirtualMachineSizeTypesStandardDSOneOneVTwo), + string(VirtualMachineSizeTypesStandardDSOneThree), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDSOneTwo), + string(VirtualMachineSizeTypesStandardDSOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneVTwo), + string(VirtualMachineSizeTypesStandardDSThree), + string(VirtualMachineSizeTypesStandardDSThreeVTwo), + string(VirtualMachineSizeTypesStandardDSTwo), + string(VirtualMachineSizeTypesStandardDSTwoVTwo), + string(VirtualMachineSizeTypesStandardDSixFourVThree), + string(VirtualMachineSizeTypesStandardDSixFoursVThree), + string(VirtualMachineSizeTypesStandardDThree), + string(VirtualMachineSizeTypesStandardDThreeTwoVThree), + string(VirtualMachineSizeTypesStandardDThreeTwosVThree), + string(VirtualMachineSizeTypesStandardDThreeVTwo), + string(VirtualMachineSizeTypesStandardDTwo), + string(VirtualMachineSizeTypesStandardDTwoVThree), + string(VirtualMachineSizeTypesStandardDTwoVTwo), + string(VirtualMachineSizeTypesStandardDTwosVThree), + string(VirtualMachineSizeTypesStandardEEightVThree), + string(VirtualMachineSizeTypesStandardEEightsVThree), + string(VirtualMachineSizeTypesStandardEFourVThree), + string(VirtualMachineSizeTypesStandardEFoursVThree), + string(VirtualMachineSizeTypesStandardEOneSixVThree), + string(VirtualMachineSizeTypesStandardEOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree), + string(VirtualMachineSizeTypesStandardESixFourVThree), + string(VirtualMachineSizeTypesStandardESixFoursVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoVThree), + string(VirtualMachineSizeTypesStandardEThreeTwosVThree), + string(VirtualMachineSizeTypesStandardETwoVThree), + string(VirtualMachineSizeTypesStandardETwosVThree), + string(VirtualMachineSizeTypesStandardFEight), + string(VirtualMachineSizeTypesStandardFEights), + string(VirtualMachineSizeTypesStandardFEightsVTwo), + string(VirtualMachineSizeTypesStandardFFour), + string(VirtualMachineSizeTypesStandardFFours), + string(VirtualMachineSizeTypesStandardFFoursVTwo), + string(VirtualMachineSizeTypesStandardFOne), + string(VirtualMachineSizeTypesStandardFOneSix), + string(VirtualMachineSizeTypesStandardFOneSixs), + string(VirtualMachineSizeTypesStandardFOneSixsVTwo), + string(VirtualMachineSizeTypesStandardFOnes), + string(VirtualMachineSizeTypesStandardFSevenTwosVTwo), + string(VirtualMachineSizeTypesStandardFSixFoursVTwo), + string(VirtualMachineSizeTypesStandardFThreeTwosVTwo), + string(VirtualMachineSizeTypesStandardFTwo), + string(VirtualMachineSizeTypesStandardFTwos), + string(VirtualMachineSizeTypesStandardFTwosVTwo), + string(VirtualMachineSizeTypesStandardGFive), + string(VirtualMachineSizeTypesStandardGFour), + string(VirtualMachineSizeTypesStandardGOne), + string(VirtualMachineSizeTypesStandardGSFive), + string(VirtualMachineSizeTypesStandardGSFiveNegativeEight), + string(VirtualMachineSizeTypesStandardGSFiveNegativeOneSix), + string(VirtualMachineSizeTypesStandardGSFour), + string(VirtualMachineSizeTypesStandardGSFourNegativeEight), + string(VirtualMachineSizeTypesStandardGSFourNegativeFour), + string(VirtualMachineSizeTypesStandardGSOne), + string(VirtualMachineSizeTypesStandardGSThree), + string(VirtualMachineSizeTypesStandardGSTwo), + string(VirtualMachineSizeTypesStandardGThree), + string(VirtualMachineSizeTypesStandardGTwo), + string(VirtualMachineSizeTypesStandardHEight), + string(VirtualMachineSizeTypesStandardHEightm), + string(VirtualMachineSizeTypesStandardHOneSix), + string(VirtualMachineSizeTypesStandardHOneSixm), + string(VirtualMachineSizeTypesStandardHOneSixmr), + string(VirtualMachineSizeTypesStandardHOneSixr), + string(VirtualMachineSizeTypesStandardLEights), + string(VirtualMachineSizeTypesStandardLFours), + string(VirtualMachineSizeTypesStandardLOneSixs), + string(VirtualMachineSizeTypesStandardLThreeTwos), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMOneTwoEightms), + string(VirtualMachineSizeTypesStandardMOneTwoEights), + string(VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms), + string(VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMSixFourms), + string(VirtualMachineSizeTypesStandardMSixFours), + string(VirtualMachineSizeTypesStandardNCOneTwo), + string(VirtualMachineSizeTypesStandardNCOneTwosVThree), + string(VirtualMachineSizeTypesStandardNCOneTwosVTwo), + string(VirtualMachineSizeTypesStandardNCSix), + string(VirtualMachineSizeTypesStandardNCSixsVThree), + string(VirtualMachineSizeTypesStandardNCSixsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFour), + string(VirtualMachineSizeTypesStandardNCTwoFourr), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVThree), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFoursVThree), + string(VirtualMachineSizeTypesStandardNCTwoFoursVTwo), + string(VirtualMachineSizeTypesStandardNDOneTwos), + string(VirtualMachineSizeTypesStandardNDSixs), + string(VirtualMachineSizeTypesStandardNDTwoFourrs), + string(VirtualMachineSizeTypesStandardNDTwoFours), + string(VirtualMachineSizeTypesStandardNVOneTwo), + string(VirtualMachineSizeTypesStandardNVSix), + string(VirtualMachineSizeTypesStandardNVTwoFour), + } +} + +func (s *VirtualMachineSizeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineSizeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineSizeTypes(input string) (*VirtualMachineSizeTypes, error) { + vals := map[string]VirtualMachineSizeTypes{ + "basic_a4": VirtualMachineSizeTypesBasicAFour, + "basic_a1": VirtualMachineSizeTypesBasicAOne, + "basic_a3": VirtualMachineSizeTypesBasicAThree, + "basic_a2": VirtualMachineSizeTypesBasicATwo, + "basic_a0": VirtualMachineSizeTypesBasicAZero, + "standard_a8": VirtualMachineSizeTypesStandardAEight, + "standard_a8_v2": VirtualMachineSizeTypesStandardAEightVTwo, + "standard_a8m_v2": VirtualMachineSizeTypesStandardAEightmVTwo, + "standard_a5": VirtualMachineSizeTypesStandardAFive, + "standard_a4": VirtualMachineSizeTypesStandardAFour, + "standard_a4_v2": VirtualMachineSizeTypesStandardAFourVTwo, + "standard_a4m_v2": VirtualMachineSizeTypesStandardAFourmVTwo, + "standard_a9": VirtualMachineSizeTypesStandardANine, + "standard_a1": VirtualMachineSizeTypesStandardAOne, + "standard_a11": VirtualMachineSizeTypesStandardAOneOne, + "standard_a1_v2": VirtualMachineSizeTypesStandardAOneVTwo, + "standard_a10": VirtualMachineSizeTypesStandardAOneZero, + "standard_a7": VirtualMachineSizeTypesStandardASeven, + "standard_a6": VirtualMachineSizeTypesStandardASix, + "standard_a3": VirtualMachineSizeTypesStandardAThree, + "standard_a2": VirtualMachineSizeTypesStandardATwo, + "standard_a2_v2": VirtualMachineSizeTypesStandardATwoVTwo, + "standard_a2m_v2": VirtualMachineSizeTypesStandardATwomVTwo, + "standard_a0": VirtualMachineSizeTypesStandardAZero, + "standard_b8ms": VirtualMachineSizeTypesStandardBEightms, + "standard_b4ms": VirtualMachineSizeTypesStandardBFourms, + "standard_b1ms": VirtualMachineSizeTypesStandardBOnems, + "standard_b1s": VirtualMachineSizeTypesStandardBOnes, + "standard_b2ms": VirtualMachineSizeTypesStandardBTwoms, + "standard_b2s": VirtualMachineSizeTypesStandardBTwos, + "standard_d8_v3": VirtualMachineSizeTypesStandardDEightVThree, + "standard_d8s_v3": VirtualMachineSizeTypesStandardDEightsVThree, + "standard_d5_v2": VirtualMachineSizeTypesStandardDFiveVTwo, + "standard_d4": VirtualMachineSizeTypesStandardDFour, + "standard_d4_v3": VirtualMachineSizeTypesStandardDFourVThree, + "standard_d4_v2": VirtualMachineSizeTypesStandardDFourVTwo, + "standard_d4s_v3": VirtualMachineSizeTypesStandardDFoursVThree, + "standard_d1": VirtualMachineSizeTypesStandardDOne, + "standard_d15_v2": VirtualMachineSizeTypesStandardDOneFiveVTwo, + "standard_d14": VirtualMachineSizeTypesStandardDOneFour, + "standard_d14_v2": VirtualMachineSizeTypesStandardDOneFourVTwo, + "standard_d11": VirtualMachineSizeTypesStandardDOneOne, + "standard_d11_v2": VirtualMachineSizeTypesStandardDOneOneVTwo, + "standard_d16_v3": VirtualMachineSizeTypesStandardDOneSixVThree, + "standard_d16s_v3": VirtualMachineSizeTypesStandardDOneSixsVThree, + "standard_d13": VirtualMachineSizeTypesStandardDOneThree, + "standard_d13_v2": VirtualMachineSizeTypesStandardDOneThreeVTwo, + "standard_d12": VirtualMachineSizeTypesStandardDOneTwo, + "standard_d12_v2": VirtualMachineSizeTypesStandardDOneTwoVTwo, + "standard_d1_v2": VirtualMachineSizeTypesStandardDOneVTwo, + "standard_ds5_v2": VirtualMachineSizeTypesStandardDSFiveVTwo, + "standard_ds4": VirtualMachineSizeTypesStandardDSFour, + "standard_ds4_v2": VirtualMachineSizeTypesStandardDSFourVTwo, + "standard_ds1": VirtualMachineSizeTypesStandardDSOne, + "standard_ds15_v2": VirtualMachineSizeTypesStandardDSOneFiveVTwo, + "standard_ds14": VirtualMachineSizeTypesStandardDSOneFour, + "standard_ds14-8_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo, + "standard_ds14-4_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo, + "standard_ds14_v2": VirtualMachineSizeTypesStandardDSOneFourVTwo, + "standard_ds11": VirtualMachineSizeTypesStandardDSOneOne, + "standard_ds11_v2": VirtualMachineSizeTypesStandardDSOneOneVTwo, + "standard_ds13": VirtualMachineSizeTypesStandardDSOneThree, + "standard_ds13-4_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo, + "standard_ds13-2_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo, + "standard_ds13_v2": VirtualMachineSizeTypesStandardDSOneThreeVTwo, + "standard_ds12": VirtualMachineSizeTypesStandardDSOneTwo, + "standard_ds12_v2": VirtualMachineSizeTypesStandardDSOneTwoVTwo, + "standard_ds1_v2": VirtualMachineSizeTypesStandardDSOneVTwo, + "standard_ds3": VirtualMachineSizeTypesStandardDSThree, + "standard_ds3_v2": VirtualMachineSizeTypesStandardDSThreeVTwo, + "standard_ds2": VirtualMachineSizeTypesStandardDSTwo, + "standard_ds2_v2": VirtualMachineSizeTypesStandardDSTwoVTwo, + "standard_d64_v3": VirtualMachineSizeTypesStandardDSixFourVThree, + "standard_d64s_v3": VirtualMachineSizeTypesStandardDSixFoursVThree, + "standard_d3": VirtualMachineSizeTypesStandardDThree, + "standard_d32_v3": VirtualMachineSizeTypesStandardDThreeTwoVThree, + "standard_d32s_v3": VirtualMachineSizeTypesStandardDThreeTwosVThree, + "standard_d3_v2": VirtualMachineSizeTypesStandardDThreeVTwo, + "standard_d2": VirtualMachineSizeTypesStandardDTwo, + "standard_d2_v3": VirtualMachineSizeTypesStandardDTwoVThree, + "standard_d2_v2": VirtualMachineSizeTypesStandardDTwoVTwo, + "standard_d2s_v3": VirtualMachineSizeTypesStandardDTwosVThree, + "standard_e8_v3": VirtualMachineSizeTypesStandardEEightVThree, + "standard_e8s_v3": VirtualMachineSizeTypesStandardEEightsVThree, + "standard_e4_v3": VirtualMachineSizeTypesStandardEFourVThree, + "standard_e4s_v3": VirtualMachineSizeTypesStandardEFoursVThree, + "standard_e16_v3": VirtualMachineSizeTypesStandardEOneSixVThree, + "standard_e16s_v3": VirtualMachineSizeTypesStandardEOneSixsVThree, + "standard_e64-16s_v3": VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree, + "standard_e64-32s_v3": VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree, + "standard_e64_v3": VirtualMachineSizeTypesStandardESixFourVThree, + "standard_e64s_v3": VirtualMachineSizeTypesStandardESixFoursVThree, + "standard_e32-8s_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree, + "standard_e32-16_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree, + "standard_e32_v3": VirtualMachineSizeTypesStandardEThreeTwoVThree, + "standard_e32s_v3": VirtualMachineSizeTypesStandardEThreeTwosVThree, + "standard_e2_v3": VirtualMachineSizeTypesStandardETwoVThree, + "standard_e2s_v3": VirtualMachineSizeTypesStandardETwosVThree, + "standard_f8": VirtualMachineSizeTypesStandardFEight, + "standard_f8s": VirtualMachineSizeTypesStandardFEights, + "standard_f8s_v2": VirtualMachineSizeTypesStandardFEightsVTwo, + "standard_f4": VirtualMachineSizeTypesStandardFFour, + "standard_f4s": VirtualMachineSizeTypesStandardFFours, + "standard_f4s_v2": VirtualMachineSizeTypesStandardFFoursVTwo, + "standard_f1": VirtualMachineSizeTypesStandardFOne, + "standard_f16": VirtualMachineSizeTypesStandardFOneSix, + "standard_f16s": VirtualMachineSizeTypesStandardFOneSixs, + "standard_f16s_v2": VirtualMachineSizeTypesStandardFOneSixsVTwo, + "standard_f1s": VirtualMachineSizeTypesStandardFOnes, + "standard_f72s_v2": VirtualMachineSizeTypesStandardFSevenTwosVTwo, + "standard_f64s_v2": VirtualMachineSizeTypesStandardFSixFoursVTwo, + "standard_f32s_v2": VirtualMachineSizeTypesStandardFThreeTwosVTwo, + "standard_f2": VirtualMachineSizeTypesStandardFTwo, + "standard_f2s": VirtualMachineSizeTypesStandardFTwos, + "standard_f2s_v2": VirtualMachineSizeTypesStandardFTwosVTwo, + "standard_g5": VirtualMachineSizeTypesStandardGFive, + "standard_g4": VirtualMachineSizeTypesStandardGFour, + "standard_g1": VirtualMachineSizeTypesStandardGOne, + "standard_gs5": VirtualMachineSizeTypesStandardGSFive, + "standard_gs5-8": VirtualMachineSizeTypesStandardGSFiveNegativeEight, + "standard_gs5-16": VirtualMachineSizeTypesStandardGSFiveNegativeOneSix, + "standard_gs4": VirtualMachineSizeTypesStandardGSFour, + "standard_gs4-8": VirtualMachineSizeTypesStandardGSFourNegativeEight, + "standard_gs4-4": VirtualMachineSizeTypesStandardGSFourNegativeFour, + "standard_gs1": VirtualMachineSizeTypesStandardGSOne, + "standard_gs3": VirtualMachineSizeTypesStandardGSThree, + "standard_gs2": VirtualMachineSizeTypesStandardGSTwo, + "standard_g3": VirtualMachineSizeTypesStandardGThree, + "standard_g2": VirtualMachineSizeTypesStandardGTwo, + "standard_h8": VirtualMachineSizeTypesStandardHEight, + "standard_h8m": VirtualMachineSizeTypesStandardHEightm, + "standard_h16": VirtualMachineSizeTypesStandardHOneSix, + "standard_h16m": VirtualMachineSizeTypesStandardHOneSixm, + "standard_h16mr": VirtualMachineSizeTypesStandardHOneSixmr, + "standard_h16r": VirtualMachineSizeTypesStandardHOneSixr, + "standard_l8s": VirtualMachineSizeTypesStandardLEights, + "standard_l4s": VirtualMachineSizeTypesStandardLFours, + "standard_l16s": VirtualMachineSizeTypesStandardLOneSixs, + "standard_l32s": VirtualMachineSizeTypesStandardLThreeTwos, + "standard_m128-64ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms, + "standard_m128-32ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms, + "standard_m128ms": VirtualMachineSizeTypesStandardMOneTwoEightms, + "standard_m128s": VirtualMachineSizeTypesStandardMOneTwoEights, + "standard_m64-16ms": VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms, + "standard_m64-32ms": VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms, + "standard_m64ms": VirtualMachineSizeTypesStandardMSixFourms, + "standard_m64s": VirtualMachineSizeTypesStandardMSixFours, + "standard_nc12": VirtualMachineSizeTypesStandardNCOneTwo, + "standard_nc12s_v3": VirtualMachineSizeTypesStandardNCOneTwosVThree, + "standard_nc12s_v2": VirtualMachineSizeTypesStandardNCOneTwosVTwo, + "standard_nc6": VirtualMachineSizeTypesStandardNCSix, + "standard_nc6s_v3": VirtualMachineSizeTypesStandardNCSixsVThree, + "standard_nc6s_v2": VirtualMachineSizeTypesStandardNCSixsVTwo, + "standard_nc24": VirtualMachineSizeTypesStandardNCTwoFour, + "standard_nc24r": VirtualMachineSizeTypesStandardNCTwoFourr, + "standard_nc24rs_v3": VirtualMachineSizeTypesStandardNCTwoFourrsVThree, + "standard_nc24rs_v2": VirtualMachineSizeTypesStandardNCTwoFourrsVTwo, + "standard_nc24s_v3": VirtualMachineSizeTypesStandardNCTwoFoursVThree, + "standard_nc24s_v2": VirtualMachineSizeTypesStandardNCTwoFoursVTwo, + "standard_nd12s": VirtualMachineSizeTypesStandardNDOneTwos, + "standard_nd6s": VirtualMachineSizeTypesStandardNDSixs, + "standard_nd24rs": VirtualMachineSizeTypesStandardNDTwoFourrs, + "standard_nd24s": VirtualMachineSizeTypesStandardNDTwoFours, + "standard_nv12": VirtualMachineSizeTypesStandardNVOneTwo, + "standard_nv6": VirtualMachineSizeTypesStandardNVSix, + "standard_nv24": VirtualMachineSizeTypesStandardNVTwoFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineSizeTypes(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} + +type ZonalPlatformFaultDomainAlignMode string + +const ( + ZonalPlatformFaultDomainAlignModeAligned ZonalPlatformFaultDomainAlignMode = "Aligned" + ZonalPlatformFaultDomainAlignModeUnaligned ZonalPlatformFaultDomainAlignMode = "Unaligned" +) + +func PossibleValuesForZonalPlatformFaultDomainAlignMode() []string { + return []string{ + string(ZonalPlatformFaultDomainAlignModeAligned), + string(ZonalPlatformFaultDomainAlignModeUnaligned), + } +} + +func (s *ZonalPlatformFaultDomainAlignMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseZonalPlatformFaultDomainAlignMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseZonalPlatformFaultDomainAlignMode(input string) (*ZonalPlatformFaultDomainAlignMode, error) { + vals := map[string]ZonalPlatformFaultDomainAlignMode{ + "aligned": ZonalPlatformFaultDomainAlignModeAligned, + "unaligned": ZonalPlatformFaultDomainAlignModeUnaligned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZonalPlatformFaultDomainAlignMode(input) + return &out, nil +} + +type ZonePlacementPolicyType string + +const ( + ZonePlacementPolicyTypeAny ZonePlacementPolicyType = "Any" + ZonePlacementPolicyTypeAuto ZonePlacementPolicyType = "Auto" +) + +func PossibleValuesForZonePlacementPolicyType() []string { + return []string{ + string(ZonePlacementPolicyTypeAny), + string(ZonePlacementPolicyTypeAuto), + } +} + +func (s *ZonePlacementPolicyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseZonePlacementPolicyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseZonePlacementPolicyType(input string) (*ZonePlacementPolicyType, error) { + vals := map[string]ZonePlacementPolicyType{ + "any": ZonePlacementPolicyTypeAny, + "auto": ZonePlacementPolicyTypeAuto, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZonePlacementPolicyType(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_edgezone.go b/resource-manager/compute/2025-04-01/computerps/id_edgezone.go new file mode 100644 index 00000000000..d8679ad37ff --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_edgezone.go @@ -0,0 +1,130 @@ +package computerps + +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(&EdgeZoneId{}) +} + +var _ resourceids.ResourceId = &EdgeZoneId{} + +// EdgeZoneId is a struct representing the Resource ID for a Edge Zone +type EdgeZoneId struct { + SubscriptionId string + LocationName string + EdgeZoneName string +} + +// NewEdgeZoneID returns a new EdgeZoneId struct +func NewEdgeZoneID(subscriptionId string, locationName string, edgeZoneName string) EdgeZoneId { + return EdgeZoneId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + } +} + +// ParseEdgeZoneID parses 'input' into a EdgeZoneId +func ParseEdgeZoneID(input string) (*EdgeZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&EdgeZoneId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EdgeZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseEdgeZoneIDInsensitively parses 'input' case-insensitively into a EdgeZoneId +// note: this method should only be used for API response data and not user input +func ParseEdgeZoneIDInsensitively(input string) (*EdgeZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&EdgeZoneId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EdgeZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EdgeZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + return nil +} + +// ValidateEdgeZoneID checks that 'input' can be parsed as a Edge Zone ID +func ValidateEdgeZoneID(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 := ParseEdgeZoneID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Edge Zone ID +func (id EdgeZoneId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Edge Zone ID +func (id EdgeZoneId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + } +} + +// String returns a human-readable description of this Edge Zone ID +func (id EdgeZoneId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + } + return fmt.Sprintf("Edge Zone (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_edgezone_test.go b/resource-manager/compute/2025-04-01/computerps/id_edgezone_test.go new file mode 100644 index 00000000000..688ea570c13 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_edgezone_test.go @@ -0,0 +1,282 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &EdgeZoneId{} + +func TestNewEdgeZoneID(t *testing.T) { + id := NewEdgeZoneID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } +} + +func TestFormatEdgeZoneID(t *testing.T) { + actual := NewEdgeZoneID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseEdgeZoneID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *EdgeZoneId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Expected: &EdgeZoneId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseEdgeZoneID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + } +} + +func TestParseEdgeZoneIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *EdgeZoneId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Expected: &EdgeZoneId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Expected: &EdgeZoneId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseEdgeZoneIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + } +} + +func TestSegmentsForEdgeZoneId(t *testing.T) { + segments := EdgeZoneId{}.Segments() + if len(segments) == 0 { + t.Fatalf("EdgeZoneId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_edgezonepublisher.go b/resource-manager/compute/2025-04-01/computerps/id_edgezonepublisher.go new file mode 100644 index 00000000000..5a713677265 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_edgezonepublisher.go @@ -0,0 +1,139 @@ +package computerps + +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(&EdgeZonePublisherId{}) +} + +var _ resourceids.ResourceId = &EdgeZonePublisherId{} + +// EdgeZonePublisherId is a struct representing the Resource ID for a Edge Zone Publisher +type EdgeZonePublisherId struct { + SubscriptionId string + LocationName string + EdgeZoneName string + PublisherName string +} + +// NewEdgeZonePublisherID returns a new EdgeZonePublisherId struct +func NewEdgeZonePublisherID(subscriptionId string, locationName string, edgeZoneName string, publisherName string) EdgeZonePublisherId { + return EdgeZonePublisherId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + PublisherName: publisherName, + } +} + +// ParseEdgeZonePublisherID parses 'input' into a EdgeZonePublisherId +func ParseEdgeZonePublisherID(input string) (*EdgeZonePublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&EdgeZonePublisherId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EdgeZonePublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseEdgeZonePublisherIDInsensitively parses 'input' case-insensitively into a EdgeZonePublisherId +// note: this method should only be used for API response data and not user input +func ParseEdgeZonePublisherIDInsensitively(input string) (*EdgeZonePublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&EdgeZonePublisherId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EdgeZonePublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EdgeZonePublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + return nil +} + +// ValidateEdgeZonePublisherID checks that 'input' can be parsed as a Edge Zone Publisher ID +func ValidateEdgeZonePublisherID(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 := ParseEdgeZonePublisherID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Edge Zone Publisher ID +func (id EdgeZonePublisherId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s/publishers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName, id.PublisherName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Edge Zone Publisher ID +func (id EdgeZonePublisherId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + } +} + +// String returns a human-readable description of this Edge Zone Publisher ID +func (id EdgeZonePublisherId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + } + return fmt.Sprintf("Edge Zone Publisher (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_edgezonepublisher_test.go b/resource-manager/compute/2025-04-01/computerps/id_edgezonepublisher_test.go new file mode 100644 index 00000000000..1d28cd2b2d9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_edgezonepublisher_test.go @@ -0,0 +1,327 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &EdgeZonePublisherId{} + +func TestNewEdgeZonePublisherID(t *testing.T) { + id := NewEdgeZonePublisherID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } +} + +func TestFormatEdgeZonePublisherID(t *testing.T) { + actual := NewEdgeZonePublisherID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseEdgeZonePublisherID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *EdgeZonePublisherId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Expected: &EdgeZonePublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseEdgeZonePublisherID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestParseEdgeZonePublisherIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *EdgeZonePublisherId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Expected: &EdgeZonePublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe", + Expected: &EdgeZonePublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + PublisherName: "pUbLiShErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseEdgeZonePublisherIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestSegmentsForEdgeZonePublisherId(t *testing.T) { + segments := EdgeZonePublisherId{}.Segments() + if len(segments) == 0 { + t.Fatalf("EdgeZonePublisherId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_location.go b/resource-manager/compute/2025-04-01/computerps/id_location.go new file mode 100644 index 00000000000..baf134f8144 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_location.go @@ -0,0 +1,121 @@ +package computerps + +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(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_location_test.go b/resource-manager/compute/2025-04-01/computerps/id_location_test.go new file mode 100644 index 00000000000..bf98a878305 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_location_test.go @@ -0,0 +1,237 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_offer.go b/resource-manager/compute/2025-04-01/computerps/id_offer.go new file mode 100644 index 00000000000..5c5fbbf174d --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_offer.go @@ -0,0 +1,141 @@ +package computerps + +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(&OfferId{}) +} + +var _ resourceids.ResourceId = &OfferId{} + +// OfferId is a struct representing the Resource ID for a Offer +type OfferId struct { + SubscriptionId string + LocationName string + PublisherName string + OfferName string +} + +// NewOfferID returns a new OfferId struct +func NewOfferID(subscriptionId string, locationName string, publisherName string, offerName string) OfferId { + return OfferId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + OfferName: offerName, + } +} + +// ParseOfferID parses 'input' into a OfferId +func ParseOfferID(input string) (*OfferId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseOfferIDInsensitively parses 'input' case-insensitively into a OfferId +// note: this method should only be used for API response data and not user input +func ParseOfferIDInsensitively(input string) (*OfferId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + return nil +} + +// ValidateOfferID checks that 'input' can be parsed as a Offer ID +func ValidateOfferID(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 := ParseOfferID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Offer ID +func (id OfferId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmImage/offers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.OfferName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Offer ID +func (id OfferId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + } +} + +// String returns a human-readable description of this Offer ID +func (id OfferId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + } + return fmt.Sprintf("Offer (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_offer_test.go b/resource-manager/compute/2025-04-01/computerps/id_offer_test.go new file mode 100644 index 00000000000..3f6525e77e9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_offer_test.go @@ -0,0 +1,357 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &OfferId{} + +func TestNewOfferID(t *testing.T) { + id := NewOfferID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } +} + +func TestFormatOfferID(t *testing.T) { + actual := NewOfferID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseOfferID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Expected: &OfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + } +} + +func TestParseOfferIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Expected: &OfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Expected: &OfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + } +} + +func TestSegmentsForOfferId(t *testing.T) { + segments := OfferId{}.Segments() + if len(segments) == 0 { + t.Fatalf("OfferId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_offersku.go b/resource-manager/compute/2025-04-01/computerps/id_offersku.go new file mode 100644 index 00000000000..fc0e933a17d --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_offersku.go @@ -0,0 +1,159 @@ +package computerps + +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(&OfferSkuId{}) +} + +var _ resourceids.ResourceId = &OfferSkuId{} + +// OfferSkuId is a struct representing the Resource ID for a Offer Sku +type OfferSkuId struct { + SubscriptionId string + LocationName string + EdgeZoneName string + PublisherName string + OfferName string + SkuName string +} + +// NewOfferSkuID returns a new OfferSkuId struct +func NewOfferSkuID(subscriptionId string, locationName string, edgeZoneName string, publisherName string, offerName string, skuName string) OfferSkuId { + return OfferSkuId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + PublisherName: publisherName, + OfferName: offerName, + SkuName: skuName, + } +} + +// ParseOfferSkuID parses 'input' into a OfferSkuId +func ParseOfferSkuID(input string) (*OfferSkuId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferSkuId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferSkuId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseOfferSkuIDInsensitively parses 'input' case-insensitively into a OfferSkuId +// note: this method should only be used for API response data and not user input +func ParseOfferSkuIDInsensitively(input string) (*OfferSkuId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferSkuId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferSkuId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferSkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) + } + + return nil +} + +// ValidateOfferSkuID checks that 'input' can be parsed as a Offer Sku ID +func ValidateOfferSkuID(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 := ParseOfferSkuID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Offer Sku ID +func (id OfferSkuId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s/publishers/%s/artifactTypes/vmImage/offers/%s/skus/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName, id.PublisherName, id.OfferName, id.SkuName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Offer Sku ID +func (id OfferSkuId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + resourceids.StaticSegment("staticSkus", "skus", "skus"), + resourceids.UserSpecifiedSegment("skuName", "skuName"), + } +} + +// String returns a human-readable description of this Offer Sku ID +func (id OfferSkuId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + fmt.Sprintf("Sku Name: %q", id.SkuName), + } + return fmt.Sprintf("Offer Sku (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_offersku_test.go b/resource-manager/compute/2025-04-01/computerps/id_offersku_test.go new file mode 100644 index 00000000000..3649d447f54 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_offersku_test.go @@ -0,0 +1,447 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &OfferSkuId{} + +func TestNewOfferSkuID(t *testing.T) { + id := NewOfferSkuID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } + + if id.SkuName != "skuName" { + t.Fatalf("Expected %q but got %q for Segment 'SkuName'", id.SkuName, "skuName") + } +} + +func TestFormatOfferSkuID(t *testing.T) { + actual := NewOfferSkuID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseOfferSkuID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferSkuId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Expected: &OfferSkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferSkuID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + } +} + +func TestParseOfferSkuIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferSkuId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Expected: &OfferSkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe", + Expected: &OfferSkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + SkuName: "sKuNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferSkuIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + } +} + +func TestSegmentsForOfferSkuId(t *testing.T) { + segments := OfferSkuId{}.Segments() + if len(segments) == 0 { + t.Fatalf("OfferSkuId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_offerskuversion.go b/resource-manager/compute/2025-04-01/computerps/id_offerskuversion.go new file mode 100644 index 00000000000..dab09fed8f5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_offerskuversion.go @@ -0,0 +1,168 @@ +package computerps + +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(&OfferSkuVersionId{}) +} + +var _ resourceids.ResourceId = &OfferSkuVersionId{} + +// OfferSkuVersionId is a struct representing the Resource ID for a Offer Sku Version +type OfferSkuVersionId struct { + SubscriptionId string + LocationName string + EdgeZoneName string + PublisherName string + OfferName string + SkuName string + VersionName string +} + +// NewOfferSkuVersionID returns a new OfferSkuVersionId struct +func NewOfferSkuVersionID(subscriptionId string, locationName string, edgeZoneName string, publisherName string, offerName string, skuName string, versionName string) OfferSkuVersionId { + return OfferSkuVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + PublisherName: publisherName, + OfferName: offerName, + SkuName: skuName, + VersionName: versionName, + } +} + +// ParseOfferSkuVersionID parses 'input' into a OfferSkuVersionId +func ParseOfferSkuVersionID(input string) (*OfferSkuVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferSkuVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferSkuVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseOfferSkuVersionIDInsensitively parses 'input' case-insensitively into a OfferSkuVersionId +// note: this method should only be used for API response data and not user input +func ParseOfferSkuVersionIDInsensitively(input string) (*OfferSkuVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferSkuVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferSkuVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferSkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) + } + + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) + } + + return nil +} + +// ValidateOfferSkuVersionID checks that 'input' can be parsed as a Offer Sku Version ID +func ValidateOfferSkuVersionID(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 := ParseOfferSkuVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Offer Sku Version ID +func (id OfferSkuVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s/publishers/%s/artifactTypes/vmImage/offers/%s/skus/%s/versions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName, id.PublisherName, id.OfferName, id.SkuName, id.VersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Offer Sku Version ID +func (id OfferSkuVersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + resourceids.StaticSegment("staticSkus", "skus", "skus"), + resourceids.UserSpecifiedSegment("skuName", "skuName"), + resourceids.StaticSegment("staticVersions", "versions", "versions"), + resourceids.UserSpecifiedSegment("versionName", "versionName"), + } +} + +// String returns a human-readable description of this Offer Sku Version ID +func (id OfferSkuVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + fmt.Sprintf("Sku Name: %q", id.SkuName), + fmt.Sprintf("Version Name: %q", id.VersionName), + } + return fmt.Sprintf("Offer Sku Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_offerskuversion_test.go b/resource-manager/compute/2025-04-01/computerps/id_offerskuversion_test.go new file mode 100644 index 00000000000..60efc314bb8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_offerskuversion_test.go @@ -0,0 +1,492 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &OfferSkuVersionId{} + +func TestNewOfferSkuVersionID(t *testing.T) { + id := NewOfferSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName", "versionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } + + if id.SkuName != "skuName" { + t.Fatalf("Expected %q but got %q for Segment 'SkuName'", id.SkuName, "skuName") + } + + if id.VersionName != "versionName" { + t.Fatalf("Expected %q but got %q for Segment 'VersionName'", id.VersionName, "versionName") + } +} + +func TestFormatOfferSkuVersionID(t *testing.T) { + actual := NewOfferSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName", "versionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseOfferSkuVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferSkuVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName", + Expected: &OfferSkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferSkuVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestParseOfferSkuVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferSkuVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName", + Expected: &OfferSkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS/vErSiOnNaMe", + Expected: &OfferSkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + SkuName: "sKuNaMe", + VersionName: "vErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS/vErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferSkuVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestSegmentsForOfferSkuVersionId(t *testing.T) { + segments := OfferSkuVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("OfferSkuVersionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_publisher.go b/resource-manager/compute/2025-04-01/computerps/id_publisher.go new file mode 100644 index 00000000000..a1986d8d059 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_publisher.go @@ -0,0 +1,130 @@ +package computerps + +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(&PublisherId{}) +} + +var _ resourceids.ResourceId = &PublisherId{} + +// PublisherId is a struct representing the Resource ID for a Publisher +type PublisherId struct { + SubscriptionId string + LocationName string + PublisherName string +} + +// NewPublisherID returns a new PublisherId struct +func NewPublisherID(subscriptionId string, locationName string, publisherName string) PublisherId { + return PublisherId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + } +} + +// ParsePublisherID parses 'input' into a PublisherId +func ParsePublisherID(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&PublisherId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePublisherIDInsensitively parses 'input' case-insensitively into a PublisherId +// note: this method should only be used for API response data and not user input +func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&PublisherId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + return nil +} + +// ValidatePublisherID checks that 'input' can be parsed as a Publisher ID +func ValidatePublisherID(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 := ParsePublisherID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Publisher ID +func (id PublisherId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Publisher ID +func (id PublisherId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + } +} + +// String returns a human-readable description of this Publisher ID +func (id PublisherId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + } + return fmt.Sprintf("Publisher (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_publisher_test.go b/resource-manager/compute/2025-04-01/computerps/id_publisher_test.go new file mode 100644 index 00000000000..de65f310e83 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_publisher_test.go @@ -0,0 +1,282 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &PublisherId{} + +func TestNewPublisherID(t *testing.T) { + id := NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } +} + +func TestFormatPublisherID(t *testing.T) { + actual := NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePublisherID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PublisherId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Expected: &PublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePublisherID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestParsePublisherIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PublisherId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Expected: &PublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Expected: &PublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePublisherIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestSegmentsForPublisherId(t *testing.T) { + segments := PublisherId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PublisherId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_runcommand.go b/resource-manager/compute/2025-04-01/computerps/id_runcommand.go new file mode 100644 index 00000000000..fd2e673afc7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_runcommand.go @@ -0,0 +1,130 @@ +package computerps + +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(&RunCommandId{}) +} + +var _ resourceids.ResourceId = &RunCommandId{} + +// RunCommandId is a struct representing the Resource ID for a Run Command +type RunCommandId struct { + SubscriptionId string + LocationName string + CommandId string +} + +// NewRunCommandID returns a new RunCommandId struct +func NewRunCommandID(subscriptionId string, locationName string, commandId string) RunCommandId { + return RunCommandId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + CommandId: commandId, + } +} + +// ParseRunCommandID parses 'input' into a RunCommandId +func ParseRunCommandID(input string) (*RunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&RunCommandId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRunCommandIDInsensitively parses 'input' case-insensitively into a RunCommandId +// note: this method should only be used for API response data and not user input +func ParseRunCommandIDInsensitively(input string) (*RunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&RunCommandId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunCommandId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.CommandId, ok = input.Parsed["commandId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commandId", input) + } + + return nil +} + +// ValidateRunCommandID checks that 'input' can be parsed as a Run Command ID +func ValidateRunCommandID(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 := ParseRunCommandID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Run Command ID +func (id RunCommandId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/runCommands/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.CommandId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Run Command ID +func (id RunCommandId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticRunCommands", "runCommands", "runCommands"), + resourceids.UserSpecifiedSegment("commandId", "commandId"), + } +} + +// String returns a human-readable description of this Run Command ID +func (id RunCommandId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Command: %q", id.CommandId), + } + return fmt.Sprintf("Run Command (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_runcommand_test.go b/resource-manager/compute/2025-04-01/computerps/id_runcommand_test.go new file mode 100644 index 00000000000..31175ee832c --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_runcommand_test.go @@ -0,0 +1,282 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &RunCommandId{} + +func TestNewRunCommandID(t *testing.T) { + id := NewRunCommandID("12345678-1234-9876-4563-123456789012", "locationName", "commandId") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.CommandId != "commandId" { + t.Fatalf("Expected %q but got %q for Segment 'CommandId'", id.CommandId, "commandId") + } +} + +func TestFormatRunCommandID(t *testing.T) { + actual := NewRunCommandID("12345678-1234-9876-4563-123456789012", "locationName", "commandId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRunCommandID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RunCommandId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId", + Expected: &RunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + CommandId: "commandId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRunCommandID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.CommandId != v.Expected.CommandId { + t.Fatalf("Expected %q but got %q for CommandId", v.Expected.CommandId, actual.CommandId) + } + + } +} + +func TestParseRunCommandIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RunCommandId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/rUnCoMmAnDs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId", + Expected: &RunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + CommandId: "commandId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/rUnCoMmAnDs/cOmMaNdId", + Expected: &RunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + CommandId: "cOmMaNdId", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/rUnCoMmAnDs/cOmMaNdId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRunCommandIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.CommandId != v.Expected.CommandId { + t.Fatalf("Expected %q but got %q for CommandId", v.Expected.CommandId, actual.CommandId) + } + + } +} + +func TestSegmentsForRunCommandId(t *testing.T) { + segments := RunCommandId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RunCommandId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_sku.go b/resource-manager/compute/2025-04-01/computerps/id_sku.go new file mode 100644 index 00000000000..2220553f278 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_sku.go @@ -0,0 +1,150 @@ +package computerps + +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(&SkuId{}) +} + +var _ resourceids.ResourceId = &SkuId{} + +// SkuId is a struct representing the Resource ID for a Sku +type SkuId struct { + SubscriptionId string + LocationName string + PublisherName string + OfferName string + SkuName string +} + +// NewSkuID returns a new SkuId struct +func NewSkuID(subscriptionId string, locationName string, publisherName string, offerName string, skuName string) SkuId { + return SkuId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + OfferName: offerName, + SkuName: skuName, + } +} + +// ParseSkuID parses 'input' into a SkuId +func ParseSkuID(input string) (*SkuId, error) { + parser := resourceids.NewParserFromResourceIdType(&SkuId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SkuId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSkuIDInsensitively parses 'input' case-insensitively into a SkuId +// note: this method should only be used for API response data and not user input +func ParseSkuIDInsensitively(input string) (*SkuId, error) { + parser := resourceids.NewParserFromResourceIdType(&SkuId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SkuId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) + } + + return nil +} + +// ValidateSkuID checks that 'input' can be parsed as a Sku ID +func ValidateSkuID(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 := ParseSkuID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sku ID +func (id SkuId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmImage/offers/%s/skus/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.OfferName, id.SkuName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sku ID +func (id SkuId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + resourceids.StaticSegment("staticSkus", "skus", "skus"), + resourceids.UserSpecifiedSegment("skuName", "skuName"), + } +} + +// String returns a human-readable description of this Sku ID +func (id SkuId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + fmt.Sprintf("Sku Name: %q", id.SkuName), + } + return fmt.Sprintf("Sku (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_sku_test.go b/resource-manager/compute/2025-04-01/computerps/id_sku_test.go new file mode 100644 index 00000000000..1a9502b72d4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_sku_test.go @@ -0,0 +1,402 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &SkuId{} + +func TestNewSkuID(t *testing.T) { + id := NewSkuID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } + + if id.SkuName != "skuName" { + t.Fatalf("Expected %q but got %q for Segment 'SkuName'", id.SkuName, "skuName") + } +} + +func TestFormatSkuID(t *testing.T) { + actual := NewSkuID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseSkuID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SkuId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Expected: &SkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSkuID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + } +} + +func TestParseSkuIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SkuId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Expected: &SkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe", + Expected: &SkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + SkuName: "sKuNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSkuIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + } +} + +func TestSegmentsForSkuId(t *testing.T) { + segments := SkuId{}.Segments() + if len(segments) == 0 { + t.Fatalf("SkuId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_skuversion.go b/resource-manager/compute/2025-04-01/computerps/id_skuversion.go new file mode 100644 index 00000000000..b8761bc0c72 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_skuversion.go @@ -0,0 +1,159 @@ +package computerps + +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(&SkuVersionId{}) +} + +var _ resourceids.ResourceId = &SkuVersionId{} + +// SkuVersionId is a struct representing the Resource ID for a Sku Version +type SkuVersionId struct { + SubscriptionId string + LocationName string + PublisherName string + OfferName string + SkuName string + VersionName string +} + +// NewSkuVersionID returns a new SkuVersionId struct +func NewSkuVersionID(subscriptionId string, locationName string, publisherName string, offerName string, skuName string, versionName string) SkuVersionId { + return SkuVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + OfferName: offerName, + SkuName: skuName, + VersionName: versionName, + } +} + +// ParseSkuVersionID parses 'input' into a SkuVersionId +func ParseSkuVersionID(input string) (*SkuVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&SkuVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SkuVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSkuVersionIDInsensitively parses 'input' case-insensitively into a SkuVersionId +// note: this method should only be used for API response data and not user input +func ParseSkuVersionIDInsensitively(input string) (*SkuVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&SkuVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SkuVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) + } + + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) + } + + return nil +} + +// ValidateSkuVersionID checks that 'input' can be parsed as a Sku Version ID +func ValidateSkuVersionID(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 := ParseSkuVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sku Version ID +func (id SkuVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmImage/offers/%s/skus/%s/versions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.OfferName, id.SkuName, id.VersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sku Version ID +func (id SkuVersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + resourceids.StaticSegment("staticSkus", "skus", "skus"), + resourceids.UserSpecifiedSegment("skuName", "skuName"), + resourceids.StaticSegment("staticVersions", "versions", "versions"), + resourceids.UserSpecifiedSegment("versionName", "versionName"), + } +} + +// String returns a human-readable description of this Sku Version ID +func (id SkuVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + fmt.Sprintf("Sku Name: %q", id.SkuName), + fmt.Sprintf("Version Name: %q", id.VersionName), + } + return fmt.Sprintf("Sku Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_skuversion_test.go b/resource-manager/compute/2025-04-01/computerps/id_skuversion_test.go new file mode 100644 index 00000000000..e5616c987d7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_skuversion_test.go @@ -0,0 +1,447 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &SkuVersionId{} + +func TestNewSkuVersionID(t *testing.T) { + id := NewSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName", "versionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } + + if id.SkuName != "skuName" { + t.Fatalf("Expected %q but got %q for Segment 'SkuName'", id.SkuName, "skuName") + } + + if id.VersionName != "versionName" { + t.Fatalf("Expected %q but got %q for Segment 'VersionName'", id.VersionName, "versionName") + } +} + +func TestFormatSkuVersionID(t *testing.T) { + actual := NewSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName", "versionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseSkuVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SkuVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName", + Expected: &SkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSkuVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestParseSkuVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SkuVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName", + Expected: &SkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS/vErSiOnNaMe", + Expected: &SkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + SkuName: "sKuNaMe", + VersionName: "vErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS/vErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSkuVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestSegmentsForSkuVersionId(t *testing.T) { + segments := SkuVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("SkuVersionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_type.go b/resource-manager/compute/2025-04-01/computerps/id_type.go new file mode 100644 index 00000000000..f8e4af30d78 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_type.go @@ -0,0 +1,141 @@ +package computerps + +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(&TypeId{}) +} + +var _ resourceids.ResourceId = &TypeId{} + +// TypeId is a struct representing the Resource ID for a Type +type TypeId struct { + SubscriptionId string + LocationName string + PublisherName string + TypeName string +} + +// NewTypeID returns a new TypeId struct +func NewTypeID(subscriptionId string, locationName string, publisherName string, typeName string) TypeId { + return TypeId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + TypeName: typeName, + } +} + +// ParseTypeID parses 'input' into a TypeId +func ParseTypeID(input string) (*TypeId, error) { + parser := resourceids.NewParserFromResourceIdType(&TypeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TypeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseTypeIDInsensitively parses 'input' case-insensitively into a TypeId +// note: this method should only be used for API response data and not user input +func ParseTypeIDInsensitively(input string) (*TypeId, error) { + parser := resourceids.NewParserFromResourceIdType(&TypeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TypeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) + } + + return nil +} + +// ValidateTypeID checks that 'input' can be parsed as a Type ID +func ValidateTypeID(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 := ParseTypeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Type ID +func (id TypeId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmExtension/types/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.TypeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Type ID +func (id TypeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmExtension", "vmExtension", "vmExtension"), + resourceids.StaticSegment("staticTypes", "types", "types"), + resourceids.UserSpecifiedSegment("typeName", "typeName"), + } +} + +// String returns a human-readable description of this Type ID +func (id TypeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Type Name: %q", id.TypeName), + } + return fmt.Sprintf("Type (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_type_test.go b/resource-manager/compute/2025-04-01/computerps/id_type_test.go new file mode 100644 index 00000000000..8bc8f701351 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_type_test.go @@ -0,0 +1,357 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &TypeId{} + +func TestNewTypeID(t *testing.T) { + id := NewTypeID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.TypeName != "typeName" { + t.Fatalf("Expected %q but got %q for Segment 'TypeName'", id.TypeName, "typeName") + } +} + +func TestFormatTypeID(t *testing.T) { + actual := NewTypeID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseTypeID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *TypeId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName", + Expected: &TypeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + TypeName: "typeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseTypeID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.TypeName != v.Expected.TypeName { + t.Fatalf("Expected %q but got %q for TypeName", v.Expected.TypeName, actual.TypeName) + } + + } +} + +func TestParseTypeIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *TypeId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName", + Expected: &TypeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + TypeName: "typeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE", + Expected: &TypeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + TypeName: "tYpEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseTypeIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.TypeName != v.Expected.TypeName { + t.Fatalf("Expected %q but got %q for TypeName", v.Expected.TypeName, actual.TypeName) + } + + } +} + +func TestSegmentsForTypeId(t *testing.T) { + segments := TypeId{}.Segments() + if len(segments) == 0 { + t.Fatalf("TypeId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_version.go b/resource-manager/compute/2025-04-01/computerps/id_version.go new file mode 100644 index 00000000000..a2587dc4244 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_version.go @@ -0,0 +1,150 @@ +package computerps + +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(&VersionId{}) +} + +var _ resourceids.ResourceId = &VersionId{} + +// VersionId is a struct representing the Resource ID for a Version +type VersionId struct { + SubscriptionId string + LocationName string + PublisherName string + TypeName string + VersionName string +} + +// NewVersionID returns a new VersionId struct +func NewVersionID(subscriptionId string, locationName string, publisherName string, typeName string, versionName string) VersionId { + return VersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + TypeName: typeName, + VersionName: versionName, + } +} + +// ParseVersionID parses 'input' into a VersionId +func ParseVersionID(input string) (*VersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVersionIDInsensitively parses 'input' case-insensitively into a VersionId +// note: this method should only be used for API response data and not user input +func ParseVersionIDInsensitively(input string) (*VersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) + } + + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) + } + + return nil +} + +// ValidateVersionID checks that 'input' can be parsed as a Version ID +func ValidateVersionID(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 := ParseVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Version ID +func (id VersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmExtension/types/%s/versions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.TypeName, id.VersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Version ID +func (id VersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmExtension", "vmExtension", "vmExtension"), + resourceids.StaticSegment("staticTypes", "types", "types"), + resourceids.UserSpecifiedSegment("typeName", "typeName"), + resourceids.StaticSegment("staticVersions", "versions", "versions"), + resourceids.UserSpecifiedSegment("versionName", "versionName"), + } +} + +// String returns a human-readable description of this Version ID +func (id VersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Type Name: %q", id.TypeName), + fmt.Sprintf("Version Name: %q", id.VersionName), + } + return fmt.Sprintf("Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_version_test.go b/resource-manager/compute/2025-04-01/computerps/id_version_test.go new file mode 100644 index 00000000000..0f4bd509e58 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_version_test.go @@ -0,0 +1,402 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VersionId{} + +func TestNewVersionID(t *testing.T) { + id := NewVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName", "versionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.TypeName != "typeName" { + t.Fatalf("Expected %q but got %q for Segment 'TypeName'", id.TypeName, "typeName") + } + + if id.VersionName != "versionName" { + t.Fatalf("Expected %q but got %q for Segment 'VersionName'", id.VersionName, "versionName") + } +} + +func TestFormatVersionID(t *testing.T) { + actual := NewVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName", "versionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName", + Expected: &VersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + TypeName: "typeName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.TypeName != v.Expected.TypeName { + t.Fatalf("Expected %q but got %q for TypeName", v.Expected.TypeName, actual.TypeName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestParseVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE/vErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName", + Expected: &VersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + TypeName: "typeName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE/vErSiOnS/vErSiOnNaMe", + Expected: &VersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + TypeName: "tYpEnAmE", + VersionName: "vErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE/vErSiOnS/vErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.TypeName != v.Expected.TypeName { + t.Fatalf("Expected %q but got %q for TypeName", v.Expected.TypeName, actual.TypeName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestSegmentsForVersionId(t *testing.T) { + segments := VersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VersionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_vmimageoffer.go b/resource-manager/compute/2025-04-01/computerps/id_vmimageoffer.go new file mode 100644 index 00000000000..c5caaf211d0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_vmimageoffer.go @@ -0,0 +1,150 @@ +package computerps + +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(&VMImageOfferId{}) +} + +var _ resourceids.ResourceId = &VMImageOfferId{} + +// VMImageOfferId is a struct representing the Resource ID for a VM Image Offer +type VMImageOfferId struct { + SubscriptionId string + LocationName string + EdgeZoneName string + PublisherName string + OfferName string +} + +// NewVMImageOfferID returns a new VMImageOfferId struct +func NewVMImageOfferID(subscriptionId string, locationName string, edgeZoneName string, publisherName string, offerName string) VMImageOfferId { + return VMImageOfferId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + PublisherName: publisherName, + OfferName: offerName, + } +} + +// ParseVMImageOfferID parses 'input' into a VMImageOfferId +func ParseVMImageOfferID(input string) (*VMImageOfferId, error) { + parser := resourceids.NewParserFromResourceIdType(&VMImageOfferId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VMImageOfferId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVMImageOfferIDInsensitively parses 'input' case-insensitively into a VMImageOfferId +// note: this method should only be used for API response data and not user input +func ParseVMImageOfferIDInsensitively(input string) (*VMImageOfferId, error) { + parser := resourceids.NewParserFromResourceIdType(&VMImageOfferId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VMImageOfferId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VMImageOfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + return nil +} + +// ValidateVMImageOfferID checks that 'input' can be parsed as a VM Image Offer ID +func ValidateVMImageOfferID(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 := ParseVMImageOfferID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted VM Image Offer ID +func (id VMImageOfferId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s/publishers/%s/artifactTypes/vmImage/offers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName, id.PublisherName, id.OfferName) +} + +// Segments returns a slice of Resource ID Segments which comprise this VM Image Offer ID +func (id VMImageOfferId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + } +} + +// String returns a human-readable description of this VM Image Offer ID +func (id VMImageOfferId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + } + return fmt.Sprintf("VM Image Offer (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/computerps/id_vmimageoffer_test.go b/resource-manager/compute/2025-04-01/computerps/id_vmimageoffer_test.go new file mode 100644 index 00000000000..318cac0d914 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/id_vmimageoffer_test.go @@ -0,0 +1,402 @@ +package computerps + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VMImageOfferId{} + +func TestNewVMImageOfferID(t *testing.T) { + id := NewVMImageOfferID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } +} + +func TestFormatVMImageOfferID(t *testing.T) { + actual := NewVMImageOfferID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVMImageOfferID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VMImageOfferId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Expected: &VMImageOfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVMImageOfferID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + } +} + +func TestParseVMImageOfferIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VMImageOfferId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Expected: &VMImageOfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Expected: &VMImageOfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVMImageOfferIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + } +} + +func TestSegmentsForVMImageOfferId(t *testing.T) { + segments := VMImageOfferId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VMImageOfferId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_loganalyticsexportrequestratebyinterval.go b/resource-manager/compute/2025-04-01/computerps/method_loganalyticsexportrequestratebyinterval.go new file mode 100644 index 00000000000..ad36862e66e --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_loganalyticsexportrequestratebyinterval.go @@ -0,0 +1,75 @@ +package computerps + +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 LogAnalyticsExportRequestRateByIntervalOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *LogAnalyticsOperationResult +} + +// LogAnalyticsExportRequestRateByInterval ... +func (c ComputeRPSClient) LogAnalyticsExportRequestRateByInterval(ctx context.Context, id LocationId, input RequestRateByIntervalInput) (result LogAnalyticsExportRequestRateByIntervalOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/logAnalytics/apiAccess/getRequestRateByInterval", 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 +} + +// LogAnalyticsExportRequestRateByIntervalThenPoll performs LogAnalyticsExportRequestRateByInterval then polls until it's completed +func (c ComputeRPSClient) LogAnalyticsExportRequestRateByIntervalThenPoll(ctx context.Context, id LocationId, input RequestRateByIntervalInput) error { + result, err := c.LogAnalyticsExportRequestRateByInterval(ctx, id, input) + if err != nil { + return fmt.Errorf("performing LogAnalyticsExportRequestRateByInterval: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after LogAnalyticsExportRequestRateByInterval: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_loganalyticsexportthrottledrequests.go b/resource-manager/compute/2025-04-01/computerps/method_loganalyticsexportthrottledrequests.go new file mode 100644 index 00000000000..8a91eb9044e --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_loganalyticsexportthrottledrequests.go @@ -0,0 +1,75 @@ +package computerps + +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 LogAnalyticsExportThrottledRequestsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *LogAnalyticsOperationResult +} + +// LogAnalyticsExportThrottledRequests ... +func (c ComputeRPSClient) LogAnalyticsExportThrottledRequests(ctx context.Context, id LocationId, input LogAnalyticsInputBase) (result LogAnalyticsExportThrottledRequestsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/logAnalytics/apiAccess/getThrottledRequests", 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 +} + +// LogAnalyticsExportThrottledRequestsThenPoll performs LogAnalyticsExportThrottledRequests then polls until it's completed +func (c ComputeRPSClient) LogAnalyticsExportThrottledRequestsThenPoll(ctx context.Context, id LocationId, input LogAnalyticsInputBase) error { + result, err := c.LogAnalyticsExportThrottledRequests(ctx, id, input) + if err != nil { + return fmt.Errorf("performing LogAnalyticsExportThrottledRequests: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after LogAnalyticsExportThrottledRequests: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_usagelist.go b/resource-manager/compute/2025-04-01/computerps/method_usagelist.go new file mode 100644 index 00000000000..f73d7c068a5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_usagelist.go @@ -0,0 +1,105 @@ +package computerps + +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 UsageListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Usage +} + +type UsageListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Usage +} + +type UsageListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *UsageListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// UsageList ... +func (c ComputeRPSClient) UsageList(ctx context.Context, id LocationId) (result UsageListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &UsageListCustomPager{}, + Path: fmt.Sprintf("%s/usages", 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 *[]Usage `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// UsageListComplete retrieves all the results into a single object +func (c ComputeRPSClient) UsageListComplete(ctx context.Context, id LocationId) (UsageListCompleteResult, error) { + return c.UsageListCompleteMatchingPredicate(ctx, id, UsageOperationPredicate{}) +} + +// UsageListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ComputeRPSClient) UsageListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate UsageOperationPredicate) (result UsageListCompleteResult, err error) { + items := make([]Usage, 0) + + resp, err := c.UsageList(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 = UsageListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineextensionimagesget.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineextensionimagesget.go new file mode 100644 index 00000000000..3f0c043994b --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineextensionimagesget.go @@ -0,0 +1,53 @@ +package computerps + +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 VirtualMachineExtensionImagesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineExtensionImage +} + +// VirtualMachineExtensionImagesGet ... +func (c ComputeRPSClient) VirtualMachineExtensionImagesGet(ctx context.Context, id VersionId) (result VirtualMachineExtensionImagesGetOperationResponse, 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 VirtualMachineExtensionImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineextensionimageslisttypes.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineextensionimageslisttypes.go new file mode 100644 index 00000000000..917a25704c8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineextensionimageslisttypes.go @@ -0,0 +1,54 @@ +package computerps + +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 VirtualMachineExtensionImagesListTypesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineExtensionImage +} + +// VirtualMachineExtensionImagesListTypes ... +func (c ComputeRPSClient) VirtualMachineExtensionImagesListTypes(ctx context.Context, id PublisherId) (result VirtualMachineExtensionImagesListTypesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/artifactTypes/vmExtension/types", 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 []VirtualMachineExtensionImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineextensionimageslistversions.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineextensionimageslistversions.go new file mode 100644 index 00000000000..64de12544fc --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineextensionimageslistversions.go @@ -0,0 +1,91 @@ +package computerps + +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 VirtualMachineExtensionImagesListVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineExtensionImage +} + +type VirtualMachineExtensionImagesListVersionsOperationOptions struct { + Filter *string + Orderby *string + Top *int64 +} + +func DefaultVirtualMachineExtensionImagesListVersionsOperationOptions() VirtualMachineExtensionImagesListVersionsOperationOptions { + return VirtualMachineExtensionImagesListVersionsOperationOptions{} +} + +func (o VirtualMachineExtensionImagesListVersionsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o VirtualMachineExtensionImagesListVersionsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o VirtualMachineExtensionImagesListVersionsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// VirtualMachineExtensionImagesListVersions ... +func (c ComputeRPSClient) VirtualMachineExtensionImagesListVersions(ctx context.Context, id TypeId, options VirtualMachineExtensionImagesListVersionsOperationOptions) (result VirtualMachineExtensionImagesListVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/versions", 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 []VirtualMachineExtensionImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezoneget.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezoneget.go new file mode 100644 index 00000000000..c48ac6006ad --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezoneget.go @@ -0,0 +1,53 @@ +package computerps + +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 VirtualMachineImagesEdgeZoneGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineImage +} + +// VirtualMachineImagesEdgeZoneGet ... +func (c ComputeRPSClient) VirtualMachineImagesEdgeZoneGet(ctx context.Context, id OfferSkuVersionId) (result VirtualMachineImagesEdgeZoneGetOperationResponse, 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 VirtualMachineImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelist.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelist.go new file mode 100644 index 00000000000..b53e456f432 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelist.go @@ -0,0 +1,91 @@ +package computerps + +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 VirtualMachineImagesEdgeZoneListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +type VirtualMachineImagesEdgeZoneListOperationOptions struct { + Expand *string + Orderby *string + Top *int64 +} + +func DefaultVirtualMachineImagesEdgeZoneListOperationOptions() VirtualMachineImagesEdgeZoneListOperationOptions { + return VirtualMachineImagesEdgeZoneListOperationOptions{} +} + +func (o VirtualMachineImagesEdgeZoneListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o VirtualMachineImagesEdgeZoneListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o VirtualMachineImagesEdgeZoneListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// VirtualMachineImagesEdgeZoneList ... +func (c ComputeRPSClient) VirtualMachineImagesEdgeZoneList(ctx context.Context, id OfferSkuId, options VirtualMachineImagesEdgeZoneListOperationOptions) (result VirtualMachineImagesEdgeZoneListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/versions", 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 []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelistoffers.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelistoffers.go new file mode 100644 index 00000000000..f40756e34ab --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelistoffers.go @@ -0,0 +1,54 @@ +package computerps + +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 VirtualMachineImagesEdgeZoneListOffersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneListOffers ... +func (c ComputeRPSClient) VirtualMachineImagesEdgeZoneListOffers(ctx context.Context, id EdgeZonePublisherId) (result VirtualMachineImagesEdgeZoneListOffersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/artifactTypes/vmImage/offers", 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 []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelistpublishers.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelistpublishers.go new file mode 100644 index 00000000000..83e197959a7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelistpublishers.go @@ -0,0 +1,54 @@ +package computerps + +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 VirtualMachineImagesEdgeZoneListPublishersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneListPublishers ... +func (c ComputeRPSClient) VirtualMachineImagesEdgeZoneListPublishers(ctx context.Context, id EdgeZoneId) (result VirtualMachineImagesEdgeZoneListPublishersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/publishers", 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 []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelistskus.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelistskus.go new file mode 100644 index 00000000000..7021dc3fcad --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesedgezonelistskus.go @@ -0,0 +1,54 @@ +package computerps + +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 VirtualMachineImagesEdgeZoneListSkusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneListSkus ... +func (c ComputeRPSClient) VirtualMachineImagesEdgeZoneListSkus(ctx context.Context, id VMImageOfferId) (result VirtualMachineImagesEdgeZoneListSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/skus", 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 []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesget.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesget.go new file mode 100644 index 00000000000..6954953e8a9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimagesget.go @@ -0,0 +1,53 @@ +package computerps + +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 VirtualMachineImagesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineImage +} + +// VirtualMachineImagesGet ... +func (c ComputeRPSClient) VirtualMachineImagesGet(ctx context.Context, id SkuVersionId) (result VirtualMachineImagesGetOperationResponse, 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 VirtualMachineImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslist.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslist.go new file mode 100644 index 00000000000..ac6f3320a43 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslist.go @@ -0,0 +1,91 @@ +package computerps + +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 VirtualMachineImagesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +type VirtualMachineImagesListOperationOptions struct { + Expand *string + Orderby *string + Top *int64 +} + +func DefaultVirtualMachineImagesListOperationOptions() VirtualMachineImagesListOperationOptions { + return VirtualMachineImagesListOperationOptions{} +} + +func (o VirtualMachineImagesListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o VirtualMachineImagesListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o VirtualMachineImagesListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// VirtualMachineImagesList ... +func (c ComputeRPSClient) VirtualMachineImagesList(ctx context.Context, id SkuId, options VirtualMachineImagesListOperationOptions) (result VirtualMachineImagesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/versions", 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 []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistbyedgezone.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistbyedgezone.go new file mode 100644 index 00000000000..9c615e1c230 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistbyedgezone.go @@ -0,0 +1,105 @@ +package computerps + +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 VirtualMachineImagesListByEdgeZoneOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +type VirtualMachineImagesListByEdgeZoneCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineImageResource +} + +type VirtualMachineImagesListByEdgeZoneCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *VirtualMachineImagesListByEdgeZoneCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// VirtualMachineImagesListByEdgeZone ... +func (c ComputeRPSClient) VirtualMachineImagesListByEdgeZone(ctx context.Context, id EdgeZoneId) (result VirtualMachineImagesListByEdgeZoneOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &VirtualMachineImagesListByEdgeZoneCustomPager{}, + Path: fmt.Sprintf("%s/vmimages", 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 *[]VirtualMachineImageResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// VirtualMachineImagesListByEdgeZoneComplete retrieves all the results into a single object +func (c ComputeRPSClient) VirtualMachineImagesListByEdgeZoneComplete(ctx context.Context, id EdgeZoneId) (VirtualMachineImagesListByEdgeZoneCompleteResult, error) { + return c.VirtualMachineImagesListByEdgeZoneCompleteMatchingPredicate(ctx, id, VirtualMachineImageResourceOperationPredicate{}) +} + +// VirtualMachineImagesListByEdgeZoneCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ComputeRPSClient) VirtualMachineImagesListByEdgeZoneCompleteMatchingPredicate(ctx context.Context, id EdgeZoneId, predicate VirtualMachineImageResourceOperationPredicate) (result VirtualMachineImagesListByEdgeZoneCompleteResult, err error) { + items := make([]VirtualMachineImageResource, 0) + + resp, err := c.VirtualMachineImagesListByEdgeZone(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 = VirtualMachineImagesListByEdgeZoneCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistoffers.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistoffers.go new file mode 100644 index 00000000000..69174501f40 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistoffers.go @@ -0,0 +1,54 @@ +package computerps + +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 VirtualMachineImagesListOffersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// VirtualMachineImagesListOffers ... +func (c ComputeRPSClient) VirtualMachineImagesListOffers(ctx context.Context, id PublisherId) (result VirtualMachineImagesListOffersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/artifactTypes/vmImage/offers", 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 []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistpublishers.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistpublishers.go new file mode 100644 index 00000000000..a3c52828bd9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistpublishers.go @@ -0,0 +1,54 @@ +package computerps + +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 VirtualMachineImagesListPublishersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// VirtualMachineImagesListPublishers ... +func (c ComputeRPSClient) VirtualMachineImagesListPublishers(ctx context.Context, id LocationId) (result VirtualMachineImagesListPublishersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/publishers", 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 []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistskus.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistskus.go new file mode 100644 index 00000000000..af804cc0935 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineimageslistskus.go @@ -0,0 +1,54 @@ +package computerps + +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 VirtualMachineImagesListSkusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// VirtualMachineImagesListSkus ... +func (c ComputeRPSClient) VirtualMachineImagesListSkus(ctx context.Context, id OfferId) (result VirtualMachineImagesListSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/skus", 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 []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineruncommandsget.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineruncommandsget.go new file mode 100644 index 00000000000..fc1c8953a70 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineruncommandsget.go @@ -0,0 +1,53 @@ +package computerps + +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 VirtualMachineRunCommandsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandDocument +} + +// VirtualMachineRunCommandsGet ... +func (c ComputeRPSClient) VirtualMachineRunCommandsGet(ctx context.Context, id RunCommandId) (result VirtualMachineRunCommandsGetOperationResponse, 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 RunCommandDocument + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineruncommandslist.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineruncommandslist.go new file mode 100644 index 00000000000..84bc97b93c0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineruncommandslist.go @@ -0,0 +1,105 @@ +package computerps + +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 VirtualMachineRunCommandsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RunCommandDocumentBase +} + +type VirtualMachineRunCommandsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []RunCommandDocumentBase +} + +type VirtualMachineRunCommandsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *VirtualMachineRunCommandsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// VirtualMachineRunCommandsList ... +func (c ComputeRPSClient) VirtualMachineRunCommandsList(ctx context.Context, id LocationId) (result VirtualMachineRunCommandsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &VirtualMachineRunCommandsListCustomPager{}, + Path: fmt.Sprintf("%s/runCommands", 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 *[]RunCommandDocumentBase `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// VirtualMachineRunCommandsListComplete retrieves all the results into a single object +func (c ComputeRPSClient) VirtualMachineRunCommandsListComplete(ctx context.Context, id LocationId) (VirtualMachineRunCommandsListCompleteResult, error) { + return c.VirtualMachineRunCommandsListCompleteMatchingPredicate(ctx, id, RunCommandDocumentBaseOperationPredicate{}) +} + +// VirtualMachineRunCommandsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ComputeRPSClient) VirtualMachineRunCommandsListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate RunCommandDocumentBaseOperationPredicate) (result VirtualMachineRunCommandsListCompleteResult, err error) { + items := make([]RunCommandDocumentBase, 0) + + resp, err := c.VirtualMachineRunCommandsList(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 = VirtualMachineRunCommandsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachinescalesetslistbylocation.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachinescalesetslistbylocation.go new file mode 100644 index 00000000000..6bebe156e6b --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachinescalesetslistbylocation.go @@ -0,0 +1,105 @@ +package computerps + +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 VirtualMachineScaleSetsListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSet +} + +type VirtualMachineScaleSetsListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSet +} + +type VirtualMachineScaleSetsListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *VirtualMachineScaleSetsListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// VirtualMachineScaleSetsListByLocation ... +func (c ComputeRPSClient) VirtualMachineScaleSetsListByLocation(ctx context.Context, id LocationId) (result VirtualMachineScaleSetsListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &VirtualMachineScaleSetsListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/virtualMachineScaleSets", 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 *[]VirtualMachineScaleSet `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// VirtualMachineScaleSetsListByLocationComplete retrieves all the results into a single object +func (c ComputeRPSClient) VirtualMachineScaleSetsListByLocationComplete(ctx context.Context, id LocationId) (VirtualMachineScaleSetsListByLocationCompleteResult, error) { + return c.VirtualMachineScaleSetsListByLocationCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetOperationPredicate{}) +} + +// VirtualMachineScaleSetsListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ComputeRPSClient) VirtualMachineScaleSetsListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate VirtualMachineScaleSetOperationPredicate) (result VirtualMachineScaleSetsListByLocationCompleteResult, err error) { + items := make([]VirtualMachineScaleSet, 0) + + resp, err := c.VirtualMachineScaleSetsListByLocation(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 = VirtualMachineScaleSetsListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachinesizeslist.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachinesizeslist.go new file mode 100644 index 00000000000..4424b86817c --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachinesizeslist.go @@ -0,0 +1,105 @@ +package computerps + +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 VirtualMachineSizesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineSize +} + +type VirtualMachineSizesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineSize +} + +type VirtualMachineSizesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *VirtualMachineSizesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// VirtualMachineSizesList ... +func (c ComputeRPSClient) VirtualMachineSizesList(ctx context.Context, id LocationId) (result VirtualMachineSizesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &VirtualMachineSizesListCustomPager{}, + Path: fmt.Sprintf("%s/vmSizes", 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 *[]VirtualMachineSize `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// VirtualMachineSizesListComplete retrieves all the results into a single object +func (c ComputeRPSClient) VirtualMachineSizesListComplete(ctx context.Context, id LocationId) (VirtualMachineSizesListCompleteResult, error) { + return c.VirtualMachineSizesListCompleteMatchingPredicate(ctx, id, VirtualMachineSizeOperationPredicate{}) +} + +// VirtualMachineSizesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ComputeRPSClient) VirtualMachineSizesListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate VirtualMachineSizeOperationPredicate) (result VirtualMachineSizesListCompleteResult, err error) { + items := make([]VirtualMachineSize, 0) + + resp, err := c.VirtualMachineSizesList(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 = VirtualMachineSizesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/method_virtualmachineslistbylocation.go b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineslistbylocation.go new file mode 100644 index 00000000000..fd1e4529279 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/method_virtualmachineslistbylocation.go @@ -0,0 +1,105 @@ +package computerps + +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 VirtualMachinesListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachine +} + +type VirtualMachinesListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachine +} + +type VirtualMachinesListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *VirtualMachinesListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// VirtualMachinesListByLocation ... +func (c ComputeRPSClient) VirtualMachinesListByLocation(ctx context.Context, id LocationId) (result VirtualMachinesListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &VirtualMachinesListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/virtualMachines", 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 *[]VirtualMachine `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// VirtualMachinesListByLocationComplete retrieves all the results into a single object +func (c ComputeRPSClient) VirtualMachinesListByLocationComplete(ctx context.Context, id LocationId) (VirtualMachinesListByLocationCompleteResult, error) { + return c.VirtualMachinesListByLocationCompleteMatchingPredicate(ctx, id, VirtualMachineOperationPredicate{}) +} + +// VirtualMachinesListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ComputeRPSClient) VirtualMachinesListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate VirtualMachineOperationPredicate) (result VirtualMachinesListByLocationCompleteResult, err error) { + items := make([]VirtualMachine, 0) + + resp, err := c.VirtualMachinesListByLocation(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 = VirtualMachinesListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_additionalcapabilities.go b/resource-manager/compute/2025-04-01/computerps/model_additionalcapabilities.go new file mode 100644 index 00000000000..87b995bc39e --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_additionalcapabilities.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalCapabilities struct { + EnableFips1403Encryption *bool `json:"enableFips1403Encryption,omitempty"` + HibernationEnabled *bool `json:"hibernationEnabled,omitempty"` + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_additionalunattendcontent.go b/resource-manager/compute/2025-04-01/computerps/model_additionalunattendcontent.go new file mode 100644 index 00000000000..bdd9870827a --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentName `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassName `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_allinstancesdown.go b/resource-manager/compute/2025-04-01/computerps/model_allinstancesdown.go new file mode 100644 index 00000000000..a515a57d7e3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_allinstancesdown.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AllInstancesDown struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_alternativeoption.go b/resource-manager/compute/2025-04-01/computerps/model_alternativeoption.go new file mode 100644 index 00000000000..3242ee882c6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_alternativeoption.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AlternativeOption struct { + Type *AlternativeType `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_apientityreference.go b/resource-manager/compute/2025-04-01/computerps/model_apientityreference.go new file mode 100644 index 00000000000..606b558b93c --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_apientityreference.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_apierror.go b/resource-manager/compute/2025-04-01/computerps/model_apierror.go new file mode 100644 index 00000000000..9188f152c8b --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_apierror.go @@ -0,0 +1,12 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiError struct { + Code *string `json:"code,omitempty"` + Details *[]ApiErrorBase `json:"details,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_apierrorbase.go b/resource-manager/compute/2025-04-01/computerps/model_apierrorbase.go new file mode 100644 index 00000000000..4307d642ef9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_apierrorbase.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiErrorBase struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_applicationprofile.go b/resource-manager/compute/2025-04-01/computerps/model_applicationprofile.go new file mode 100644 index 00000000000..1b360977c28 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_applicationprofile.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProfile struct { + GalleryApplications *[]VMGalleryApplication `json:"galleryApplications,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_automaticosupgradepolicy.go b/resource-manager/compute/2025-04-01/computerps/model_automaticosupgradepolicy.go new file mode 100644 index 00000000000..88429a12964 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_automaticosupgradepolicy.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticOSUpgradePolicy struct { + DisableAutomaticRollback *bool `json:"disableAutomaticRollback,omitempty"` + EnableAutomaticOSUpgrade *bool `json:"enableAutomaticOSUpgrade,omitempty"` + OsRollingUpgradeDeferral *bool `json:"osRollingUpgradeDeferral,omitempty"` + UseRollingUpgradePolicy *bool `json:"useRollingUpgradePolicy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_automaticosupgradeproperties.go b/resource-manager/compute/2025-04-01/computerps/model_automaticosupgradeproperties.go new file mode 100644 index 00000000000..4c3fdd138c1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_automaticosupgradeproperties.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticOSUpgradeProperties struct { + AutomaticOSUpgradeSupported bool `json:"automaticOSUpgradeSupported"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_automaticrepairspolicy.go b/resource-manager/compute/2025-04-01/computerps/model_automaticrepairspolicy.go new file mode 100644 index 00000000000..4fd00236eab --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_automaticrepairspolicy.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticRepairsPolicy struct { + Enabled *bool `json:"enabled,omitempty"` + GracePeriod *string `json:"gracePeriod,omitempty"` + RepairAction *RepairAction `json:"repairAction,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_automaticzonerebalancingpolicy.go b/resource-manager/compute/2025-04-01/computerps/model_automaticzonerebalancingpolicy.go new file mode 100644 index 00000000000..7ea861523f6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_automaticzonerebalancingpolicy.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticZoneRebalancingPolicy struct { + Enabled *bool `json:"enabled,omitempty"` + RebalanceBehavior *RebalanceBehavior `json:"rebalanceBehavior,omitempty"` + RebalanceStrategy *RebalanceStrategy `json:"rebalanceStrategy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_availablepatchsummary.go b/resource-manager/compute/2025-04-01/computerps/model_availablepatchsummary.go new file mode 100644 index 00000000000..b6ebb03a6de --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_availablepatchsummary.go @@ -0,0 +1,45 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailablePatchSummary struct { + AssessmentActivityId *string `json:"assessmentActivityId,omitempty"` + CriticalAndSecurityPatchCount *int64 `json:"criticalAndSecurityPatchCount,omitempty"` + Error *ApiError `json:"error,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + OtherPatchCount *int64 `json:"otherPatchCount,omitempty"` + RebootPending *bool `json:"rebootPending,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *AvailablePatchSummary) GetLastModifiedTimeAsTime() (*time.Time, error) { + if o.LastModifiedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AvailablePatchSummary) SetLastModifiedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedTime = &formatted +} + +func (o *AvailablePatchSummary) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AvailablePatchSummary) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_billingprofile.go b/resource-manager/compute/2025-04-01/computerps/model_billingprofile.go new file mode 100644 index 00000000000..a5408338697 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_billingprofile.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BillingProfile struct { + MaxPrice *float64 `json:"maxPrice,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_bootdiagnostics.go b/resource-manager/compute/2025-04-01/computerps/model_bootdiagnostics.go new file mode 100644 index 00000000000..c7a9ff5a9ac --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_bootdiagnosticsinstanceview.go b/resource-manager/compute/2025-04-01/computerps/model_bootdiagnosticsinstanceview.go new file mode 100644 index 00000000000..3313f734624 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_bootdiagnosticsinstanceview.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnosticsInstanceView struct { + ConsoleScreenshotBlobUri *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobUri *string `json:"serialConsoleLogBlobUri,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_capacityreservationprofile.go b/resource-manager/compute/2025-04-01/computerps/model_capacityreservationprofile.go new file mode 100644 index 00000000000..c94cef0de12 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_capacityreservationprofile.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationProfile struct { + CapacityReservationGroup *SubResource `json:"capacityReservationGroup,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_datadisk.go b/resource-manager/compute/2025-04-01/computerps/model_datadisk.go new file mode 100644 index 00000000000..8cd54a8d737 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_datadisk.go @@ -0,0 +1,22 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + SourceResource *ApiEntityReference `json:"sourceResource,omitempty"` + ToBeDetached *bool `json:"toBeDetached,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_datadiskimage.go b/resource-manager/compute/2025-04-01/computerps/model_datadiskimage.go new file mode 100644 index 00000000000..fc21212fbbf --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_datadiskimage.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDiskImage struct { + Lun *int64 `json:"lun,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_diagnosticsprofile.go b/resource-manager/compute/2025-04-01/computerps/model_diagnosticsprofile.go new file mode 100644 index 00000000000..f33fb320d06 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_diffdisksettings.go b/resource-manager/compute/2025-04-01/computerps/model_diffdisksettings.go new file mode 100644 index 00000000000..d479609f525 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_diffdisksettings.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiffDiskSettings struct { + Option *DiffDiskOptions `json:"option,omitempty"` + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_disallowedconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_disallowedconfiguration.go new file mode 100644 index 00000000000..8c66a84cbb3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_disallowedconfiguration.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DisallowedConfiguration struct { + VMDiskType *VMDiskTypes `json:"vmDiskType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_diskencryptionsettings.go b/resource-manager/compute/2025-04-01/computerps/model_diskencryptionsettings.go new file mode 100644 index 00000000000..b9cbfea77ee --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_diskencryptionsettings.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_diskinstanceview.go b/resource-manager/compute/2025-04-01/computerps/model_diskinstanceview.go new file mode 100644 index 00000000000..d18aa836150 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_diskinstanceview.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskInstanceView struct { + EncryptionSettings *[]DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_encryptionidentity.go b/resource-manager/compute/2025-04-01/computerps/model_encryptionidentity.go new file mode 100644 index 00000000000..304cd3cb6d9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionIdentity struct { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_eventgridandresourcegraph.go b/resource-manager/compute/2025-04-01/computerps/model_eventgridandresourcegraph.go new file mode 100644 index 00000000000..77171d5a48f --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_eventgridandresourcegraph.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventGridAndResourceGraph struct { + Enable *bool `json:"enable,omitempty"` + ScheduledEventsApiVersion *string `json:"scheduledEventsApiVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_hardwareprofile.go b/resource-manager/compute/2025-04-01/computerps/model_hardwareprofile.go new file mode 100644 index 00000000000..dd508b362b5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_hardwareprofile.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_hostendpointsettings.go b/resource-manager/compute/2025-04-01/computerps/model_hostendpointsettings.go new file mode 100644 index 00000000000..23891505583 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_imagedeprecationstatus.go b/resource-manager/compute/2025-04-01/computerps/model_imagedeprecationstatus.go new file mode 100644 index 00000000000..5d479329f38 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_imagedeprecationstatus.go @@ -0,0 +1,28 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageDeprecationStatus struct { + AlternativeOption *AlternativeOption `json:"alternativeOption,omitempty"` + ImageState *ImageState `json:"imageState,omitempty"` + ScheduledDeprecationTime *string `json:"scheduledDeprecationTime,omitempty"` +} + +func (o *ImageDeprecationStatus) GetScheduledDeprecationTimeAsTime() (*time.Time, error) { + if o.ScheduledDeprecationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ScheduledDeprecationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ImageDeprecationStatus) SetScheduledDeprecationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ScheduledDeprecationTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_imagereference.go b/resource-manager/compute/2025-04-01/computerps/model_imagereference.go new file mode 100644 index 00000000000..69f11738a9b --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_imagereference.go @@ -0,0 +1,15 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + CommunityGalleryImageId *string `json:"communityGalleryImageId,omitempty"` + ExactVersion *string `json:"exactVersion,omitempty"` + Id *string `json:"id,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + SharedGalleryImageId *string `json:"sharedGalleryImageId,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_innererror.go b/resource-manager/compute/2025-04-01/computerps/model_innererror.go new file mode 100644 index 00000000000..9a33a4afeba --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_innererror.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InnerError struct { + Errordetail *string `json:"errordetail,omitempty"` + Exceptiontype *string `json:"exceptiontype,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/computerps/model_instanceviewstatus.go new file mode 100644 index 00000000000..14d36d04165 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_keyvaultkeyreference.go b/resource-manager/compute/2025-04-01/computerps/model_keyvaultkeyreference.go new file mode 100644 index 00000000000..b87d6cd2d53 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_keyvaultkeyreference.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyURL string `json:"keyUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_keyvaultsecretreference.go b/resource-manager/compute/2025-04-01/computerps/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..4cee5138027 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_lastpatchinstallationsummary.go b/resource-manager/compute/2025-04-01/computerps/model_lastpatchinstallationsummary.go new file mode 100644 index 00000000000..a179b177380 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_lastpatchinstallationsummary.go @@ -0,0 +1,48 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LastPatchInstallationSummary struct { + Error *ApiError `json:"error,omitempty"` + ExcludedPatchCount *int64 `json:"excludedPatchCount,omitempty"` + FailedPatchCount *int64 `json:"failedPatchCount,omitempty"` + InstallationActivityId *string `json:"installationActivityId,omitempty"` + InstalledPatchCount *int64 `json:"installedPatchCount,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + MaintenanceWindowExceeded *bool `json:"maintenanceWindowExceeded,omitempty"` + NotSelectedPatchCount *int64 `json:"notSelectedPatchCount,omitempty"` + PendingPatchCount *int64 `json:"pendingPatchCount,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *LastPatchInstallationSummary) GetLastModifiedTimeAsTime() (*time.Time, error) { + if o.LastModifiedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LastPatchInstallationSummary) SetLastModifiedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedTime = &formatted +} + +func (o *LastPatchInstallationSummary) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LastPatchInstallationSummary) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_linuxconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_linuxconfiguration.go new file mode 100644 index 00000000000..bc7ee497285 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_linuxpatchsettings.go b/resource-manager/compute/2025-04-01/computerps/model_linuxpatchsettings.go new file mode 100644 index 00000000000..249a8f81248 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/computerps/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..660fb6fc713 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_loganalyticsinputbase.go b/resource-manager/compute/2025-04-01/computerps/model_loganalyticsinputbase.go new file mode 100644 index 00000000000..656e5cbfe27 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_loganalyticsinputbase.go @@ -0,0 +1,39 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalyticsInputBase struct { + BlobContainerSasUri string `json:"blobContainerSasUri"` + FromTime string `json:"fromTime"` + GroupByClientApplicationId *bool `json:"groupByClientApplicationId,omitempty"` + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` + ToTime string `json:"toTime"` +} + +func (o *LogAnalyticsInputBase) GetFromTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.FromTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LogAnalyticsInputBase) SetFromTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FromTime = formatted +} + +func (o *LogAnalyticsInputBase) GetToTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.ToTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LogAnalyticsInputBase) SetToTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ToTime = formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_loganalyticsoperationresult.go b/resource-manager/compute/2025-04-01/computerps/model_loganalyticsoperationresult.go new file mode 100644 index 00000000000..ad9456e410b --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_loganalyticsoperationresult.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalyticsOperationResult struct { + Properties *LogAnalyticsOutput `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_loganalyticsoutput.go b/resource-manager/compute/2025-04-01/computerps/model_loganalyticsoutput.go new file mode 100644 index 00000000000..03c7f74fe38 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_loganalyticsoutput.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalyticsOutput struct { + Output *string `json:"output,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_maintenanceredeploystatus.go b/resource-manager/compute/2025-04-01/computerps/model_maintenanceredeploystatus.go new file mode 100644 index 00000000000..f23d8eb4275 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_maintenanceredeploystatus.go @@ -0,0 +1,68 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceRedeployStatus struct { + IsCustomerInitiatedMaintenanceAllowed *bool `json:"isCustomerInitiatedMaintenanceAllowed,omitempty"` + LastOperationMessage *string `json:"lastOperationMessage,omitempty"` + LastOperationResultCode *MaintenanceOperationResultCodeTypes `json:"lastOperationResultCode,omitempty"` + MaintenanceWindowEndTime *string `json:"maintenanceWindowEndTime,omitempty"` + MaintenanceWindowStartTime *string `json:"maintenanceWindowStartTime,omitempty"` + PreMaintenanceWindowEndTime *string `json:"preMaintenanceWindowEndTime,omitempty"` + PreMaintenanceWindowStartTime *string `json:"preMaintenanceWindowStartTime,omitempty"` +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowStartTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowStartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_manageddiskparameters.go b/resource-manager/compute/2025-04-01/computerps/model_manageddiskparameters.go new file mode 100644 index 00000000000..e34da6400e4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_manageddiskparameters.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Id *string `json:"id,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_maxinstancepercentperzonepolicy.go b/resource-manager/compute/2025-04-01/computerps/model_maxinstancepercentperzonepolicy.go new file mode 100644 index 00000000000..fdafd95c875 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_maxinstancepercentperzonepolicy.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaxInstancePercentPerZonePolicy struct { + Enabled *bool `json:"enabled,omitempty"` + Value *int64 `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_networkinterfacereference.go b/resource-manager/compute/2025-04-01/computerps/model_networkinterfacereference.go new file mode 100644 index 00000000000..60956aeb871 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_networkinterfacereference.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReference struct { + Id *string `json:"id,omitempty"` + Properties *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_networkinterfacereferenceproperties.go b/resource-manager/compute/2025-04-01/computerps/model_networkinterfacereferenceproperties.go new file mode 100644 index 00000000000..8376cb69bd3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_networkinterfacereferenceproperties.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReferenceProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_networkprofile.go b/resource-manager/compute/2025-04-01/computerps/model_networkprofile.go new file mode 100644 index 00000000000..1cf688940a9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_networkprofile.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineNetworkInterfaceConfiguration `json:"networkInterfaceConfigurations,omitempty"` + NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_osdisk.go b/resource-manager/compute/2025-04-01/computerps/model_osdisk.go new file mode 100644 index 00000000000..7ac52469abf --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_osdisk.go @@ -0,0 +1,19 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemTypes `json:"osType,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_osdiskimage.go b/resource-manager/compute/2025-04-01/computerps/model_osdiskimage.go new file mode 100644 index 00000000000..0f343f87335 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_osdiskimage.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSDiskImage struct { + OperatingSystem OperatingSystemTypes `json:"operatingSystem"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_osimagenotificationprofile.go b/resource-manager/compute/2025-04-01/computerps/model_osimagenotificationprofile.go new file mode 100644 index 00000000000..b6caa3b4f24 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_osimagenotificationprofile.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSImageNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_osprofile.go b/resource-manager/compute/2025-04-01/computerps/model_osprofile.go new file mode 100644 index 00000000000..4ead3876e5a --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_osprofile.go @@ -0,0 +1,16 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_patchsettings.go b/resource-manager/compute/2025-04-01/computerps/model_patchsettings.go new file mode 100644 index 00000000000..a7bc6aa1f77 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_patchsettings.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_placement.go b/resource-manager/compute/2025-04-01/computerps/model_placement.go new file mode 100644 index 00000000000..551b0b37df6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_placement.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Placement struct { + ExcludeZones *[]string `json:"excludeZones,omitempty"` + IncludeZones *[]string `json:"includeZones,omitempty"` + ZonePlacementPolicy *ZonePlacementPolicyType `json:"zonePlacementPolicy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_plan.go b/resource-manager/compute/2025-04-01/computerps/model_plan.go new file mode 100644 index 00000000000..401942f06cb --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_plan.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher *string `json:"publisher,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_prioritymixpolicy.go b/resource-manager/compute/2025-04-01/computerps/model_prioritymixpolicy.go new file mode 100644 index 00000000000..c08346ba8dd --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_prioritymixpolicy.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PriorityMixPolicy struct { + BaseRegularPriorityCount *int64 `json:"baseRegularPriorityCount,omitempty"` + RegularPriorityPercentageAboveBase *int64 `json:"regularPriorityPercentageAboveBase,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_proxyagentsettings.go b/resource-manager/compute/2025-04-01/computerps/model_proxyagentsettings.go new file mode 100644 index 00000000000..96c6808e1a3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_proxyagentsettings.go @@ -0,0 +1,13 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + AddProxyAgentExtension *bool `json:"addProxyAgentExtension,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_publicipaddresssku.go b/resource-manager/compute/2025-04-01/computerps/model_publicipaddresssku.go new file mode 100644 index 00000000000..25917f1625f --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_publicipaddresssku.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicIPAddressSku struct { + Name *PublicIPAddressSkuName `json:"name,omitempty"` + Tier *PublicIPAddressSkuTier `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_purchaseplan.go b/resource-manager/compute/2025-04-01/computerps/model_purchaseplan.go new file mode 100644 index 00000000000..7b939f151fc --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_purchaseplan.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PurchasePlan struct { + Name string `json:"name"` + Product string `json:"product"` + Publisher string `json:"publisher"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_requestratebyintervalinput.go b/resource-manager/compute/2025-04-01/computerps/model_requestratebyintervalinput.go new file mode 100644 index 00000000000..74d94bb4ed2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_requestratebyintervalinput.go @@ -0,0 +1,40 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RequestRateByIntervalInput struct { + BlobContainerSasUri string `json:"blobContainerSasUri"` + FromTime string `json:"fromTime"` + GroupByClientApplicationId *bool `json:"groupByClientApplicationId,omitempty"` + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` + IntervalLength IntervalInMins `json:"intervalLength"` + ToTime string `json:"toTime"` +} + +func (o *RequestRateByIntervalInput) GetFromTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.FromTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RequestRateByIntervalInput) SetFromTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FromTime = formatted +} + +func (o *RequestRateByIntervalInput) GetToTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.ToTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RequestRateByIntervalInput) SetToTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ToTime = formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_resiliencypolicy.go b/resource-manager/compute/2025-04-01/computerps/model_resiliencypolicy.go new file mode 100644 index 00000000000..108cd73c1c5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_resiliencypolicy.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResiliencyPolicy struct { + AutomaticZoneRebalancingPolicy *AutomaticZoneRebalancingPolicy `json:"automaticZoneRebalancingPolicy,omitempty"` + ResilientVMCreationPolicy *ResilientVMCreationPolicy `json:"resilientVMCreationPolicy,omitempty"` + ResilientVMDeletionPolicy *ResilientVMDeletionPolicy `json:"resilientVMDeletionPolicy,omitempty"` + ZoneAllocationPolicy *ZoneAllocationPolicy `json:"zoneAllocationPolicy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_resilientvmcreationpolicy.go b/resource-manager/compute/2025-04-01/computerps/model_resilientvmcreationpolicy.go new file mode 100644 index 00000000000..f618dcfc891 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_resilientvmcreationpolicy.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResilientVMCreationPolicy struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_resilientvmdeletionpolicy.go b/resource-manager/compute/2025-04-01/computerps/model_resilientvmdeletionpolicy.go new file mode 100644 index 00000000000..73392d3be3b --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_resilientvmdeletionpolicy.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResilientVMDeletionPolicy struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_rollingupgradepolicy.go b/resource-manager/compute/2025-04-01/computerps/model_rollingupgradepolicy.go new file mode 100644 index 00000000000..992373237e9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_rollingupgradepolicy.go @@ -0,0 +1,15 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradePolicy struct { + EnableCrossZoneUpgrade *bool `json:"enableCrossZoneUpgrade,omitempty"` + MaxBatchInstancePercent *int64 `json:"maxBatchInstancePercent,omitempty"` + MaxSurge *bool `json:"maxSurge,omitempty"` + MaxUnhealthyInstancePercent *int64 `json:"maxUnhealthyInstancePercent,omitempty"` + MaxUnhealthyUpgradedInstancePercent *int64 `json:"maxUnhealthyUpgradedInstancePercent,omitempty"` + PauseTimeBetweenBatches *string `json:"pauseTimeBetweenBatches,omitempty"` + PrioritizeUnhealthyInstances *bool `json:"prioritizeUnhealthyInstances,omitempty"` + RollbackFailedInstancesOnPolicyBreach *bool `json:"rollbackFailedInstancesOnPolicyBreach,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_runcommanddocument.go b/resource-manager/compute/2025-04-01/computerps/model_runcommanddocument.go new file mode 100644 index 00000000000..d4d2468e2f5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_runcommanddocument.go @@ -0,0 +1,14 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandDocument struct { + Description string `json:"description"` + Id string `json:"id"` + Label string `json:"label"` + OsType OperatingSystemTypes `json:"osType"` + Parameters *[]RunCommandParameterDefinition `json:"parameters,omitempty"` + Schema string `json:"$schema"` + Script []string `json:"script"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_runcommanddocumentbase.go b/resource-manager/compute/2025-04-01/computerps/model_runcommanddocumentbase.go new file mode 100644 index 00000000000..252727926aa --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_runcommanddocumentbase.go @@ -0,0 +1,12 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandDocumentBase struct { + Description string `json:"description"` + Id string `json:"id"` + Label string `json:"label"` + OsType OperatingSystemTypes `json:"osType"` + Schema string `json:"$schema"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_runcommandparameterdefinition.go b/resource-manager/compute/2025-04-01/computerps/model_runcommandparameterdefinition.go new file mode 100644 index 00000000000..6ac919e3c0c --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_runcommandparameterdefinition.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandParameterDefinition struct { + DefaultValue *string `json:"defaultValue,omitempty"` + Name string `json:"name"` + Required *bool `json:"required,omitempty"` + Type string `json:"type"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_scaleinpolicy.go b/resource-manager/compute/2025-04-01/computerps/model_scaleinpolicy.go new file mode 100644 index 00000000000..a1c57090070 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_scaleinpolicy.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleInPolicy struct { + ForceDeletion *bool `json:"forceDeletion,omitempty"` + PrioritizeUnhealthyVMs *bool `json:"prioritizeUnhealthyVMs,omitempty"` + Rules *[]VirtualMachineScaleSetScaleInRules `json:"rules,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_scheduledeventsadditionalpublishingtargets.go b/resource-manager/compute/2025-04-01/computerps/model_scheduledeventsadditionalpublishingtargets.go new file mode 100644 index 00000000000..c4d5bf0e659 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_scheduledeventsadditionalpublishingtargets.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsAdditionalPublishingTargets struct { + EventGridAndResourceGraph *EventGridAndResourceGraph `json:"eventGridAndResourceGraph,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_scheduledeventspolicy.go b/resource-manager/compute/2025-04-01/computerps/model_scheduledeventspolicy.go new file mode 100644 index 00000000000..7d1bbffec81 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_scheduledeventspolicy.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsPolicy struct { + AllInstancesDown *AllInstancesDown `json:"allInstancesDown,omitempty"` + ScheduledEventsAdditionalPublishingTargets *ScheduledEventsAdditionalPublishingTargets `json:"scheduledEventsAdditionalPublishingTargets,omitempty"` + UserInitiatedReboot *UserInitiatedReboot `json:"userInitiatedReboot,omitempty"` + UserInitiatedRedeploy *UserInitiatedRedeploy `json:"userInitiatedRedeploy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_scheduledeventsprofile.go b/resource-manager/compute/2025-04-01/computerps/model_scheduledeventsprofile.go new file mode 100644 index 00000000000..ca7646b0676 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_scheduledeventsprofile.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsProfile struct { + OsImageNotificationProfile *OSImageNotificationProfile `json:"osImageNotificationProfile,omitempty"` + TerminateNotificationProfile *TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_securityposturereference.go b/resource-manager/compute/2025-04-01/computerps/model_securityposturereference.go new file mode 100644 index 00000000000..8ec97b9627c --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_securityposturereference.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPostureReference struct { + ExcludeExtensions *[]string `json:"excludeExtensions,omitempty"` + Id string `json:"id"` + IsOverridable *bool `json:"isOverridable,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_securityprofile.go b/resource-manager/compute/2025-04-01/computerps/model_securityprofile.go new file mode 100644 index 00000000000..7173fa1bffc --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_securityprofile.go @@ -0,0 +1,12 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_serviceartifactreference.go b/resource-manager/compute/2025-04-01/computerps/model_serviceartifactreference.go new file mode 100644 index 00000000000..83379f1a5d3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_serviceartifactreference.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceArtifactReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_sku.go b/resource-manager/compute/2025-04-01/computerps/model_sku.go new file mode 100644 index 00000000000..ccd35f22c25 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_sku.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_skuprofile.go b/resource-manager/compute/2025-04-01/computerps/model_skuprofile.go new file mode 100644 index 00000000000..70414b02452 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_skuprofile.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuProfile struct { + AllocationStrategy *AllocationStrategy `json:"allocationStrategy,omitempty"` + VMSizes *[]SkuProfileVMSize `json:"vmSizes,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_skuprofilevmsize.go b/resource-manager/compute/2025-04-01/computerps/model_skuprofilevmsize.go new file mode 100644 index 00000000000..1346f1aad44 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_skuprofilevmsize.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuProfileVMSize struct { + Name *string `json:"name,omitempty"` + Rank *int64 `json:"rank,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_spotrestorepolicy.go b/resource-manager/compute/2025-04-01/computerps/model_spotrestorepolicy.go new file mode 100644 index 00000000000..93f94497b28 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_spotrestorepolicy.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpotRestorePolicy struct { + Enabled *bool `json:"enabled,omitempty"` + RestoreTimeout *string `json:"restoreTimeout,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_sshconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_sshconfiguration.go new file mode 100644 index 00000000000..23f37cd6084 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_sshpublickey.go b/resource-manager/compute/2025-04-01/computerps/model_sshpublickey.go new file mode 100644 index 00000000000..718084c0081 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_sshpublickey.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_storageprofile.go b/resource-manager/compute/2025-04-01/computerps/model_storageprofile.go new file mode 100644 index 00000000000..8bef75addbd --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_storageprofile.go @@ -0,0 +1,12 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + AlignRegionalDisksToVMZone *bool `json:"alignRegionalDisksToVMZone,omitempty"` + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *OSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_subresource.go b/resource-manager/compute/2025-04-01/computerps/model_subresource.go new file mode 100644 index 00000000000..9767fc43a2d --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_subresource.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_terminatenotificationprofile.go b/resource-manager/compute/2025-04-01/computerps/model_terminatenotificationprofile.go new file mode 100644 index 00000000000..f5affb69e8a --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_terminatenotificationprofile.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TerminateNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_uefisettings.go b/resource-manager/compute/2025-04-01/computerps/model_uefisettings.go new file mode 100644 index 00000000000..e0f2726d754 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_uefisettings.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_upgradepolicy.go b/resource-manager/compute/2025-04-01/computerps/model_upgradepolicy.go new file mode 100644 index 00000000000..25ec916e0f4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_upgradepolicy.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradePolicy struct { + AutomaticOSUpgradePolicy *AutomaticOSUpgradePolicy `json:"automaticOSUpgradePolicy,omitempty"` + Mode *UpgradeMode `json:"mode,omitempty"` + RollingUpgradePolicy *RollingUpgradePolicy `json:"rollingUpgradePolicy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_usage.go b/resource-manager/compute/2025-04-01/computerps/model_usage.go new file mode 100644 index 00000000000..5c3e5d4e692 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_usage.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Usage struct { + CurrentValue int64 `json:"currentValue"` + Limit int64 `json:"limit"` + Name UsageName `json:"name"` + Unit Unit `json:"unit"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_usagename.go b/resource-manager/compute/2025-04-01/computerps/model_usagename.go new file mode 100644 index 00000000000..eec372969cf --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_usagename.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageName struct { + LocalizedValue *string `json:"localizedValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_userinitiatedreboot.go b/resource-manager/compute/2025-04-01/computerps/model_userinitiatedreboot.go new file mode 100644 index 00000000000..526cf975bf6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_userinitiatedreboot.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedReboot struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_userinitiatedredeploy.go b/resource-manager/compute/2025-04-01/computerps/model_userinitiatedredeploy.go new file mode 100644 index 00000000000..8791d6e1d2b --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_userinitiatedredeploy.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedRedeploy struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_vaultcertificate.go b/resource-manager/compute/2025-04-01/computerps/model_vaultcertificate.go new file mode 100644 index 00000000000..4be6a49d141 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_vaultsecretgroup.go b/resource-manager/compute/2025-04-01/computerps/model_vaultsecretgroup.go new file mode 100644 index 00000000000..416cde9d217 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualharddisk.go b/resource-manager/compute/2025-04-01/computerps/model_virtualharddisk.go new file mode 100644 index 00000000000..f9e18a7de63 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualharddisk.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualHardDisk struct { + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachine.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachine.go new file mode 100644 index 00000000000..f62486c3286 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachine.go @@ -0,0 +1,29 @@ +package computerps + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachine struct { + Etag *string `json:"etag,omitempty"` + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Placement *Placement `json:"placement,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineProperties `json:"properties,omitempty"` + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineagentinstanceview.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineagentinstanceview.go new file mode 100644 index 00000000000..f26e961a9d4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineagentinstanceview.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineAgentInstanceView struct { + ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgentVersion *string `json:"vmAgentVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextension.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextension.go new file mode 100644 index 00000000000..67b49cf925c --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextension.go @@ -0,0 +1,18 @@ +package computerps + +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 VirtualMachineExtension struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionhandlerinstanceview.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionhandlerinstanceview.go new file mode 100644 index 00000000000..36b987cb7f6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionhandlerinstanceview.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionHandlerInstanceView struct { + Status *InstanceViewStatus `json:"status,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionimage.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionimage.go new file mode 100644 index 00000000000..39a8ca85ad4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionimage.go @@ -0,0 +1,18 @@ +package computerps + +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 VirtualMachineExtensionImage struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionimageproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionimageproperties.go new file mode 100644 index 00000000000..3f2df6aa2e3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionimageproperties.go @@ -0,0 +1,12 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionImageProperties struct { + ComputeRole string `json:"computeRole"` + HandlerSchema string `json:"handlerSchema"` + OperatingSystem string `json:"operatingSystem"` + SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"` + VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensioninstanceview.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensioninstanceview.go new file mode 100644 index 00000000000..dd4ebca1329 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensioninstanceview.go @@ -0,0 +1,12 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionproperties.go new file mode 100644 index 00000000000..47f2b69b7a2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineextensionproperties.go @@ -0,0 +1,20 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinehealthstatus.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinehealthstatus.go new file mode 100644 index 00000000000..73712d459a9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinehealthstatus.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineHealthStatus struct { + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimage.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimage.go new file mode 100644 index 00000000000..1daee1794cf --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimage.go @@ -0,0 +1,17 @@ +package computerps + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineImage struct { + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name string `json:"name"` + Properties *VirtualMachineImageProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimagefeature.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimagefeature.go new file mode 100644 index 00000000000..3c7f074b886 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimagefeature.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineImageFeature struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimageproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimageproperties.go new file mode 100644 index 00000000000..2ec4795ee69 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimageproperties.go @@ -0,0 +1,16 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineImageProperties struct { + Architecture *ArchitectureTypes `json:"architecture,omitempty"` + AutomaticOSUpgradeProperties *AutomaticOSUpgradeProperties `json:"automaticOSUpgradeProperties,omitempty"` + DataDiskImages *[]DataDiskImage `json:"dataDiskImages,omitempty"` + Disallowed *DisallowedConfiguration `json:"disallowed,omitempty"` + Features *[]VirtualMachineImageFeature `json:"features,omitempty"` + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + ImageDeprecationStatus *ImageDeprecationStatus `json:"imageDeprecationStatus,omitempty"` + OsDiskImage *OSDiskImage `json:"osDiskImage,omitempty"` + Plan *PurchasePlan `json:"plan,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimageresource.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimageresource.go new file mode 100644 index 00000000000..870ccfb72c5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineimageresource.go @@ -0,0 +1,16 @@ +package computerps + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineImageResource struct { + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name string `json:"name"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineinstanceview.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineinstanceview.go new file mode 100644 index 00000000000..9c62891e8bb --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineinstanceview.go @@ -0,0 +1,24 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceView struct { + AssignedHost *string `json:"assignedHost,omitempty"` + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + Disks *[]DiskInstanceView `json:"disks,omitempty"` + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + HyperVGeneration *HyperVGenerationType `json:"hyperVGeneration,omitempty"` + IsVMInStandbyPool *bool `json:"isVMInStandbyPool,omitempty"` + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + OsName *string `json:"osName,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + PatchStatus *VirtualMachinePatchStatus `json:"patchStatus,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + PlatformUpdateDomain *int64 `json:"platformUpdateDomain,omitempty"` + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineiptag.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineiptag.go new file mode 100644 index 00000000000..a1c4f06a847 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineiptag.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceconfiguration.go new file mode 100644 index 00000000000..4ee66a7451e --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceconfiguration.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceConfigurationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceconfigurationproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceconfigurationproperties.go new file mode 100644 index 00000000000..0d342584962 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceconfigurationproperties.go @@ -0,0 +1,19 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineNetworkInterfaceDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineNetworkInterfaceIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfacednssettingsconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfacednssettingsconfiguration.go new file mode 100644 index 00000000000..9174d309016 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfacednssettingsconfiguration.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceDnsSettingsConfiguration struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceipconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceipconfiguration.go new file mode 100644 index 00000000000..a5c7b39b529 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceipconfiguration.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceipconfigurationproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceipconfigurationproperties.go new file mode 100644 index 00000000000..b27e7237e7a --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinenetworkinterfaceipconfigurationproperties.go @@ -0,0 +1,14 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersions `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachinePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *SubResource `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepatchstatus.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepatchstatus.go new file mode 100644 index 00000000000..8f4b2055e6b --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepatchstatus.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePatchStatus struct { + AvailablePatchSummary *AvailablePatchSummary `json:"availablePatchSummary,omitempty"` + ConfigurationStatuses *[]InstanceViewStatus `json:"configurationStatuses,omitempty"` + LastPatchInstallationSummary *LastPatchInstallationSummary `json:"lastPatchInstallationSummary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachineproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineproperties.go new file mode 100644 index 00000000000..7fda9b943a4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachineproperties.go @@ -0,0 +1,52 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + EvictionPolicy *VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + Host *SubResource `json:"host,omitempty"` + HostGroup *SubResource `json:"hostGroup,omitempty"` + InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + Priority *VirtualMachinePriorityTypes `json:"priority,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ScheduledEventsPolicy *ScheduledEventsPolicy `json:"scheduledEventsPolicy,omitempty"` + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UserData *string `json:"userData,omitempty"` + VMId *string `json:"vmId,omitempty"` + VirtualMachineScaleSet *SubResource `json:"virtualMachineScaleSet,omitempty"` +} + +func (o *VirtualMachineProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepublicipaddressconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepublicipaddressconfiguration.go new file mode 100644 index 00000000000..de14e7604a2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepublicipaddressconfiguration.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachinePublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepublicipaddressconfigurationproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..d6c1f277207 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepublicipaddressconfigurationproperties.go @@ -0,0 +1,14 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachinePublicIPAddressDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersions `json:"publicIPAddressVersion,omitempty"` + PublicIPAllocationMethod *PublicIPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepublicipaddressdnssettingsconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepublicipaddressdnssettingsconfiguration.go new file mode 100644 index 00000000000..c504768ad35 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinepublicipaddressdnssettingsconfiguration.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressDnsSettingsConfiguration struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescaleset.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescaleset.go new file mode 100644 index 00000000000..f6d70d690f2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescaleset.go @@ -0,0 +1,28 @@ +package computerps + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSet struct { + Etag *string `json:"etag,omitempty"` + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Placement *Placement `json:"placement,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineScaleSetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetdatadisk.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetdatadisk.go new file mode 100644 index 00000000000..d7a9ebd3afd --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetdatadisk.go @@ -0,0 +1,17 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetDataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetextension.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetextension.go new file mode 100644 index 00000000000..d1170b2c238 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetextension.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtension struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetextensionprofile.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetextensionprofile.go new file mode 100644 index 00000000000..7758aa861e4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetextensionprofile.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionProfile struct { + Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"` + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetextensionproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetextensionproperties.go new file mode 100644 index 00000000000..86e6063649c --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetextensionproperties.go @@ -0,0 +1,19 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesethardwareprofile.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesethardwareprofile.go new file mode 100644 index 00000000000..987a01845b8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesethardwareprofile.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetHardwareProfile struct { + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetipconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetipconfiguration.go new file mode 100644 index 00000000000..00f8cf4bf7a --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetipconfiguration.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetipconfigurationproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetipconfigurationproperties.go new file mode 100644 index 00000000000..bdbdff05adb --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetipconfigurationproperties.go @@ -0,0 +1,15 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *ApiEntityReference `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetiptag.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetiptag.go new file mode 100644 index 00000000000..61dcb2e39ef --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetiptag.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetmanageddiskparameters.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetmanageddiskparameters.go new file mode 100644 index 00000000000..8b287dfb38a --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetmanageddiskparameters.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkconfiguration.go new file mode 100644 index 00000000000..526d64a8d26 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkconfiguration.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkconfigurationdnssettings.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkconfigurationdnssettings.go new file mode 100644 index 00000000000..2278e88ffa3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkconfigurationdnssettings.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationDnsSettings struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkconfigurationproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkconfigurationproperties.go new file mode 100644 index 00000000000..6f614172ed9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkconfigurationproperties.go @@ -0,0 +1,18 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings `json:"dnsSettings,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkprofile.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkprofile.go new file mode 100644 index 00000000000..3a247150451 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetnetworkprofile.go @@ -0,0 +1,10 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkProfile struct { + HealthProbe *ApiEntityReference `json:"healthProbe,omitempty"` + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetosdisk.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetosdisk.go new file mode 100644 index 00000000000..f771ad65b89 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetosdisk.go @@ -0,0 +1,18 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetOSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemTypes `json:"osType,omitempty"` + VhdContainers *[]string `json:"vhdContainers,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetosprofile.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetosprofile.go new file mode 100644 index 00000000000..99d8a6222c2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetosprofile.go @@ -0,0 +1,16 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetOSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetproperties.go new file mode 100644 index 00000000000..7a518115329 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetproperties.go @@ -0,0 +1,49 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + AutomaticRepairsPolicy *AutomaticRepairsPolicy `json:"automaticRepairsPolicy,omitempty"` + ConstrainedMaximumCapacity *bool `json:"constrainedMaximumCapacity,omitempty"` + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + HighSpeedInterconnectPlacement *HighSpeedInterconnectPlacement `json:"highSpeedInterconnectPlacement,omitempty"` + HostGroup *SubResource `json:"hostGroup,omitempty"` + OrchestrationMode *OrchestrationMode `json:"orchestrationMode,omitempty"` + Overprovision *bool `json:"overprovision,omitempty"` + PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"` + PriorityMixPolicy *PriorityMixPolicy `json:"priorityMixPolicy,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ResiliencyPolicy *ResiliencyPolicy `json:"resiliencyPolicy,omitempty"` + ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` + ScheduledEventsPolicy *ScheduledEventsPolicy `json:"scheduledEventsPolicy,omitempty"` + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + SkuProfile *SkuProfile `json:"skuProfile,omitempty"` + SpotRestorePolicy *SpotRestorePolicy `json:"spotRestorePolicy,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UniqueId *string `json:"uniqueId,omitempty"` + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` + ZonalPlatformFaultDomainAlignMode *ZonalPlatformFaultDomainAlignMode `json:"zonalPlatformFaultDomainAlignMode,omitempty"` + ZoneBalance *bool `json:"zoneBalance,omitempty"` +} + +func (o *VirtualMachineScaleSetProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineScaleSetProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetpublicipaddressconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetpublicipaddressconfiguration.go new file mode 100644 index 00000000000..2fc7044f6f9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetpublicipaddressconfiguration.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetPublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go new file mode 100644 index 00000000000..f1aaebb0a58 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..cac93b81aac --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go @@ -0,0 +1,13 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineScaleSetIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetstorageprofile.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetstorageprofile.go new file mode 100644 index 00000000000..756a0b06257 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetstorageprofile.go @@ -0,0 +1,11 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetStorageProfile struct { + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetvmprofile.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetvmprofile.go new file mode 100644 index 00000000000..76166295d46 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinescalesetvmprofile.go @@ -0,0 +1,43 @@ +package computerps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMProfile struct { + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + EvictionPolicy *VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + HardwareProfile *VirtualMachineScaleSetHardwareProfile `json:"hardwareProfile,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` + OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` + Priority *VirtualMachinePriorityTypes `json:"priority,omitempty"` + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + SecurityPostureReference *SecurityPostureReference `json:"securityPostureReference,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + ServiceArtifactReference *ServiceArtifactReference `json:"serviceArtifactReference,omitempty"` + StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UserData *string `json:"userData,omitempty"` +} + +func (o *VirtualMachineScaleSetVMProfile) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineScaleSetVMProfile) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_virtualmachinesize.go b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinesize.go new file mode 100644 index 00000000000..3ba0a271f73 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_virtualmachinesize.go @@ -0,0 +1,13 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSize struct { + MaxDataDiskCount *int64 `json:"maxDataDiskCount,omitempty"` + MemoryInMB *int64 `json:"memoryInMB,omitempty"` + Name *string `json:"name,omitempty"` + NumberOfCores *int64 `json:"numberOfCores,omitempty"` + OsDiskSizeInMB *int64 `json:"osDiskSizeInMB,omitempty"` + ResourceDiskSizeInMB *int64 `json:"resourceDiskSizeInMB,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_vmdisksecurityprofile.go b/resource-manager/compute/2025-04-01/computerps/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..bc80c3d87ad --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_vmgalleryapplication.go b/resource-manager/compute/2025-04-01/computerps/model_vmgalleryapplication.go new file mode 100644 index 00000000000..94470107a68 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_vmgalleryapplication.go @@ -0,0 +1,13 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMGalleryApplication struct { + ConfigurationReference *string `json:"configurationReference,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + Order *int64 `json:"order,omitempty"` + PackageReferenceId string `json:"packageReferenceId"` + Tags *string `json:"tags,omitempty"` + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_vmsizeproperties.go b/resource-manager/compute/2025-04-01/computerps/model_vmsizeproperties.go new file mode 100644 index 00000000000..ba55fbd71a9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_windowsconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_windowsconfiguration.go new file mode 100644 index 00000000000..71b1c5fcbd1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/computerps/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..40862bfef13 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_winrmconfiguration.go b/resource-manager/compute/2025-04-01/computerps/model_winrmconfiguration.go new file mode 100644 index 00000000000..5b4f6e502dd --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_winrmlistener.go b/resource-manager/compute/2025-04-01/computerps/model_winrmlistener.go new file mode 100644 index 00000000000..8a8934d59e8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_winrmlistener.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/model_zoneallocationpolicy.go b/resource-manager/compute/2025-04-01/computerps/model_zoneallocationpolicy.go new file mode 100644 index 00000000000..dfa7acdfe13 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/model_zoneallocationpolicy.go @@ -0,0 +1,9 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZoneAllocationPolicy struct { + MaxInstancePercentPerZonePolicy *MaxInstancePercentPerZonePolicy `json:"maxInstancePercentPerZonePolicy,omitempty"` + MaxZoneCount *int64 `json:"maxZoneCount,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/computerps/predicates.go b/resource-manager/compute/2025-04-01/computerps/predicates.go new file mode 100644 index 00000000000..18a0b1bab9c --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/predicates.go @@ -0,0 +1,182 @@ +package computerps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandDocumentBaseOperationPredicate struct { + Description *string + Id *string + Label *string + Schema *string +} + +func (p RunCommandDocumentBaseOperationPredicate) Matches(input RunCommandDocumentBase) bool { + + if p.Description != nil && *p.Description != input.Description { + return false + } + + if p.Id != nil && *p.Id != input.Id { + return false + } + + if p.Label != nil && *p.Label != input.Label { + return false + } + + if p.Schema != nil && *p.Schema != input.Schema { + return false + } + + return true +} + +type UsageOperationPredicate struct { + CurrentValue *int64 + Limit *int64 +} + +func (p UsageOperationPredicate) Matches(input Usage) bool { + + if p.CurrentValue != nil && *p.CurrentValue != input.CurrentValue { + return false + } + + if p.Limit != nil && *p.Limit != input.Limit { + return false + } + + return true +} + +type VirtualMachineOperationPredicate struct { + Etag *string + Id *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p VirtualMachineOperationPredicate) Matches(input VirtualMachine) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil || *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type VirtualMachineImageResourceOperationPredicate struct { + Id *string + Location *string + Name *string +} + +func (p VirtualMachineImageResourceOperationPredicate) Matches(input VirtualMachineImageResource) 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 && *p.Name != input.Name { + return false + } + + return true +} + +type VirtualMachineScaleSetOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineScaleSetOperationPredicate) Matches(input VirtualMachineScaleSet) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type VirtualMachineSizeOperationPredicate struct { + MaxDataDiskCount *int64 + MemoryInMB *int64 + Name *string + NumberOfCores *int64 + OsDiskSizeInMB *int64 + ResourceDiskSizeInMB *int64 +} + +func (p VirtualMachineSizeOperationPredicate) Matches(input VirtualMachineSize) bool { + + if p.MaxDataDiskCount != nil && (input.MaxDataDiskCount == nil || *p.MaxDataDiskCount != *input.MaxDataDiskCount) { + return false + } + + if p.MemoryInMB != nil && (input.MemoryInMB == nil || *p.MemoryInMB != *input.MemoryInMB) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.NumberOfCores != nil && (input.NumberOfCores == nil || *p.NumberOfCores != *input.NumberOfCores) { + return false + } + + if p.OsDiskSizeInMB != nil && (input.OsDiskSizeInMB == nil || *p.OsDiskSizeInMB != *input.OsDiskSizeInMB) { + return false + } + + if p.ResourceDiskSizeInMB != nil && (input.ResourceDiskSizeInMB == nil || *p.ResourceDiskSizeInMB != *input.ResourceDiskSizeInMB) { + return false + } + + return true +} diff --git a/resource-manager/compute/2025-04-01/computerps/version.go b/resource-manager/compute/2025-04-01/computerps/version.go new file mode 100644 index 00000000000..be3a28b5741 --- /dev/null +++ b/resource-manager/compute/2025-04-01/computerps/version.go @@ -0,0 +1,10 @@ +package computerps + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/computerps/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/README.md b/resource-manager/compute/2025-04-01/dedicatedhostgroups/README.md new file mode 100644 index 00000000000..f28aa223a92 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/README.md @@ -0,0 +1,129 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/dedicatedhostgroups` Documentation + +The `dedicatedhostgroups` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/dedicatedhostgroups" +``` + + +### Client Initialization + +```go +client := dedicatedhostgroups.NewDedicatedHostGroupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DedicatedHostGroupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +payload := dedicatedhostgroups.DedicatedHostGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.Delete` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.Get` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +read, err := client.Get(ctx, id, dedicatedhostgroups.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.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: `DedicatedHostGroupsClient.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: `DedicatedHostGroupsClient.Update` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +payload := dedicatedhostgroups.DedicatedHostGroupUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/client.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/client.go new file mode 100644 index 00000000000..1198b817462 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/client.go @@ -0,0 +1,26 @@ +package dedicatedhostgroups + +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 DedicatedHostGroupsClient struct { + Client *resourcemanager.Client +} + +func NewDedicatedHostGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*DedicatedHostGroupsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dedicatedhostgroups", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DedicatedHostGroupsClient: %+v", err) + } + + return &DedicatedHostGroupsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/constants.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/constants.go new file mode 100644 index 00000000000..2a42f984374 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/constants.go @@ -0,0 +1,98 @@ +package dedicatedhostgroups + +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 InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesResiliencyView InstanceViewTypes = "resiliencyView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesResiliencyView), + string(InstanceViewTypesUserData), + } +} + +func (s *InstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "resiliencyview": InstanceViewTypesResiliencyView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_createorupdate.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_createorupdate.go new file mode 100644 index 00000000000..4b26099152d --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_createorupdate.go @@ -0,0 +1,59 @@ +package dedicatedhostgroups + +import ( + "context" + "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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHostGroup +} + +// CreateOrUpdate ... +func (c DedicatedHostGroupsClient) CreateOrUpdate(ctx context.Context, id commonids.DedicatedHostGroupId, input DedicatedHostGroup) (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 + } + + var model DedicatedHostGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_delete.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_delete.go new file mode 100644 index 00000000000..36bbed2ac40 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_delete.go @@ -0,0 +1,48 @@ +package dedicatedhostgroups + +import ( + "context" + "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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c DedicatedHostGroupsClient) Delete(ctx context.Context, id commonids.DedicatedHostGroupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_get.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_get.go new file mode 100644 index 00000000000..8d31b580668 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_get.go @@ -0,0 +1,84 @@ +package dedicatedhostgroups + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHostGroup +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c DedicatedHostGroupsClient) Get(ctx context.Context, id commonids.DedicatedHostGroupId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 DedicatedHostGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_listbyresourcegroup.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_listbyresourcegroup.go new file mode 100644 index 00000000000..3fe766d2e65 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package dedicatedhostgroups + +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 *[]DedicatedHostGroup +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []DedicatedHostGroup +} + +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 DedicatedHostGroupsClient) 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.Compute/hostGroups", 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 *[]DedicatedHostGroup `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 DedicatedHostGroupsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, DedicatedHostGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DedicatedHostGroupsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DedicatedHostGroupOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]DedicatedHostGroup, 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/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_listbysubscription.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_listbysubscription.go new file mode 100644 index 00000000000..80e15ebf447 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_listbysubscription.go @@ -0,0 +1,106 @@ +package dedicatedhostgroups + +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 *[]DedicatedHostGroup +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []DedicatedHostGroup +} + +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 DedicatedHostGroupsClient) 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.Compute/hostGroups", 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 *[]DedicatedHostGroup `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 DedicatedHostGroupsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DedicatedHostGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DedicatedHostGroupsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DedicatedHostGroupOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]DedicatedHostGroup, 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/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_update.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_update.go new file mode 100644 index 00000000000..0bb7d2873f7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/method_update.go @@ -0,0 +1,58 @@ +package dedicatedhostgroups + +import ( + "context" + "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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHostGroup +} + +// Update ... +func (c DedicatedHostGroupsClient) Update(ctx context.Context, id commonids.DedicatedHostGroupId, input DedicatedHostGroupUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DedicatedHostGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go new file mode 100644 index 00000000000..6ba75a2253e --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go @@ -0,0 +1,9 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAllocatableVM struct { + Count *float64 `json:"count,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go new file mode 100644 index 00000000000..645a995fd14 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAvailableCapacity struct { + AllocatableVMs *[]DedicatedHostAllocatableVM `json:"allocatableVMs,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroup.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroup.go new file mode 100644 index 00000000000..d8a7ae573ca --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroup.go @@ -0,0 +1,20 @@ +package dedicatedhostgroups + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroup struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DedicatedHostGroupProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go new file mode 100644 index 00000000000..4f3f4179ea8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupInstanceView struct { + Hosts *[]DedicatedHostInstanceViewWithName `json:"hosts,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go new file mode 100644 index 00000000000..4b098a22db4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go @@ -0,0 +1,12 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupProperties struct { + AdditionalCapabilities *DedicatedHostGroupPropertiesAdditionalCapabilities `json:"additionalCapabilities,omitempty"` + Hosts *[]SubResourceReadOnly `json:"hosts,omitempty"` + InstanceView *DedicatedHostGroupInstanceView `json:"instanceView,omitempty"` + PlatformFaultDomainCount int64 `json:"platformFaultDomainCount"` + SupportAutomaticPlacement *bool `json:"supportAutomaticPlacement,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgrouppropertiesadditionalcapabilities.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgrouppropertiesadditionalcapabilities.go new file mode 100644 index 00000000000..296a2f029f4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgrouppropertiesadditionalcapabilities.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupPropertiesAdditionalCapabilities struct { + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go new file mode 100644 index 00000000000..dfa7c88e18e --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go @@ -0,0 +1,14 @@ +package dedicatedhostgroups + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupUpdate struct { + Properties *DedicatedHostGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go new file mode 100644 index 00000000000..e8c32278760 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go @@ -0,0 +1,11 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostInstanceViewWithName struct { + AssetId *string `json:"assetId,omitempty"` + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_instanceviewstatus.go new file mode 100644 index 00000000000..74b66b61bc6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package dedicatedhostgroups + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_subresourcereadonly.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_subresourcereadonly.go new file mode 100644 index 00000000000..9c5ae8726a8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhostgroups/predicates.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/predicates.go new file mode 100644 index 00000000000..de1da527708 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/predicates.go @@ -0,0 +1,32 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DedicatedHostGroupOperationPredicate) Matches(input DedicatedHostGroup) 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/resource-manager/compute/2025-04-01/dedicatedhostgroups/version.go b/resource-manager/compute/2025-04-01/dedicatedhostgroups/version.go new file mode 100644 index 00000000000..46f3ba48ff6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhostgroups/version.go @@ -0,0 +1,10 @@ +package dedicatedhostgroups + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/dedicatedhostgroups/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/README.md b/resource-manager/compute/2025-04-01/dedicatedhosts/README.md new file mode 100644 index 00000000000..0307698e90d --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/README.md @@ -0,0 +1,141 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/dedicatedhosts` Documentation + +The `dedicatedhosts` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/dedicatedhosts" +``` + + +### Client Initialization + +```go +client := dedicatedhosts.NewDedicatedHostsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DedicatedHostsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +payload := dedicatedhosts.DedicatedHost{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHostsClient.Delete` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHostsClient.Get` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +read, err := client.Get(ctx, id, dedicatedhosts.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostsClient.ListAvailableSizes` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +// alternatively `client.ListAvailableSizes(ctx, id)` can be used to do batched pagination +items, err := client.ListAvailableSizesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHostsClient.ListByHostGroup` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +// alternatively `client.ListByHostGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByHostGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHostsClient.Redeploy` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +if err := client.RedeployThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHostsClient.Restart` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHostsClient.Update` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +payload := dedicatedhosts.DedicatedHostUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/client.go b/resource-manager/compute/2025-04-01/dedicatedhosts/client.go new file mode 100644 index 00000000000..1f5bf6278f7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/client.go @@ -0,0 +1,26 @@ +package dedicatedhosts + +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 DedicatedHostsClient struct { + Client *resourcemanager.Client +} + +func NewDedicatedHostsClientWithBaseURI(sdkApi sdkEnv.Api) (*DedicatedHostsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dedicatedhosts", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DedicatedHostsClient: %+v", err) + } + + return &DedicatedHostsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/constants.go b/resource-manager/compute/2025-04-01/dedicatedhosts/constants.go new file mode 100644 index 00000000000..8cacf128573 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/constants.go @@ -0,0 +1,142 @@ +package dedicatedhosts + +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 DedicatedHostLicenseTypes string + +const ( + DedicatedHostLicenseTypesNone DedicatedHostLicenseTypes = "None" + DedicatedHostLicenseTypesWindowsServerHybrid DedicatedHostLicenseTypes = "Windows_Server_Hybrid" + DedicatedHostLicenseTypesWindowsServerPerpetual DedicatedHostLicenseTypes = "Windows_Server_Perpetual" +) + +func PossibleValuesForDedicatedHostLicenseTypes() []string { + return []string{ + string(DedicatedHostLicenseTypesNone), + string(DedicatedHostLicenseTypesWindowsServerHybrid), + string(DedicatedHostLicenseTypesWindowsServerPerpetual), + } +} + +func (s *DedicatedHostLicenseTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDedicatedHostLicenseTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDedicatedHostLicenseTypes(input string) (*DedicatedHostLicenseTypes, error) { + vals := map[string]DedicatedHostLicenseTypes{ + "none": DedicatedHostLicenseTypesNone, + "windows_server_hybrid": DedicatedHostLicenseTypesWindowsServerHybrid, + "windows_server_perpetual": DedicatedHostLicenseTypesWindowsServerPerpetual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DedicatedHostLicenseTypes(input) + return &out, nil +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesResiliencyView InstanceViewTypes = "resiliencyView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesResiliencyView), + string(InstanceViewTypesUserData), + } +} + +func (s *InstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "resiliencyview": InstanceViewTypesResiliencyView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/method_createorupdate.go b/resource-manager/compute/2025-04-01/dedicatedhosts/method_createorupdate.go new file mode 100644 index 00000000000..f60b2b8c65f --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/method_createorupdate.go @@ -0,0 +1,76 @@ +package dedicatedhosts + +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/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 *DedicatedHost +} + +// CreateOrUpdate ... +func (c DedicatedHostsClient) CreateOrUpdate(ctx context.Context, id commonids.DedicatedHostId, input DedicatedHost) (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 DedicatedHostsClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.DedicatedHostId, input DedicatedHost) 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/resource-manager/compute/2025-04-01/dedicatedhosts/method_delete.go b/resource-manager/compute/2025-04-01/dedicatedhosts/method_delete.go new file mode 100644 index 00000000000..fa479498bbe --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/method_delete.go @@ -0,0 +1,72 @@ +package dedicatedhosts + +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/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 DedicatedHostsClient) Delete(ctx context.Context, id commonids.DedicatedHostId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DedicatedHostsClient) DeleteThenPoll(ctx context.Context, id commonids.DedicatedHostId) 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/resource-manager/compute/2025-04-01/dedicatedhosts/method_get.go b/resource-manager/compute/2025-04-01/dedicatedhosts/method_get.go new file mode 100644 index 00000000000..ae7a03232ad --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/method_get.go @@ -0,0 +1,84 @@ +package dedicatedhosts + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHost +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c DedicatedHostsClient) Get(ctx context.Context, id commonids.DedicatedHostId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 DedicatedHost + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/method_listavailablesizes.go b/resource-manager/compute/2025-04-01/dedicatedhosts/method_listavailablesizes.go new file mode 100644 index 00000000000..7670314212a --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/method_listavailablesizes.go @@ -0,0 +1,99 @@ +package dedicatedhosts + +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 ListAvailableSizesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]string +} + +type ListAvailableSizesCompleteResult struct { + LatestHttpResponse *http.Response + Items []string +} + +type ListAvailableSizesCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListAvailableSizesCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListAvailableSizes ... +func (c DedicatedHostsClient) ListAvailableSizes(ctx context.Context, id commonids.DedicatedHostId) (result ListAvailableSizesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListAvailableSizesCustomPager{}, + Path: fmt.Sprintf("%s/hostSizes", 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 *[]string `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAvailableSizesComplete retrieves all the results into a single object +func (c DedicatedHostsClient) ListAvailableSizesComplete(ctx context.Context, id commonids.DedicatedHostId) (result ListAvailableSizesCompleteResult, err error) { + items := make([]string, 0) + + resp, err := c.ListAvailableSizes(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 { + items = append(items, v) + } + } + + result = ListAvailableSizesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/method_listbyhostgroup.go b/resource-manager/compute/2025-04-01/dedicatedhosts/method_listbyhostgroup.go new file mode 100644 index 00000000000..bca1b6e608a --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/method_listbyhostgroup.go @@ -0,0 +1,106 @@ +package dedicatedhosts + +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 ListByHostGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DedicatedHost +} + +type ListByHostGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []DedicatedHost +} + +type ListByHostGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByHostGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByHostGroup ... +func (c DedicatedHostsClient) ListByHostGroup(ctx context.Context, id commonids.DedicatedHostGroupId) (result ListByHostGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByHostGroupCustomPager{}, + Path: fmt.Sprintf("%s/hosts", 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 *[]DedicatedHost `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByHostGroupComplete retrieves all the results into a single object +func (c DedicatedHostsClient) ListByHostGroupComplete(ctx context.Context, id commonids.DedicatedHostGroupId) (ListByHostGroupCompleteResult, error) { + return c.ListByHostGroupCompleteMatchingPredicate(ctx, id, DedicatedHostOperationPredicate{}) +} + +// ListByHostGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DedicatedHostsClient) ListByHostGroupCompleteMatchingPredicate(ctx context.Context, id commonids.DedicatedHostGroupId, predicate DedicatedHostOperationPredicate) (result ListByHostGroupCompleteResult, err error) { + items := make([]DedicatedHost, 0) + + resp, err := c.ListByHostGroup(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 = ListByHostGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/method_redeploy.go b/resource-manager/compute/2025-04-01/dedicatedhosts/method_redeploy.go new file mode 100644 index 00000000000..4d69de0ebac --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/method_redeploy.go @@ -0,0 +1,70 @@ +package dedicatedhosts + +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/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 RedeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Redeploy ... +func (c DedicatedHostsClient) Redeploy(ctx context.Context, id commonids.DedicatedHostId) (result RedeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/redeploy", 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 +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c DedicatedHostsClient) RedeployThenPoll(ctx context.Context, id commonids.DedicatedHostId) error { + result, err := c.Redeploy(ctx, id) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/method_restart.go b/resource-manager/compute/2025-04-01/dedicatedhosts/method_restart.go new file mode 100644 index 00000000000..c59e6b5a26a --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/method_restart.go @@ -0,0 +1,70 @@ +package dedicatedhosts + +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/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 RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c DedicatedHostsClient) Restart(ctx context.Context, id commonids.DedicatedHostId) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c DedicatedHostsClient) RestartThenPoll(ctx context.Context, id commonids.DedicatedHostId) error { + result, err := c.Restart(ctx, id) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/method_update.go b/resource-manager/compute/2025-04-01/dedicatedhosts/method_update.go new file mode 100644 index 00000000000..6d289567e58 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/method_update.go @@ -0,0 +1,75 @@ +package dedicatedhosts + +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/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 *DedicatedHost +} + +// Update ... +func (c DedicatedHostsClient) Update(ctx context.Context, id commonids.DedicatedHostId, input DedicatedHostUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c DedicatedHostsClient) UpdateThenPoll(ctx context.Context, id commonids.DedicatedHostId, input DedicatedHostUpdate) 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/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhost.go b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhost.go new file mode 100644 index 00000000000..91e0593c3e6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhost.go @@ -0,0 +1,19 @@ +package dedicatedhosts + +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 DedicatedHost struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DedicatedHostProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostallocatablevm.go b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostallocatablevm.go new file mode 100644 index 00000000000..9b56e28f2ff --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostallocatablevm.go @@ -0,0 +1,9 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAllocatableVM struct { + Count *float64 `json:"count,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go new file mode 100644 index 00000000000..4a815b0460c --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go @@ -0,0 +1,8 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAvailableCapacity struct { + AllocatableVMs *[]DedicatedHostAllocatableVM `json:"allocatableVMs,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostinstanceview.go b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostinstanceview.go new file mode 100644 index 00000000000..7574083ca0d --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostinstanceview.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostInstanceView struct { + AssetId *string `json:"assetId,omitempty"` + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostproperties.go b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostproperties.go new file mode 100644 index 00000000000..067483736a4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostproperties.go @@ -0,0 +1,46 @@ +package dedicatedhosts + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostProperties struct { + AutoReplaceOnFailure *bool `json:"autoReplaceOnFailure,omitempty"` + HostId *string `json:"hostId,omitempty"` + InstanceView *DedicatedHostInstanceView `json:"instanceView,omitempty"` + LicenseType *DedicatedHostLicenseTypes `json:"licenseType,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProvisioningTime *string `json:"provisioningTime,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + VirtualMachines *[]SubResourceReadOnly `json:"virtualMachines,omitempty"` +} + +func (o *DedicatedHostProperties) GetProvisioningTimeAsTime() (*time.Time, error) { + if o.ProvisioningTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *DedicatedHostProperties) SetProvisioningTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningTime = &formatted +} + +func (o *DedicatedHostProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *DedicatedHostProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostupdate.go b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostupdate.go new file mode 100644 index 00000000000..987da669393 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/model_dedicatedhostupdate.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostUpdate struct { + Properties *DedicatedHostProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/dedicatedhosts/model_instanceviewstatus.go new file mode 100644 index 00000000000..fe3a89546ec --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package dedicatedhosts + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/model_sku.go b/resource-manager/compute/2025-04-01/dedicatedhosts/model_sku.go new file mode 100644 index 00000000000..ce3dda6ffbe --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/model_sku.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/model_subresourcereadonly.go b/resource-manager/compute/2025-04-01/dedicatedhosts/model_subresourcereadonly.go new file mode 100644 index 00000000000..91dea24f8e1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/dedicatedhosts/predicates.go b/resource-manager/compute/2025-04-01/dedicatedhosts/predicates.go new file mode 100644 index 00000000000..e76a98eb7c4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/predicates.go @@ -0,0 +1,32 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DedicatedHostOperationPredicate) Matches(input DedicatedHost) 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/resource-manager/compute/2025-04-01/dedicatedhosts/version.go b/resource-manager/compute/2025-04-01/dedicatedhosts/version.go new file mode 100644 index 00000000000..75ce434a567 --- /dev/null +++ b/resource-manager/compute/2025-04-01/dedicatedhosts/version.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/dedicatedhosts/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/images/README.md b/resource-manager/compute/2025-04-01/images/README.md new file mode 100644 index 00000000000..8adf1cd1323 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/images` Documentation + +The `images` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/images" +``` + + +### Client Initialization + +```go +client := images.NewImagesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ImagesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := images.NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + +payload := images.Image{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ImagesClient.Delete` + +```go +ctx := context.TODO() +id := images.NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ImagesClient.Get` + +```go +ctx := context.TODO() +id := images.NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + +read, err := client.Get(ctx, id, images.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ImagesClient.List` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ImagesClient.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: `ImagesClient.Update` + +```go +ctx := context.TODO() +id := images.NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + +payload := images.ImageUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/images/client.go b/resource-manager/compute/2025-04-01/images/client.go new file mode 100644 index 00000000000..1732ff32057 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/client.go @@ -0,0 +1,26 @@ +package images + +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 ImagesClient struct { + Client *resourcemanager.Client +} + +func NewImagesClientWithBaseURI(sdkApi sdkEnv.Api) (*ImagesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "images", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ImagesClient: %+v", err) + } + + return &ImagesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/images/constants.go b/resource-manager/compute/2025-04-01/images/constants.go new file mode 100644 index 00000000000..5853a41b563 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/constants.go @@ -0,0 +1,233 @@ +package images + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type HyperVGenerationTypes string + +const ( + HyperVGenerationTypesVOne HyperVGenerationTypes = "V1" + HyperVGenerationTypesVTwo HyperVGenerationTypes = "V2" +) + +func PossibleValuesForHyperVGenerationTypes() []string { + return []string{ + string(HyperVGenerationTypesVOne), + string(HyperVGenerationTypesVTwo), + } +} + +func (s *HyperVGenerationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationTypes(input string) (*HyperVGenerationTypes, error) { + vals := map[string]HyperVGenerationTypes{ + "v1": HyperVGenerationTypesVOne, + "v2": HyperVGenerationTypesVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationTypes(input) + return &out, nil +} + +type OperatingSystemStateTypes string + +const ( + OperatingSystemStateTypesGeneralized OperatingSystemStateTypes = "Generalized" + OperatingSystemStateTypesSpecialized OperatingSystemStateTypes = "Specialized" +) + +func PossibleValuesForOperatingSystemStateTypes() []string { + return []string{ + string(OperatingSystemStateTypesGeneralized), + string(OperatingSystemStateTypesSpecialized), + } +} + +func (s *OperatingSystemStateTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemStateTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemStateTypes(input string) (*OperatingSystemStateTypes, error) { + vals := map[string]OperatingSystemStateTypes{ + "generalized": OperatingSystemStateTypesGeneralized, + "specialized": OperatingSystemStateTypesSpecialized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemStateTypes(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/images/id_image.go b/resource-manager/compute/2025-04-01/images/id_image.go new file mode 100644 index 00000000000..1ea81358052 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/id_image.go @@ -0,0 +1,130 @@ +package images + +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(&ImageId{}) +} + +var _ resourceids.ResourceId = &ImageId{} + +// ImageId is a struct representing the Resource ID for a Image +type ImageId struct { + SubscriptionId string + ResourceGroupName string + ImageName string +} + +// NewImageID returns a new ImageId struct +func NewImageID(subscriptionId string, resourceGroupName string, imageName string) ImageId { + return ImageId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ImageName: imageName, + } +} + +// ParseImageID parses 'input' into a ImageId +func ParseImageID(input string) (*ImageId, error) { + parser := resourceids.NewParserFromResourceIdType(&ImageId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ImageId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseImageIDInsensitively parses 'input' case-insensitively into a ImageId +// note: this method should only be used for API response data and not user input +func ParseImageIDInsensitively(input string) (*ImageId, error) { + parser := resourceids.NewParserFromResourceIdType(&ImageId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ImageId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImageId) 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.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) + } + + return nil +} + +// ValidateImageID checks that 'input' can be parsed as a Image ID +func ValidateImageID(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 := ParseImageID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Image ID +func (id ImageId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/images/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ImageName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Image ID +func (id ImageId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticImages", "images", "images"), + resourceids.UserSpecifiedSegment("imageName", "imageName"), + } +} + +// String returns a human-readable description of this Image ID +func (id ImageId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Image Name: %q", id.ImageName), + } + return fmt.Sprintf("Image (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/images/id_image_test.go b/resource-manager/compute/2025-04-01/images/id_image_test.go new file mode 100644 index 00000000000..b3214493513 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/id_image_test.go @@ -0,0 +1,282 @@ +package images + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ImageId{} + +func TestNewImageID(t *testing.T) { + id := NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ImageName != "imageName" { + t.Fatalf("Expected %q but got %q for Segment 'ImageName'", id.ImageName, "imageName") + } +} + +func TestFormatImageID(t *testing.T) { + actual := NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseImageID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ImageId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName", + Expected: &ImageId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ImageName: "imageName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseImageID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ImageName != v.Expected.ImageName { + t.Fatalf("Expected %q but got %q for ImageName", v.Expected.ImageName, actual.ImageName) + } + + } +} + +func TestParseImageIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ImageId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/iMaGeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName", + Expected: &ImageId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ImageName: "imageName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/iMaGeS/iMaGeNaMe", + Expected: &ImageId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ImageName: "iMaGeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/iMaGeS/iMaGeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseImageIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ImageName != v.Expected.ImageName { + t.Fatalf("Expected %q but got %q for ImageName", v.Expected.ImageName, actual.ImageName) + } + + } +} + +func TestSegmentsForImageId(t *testing.T) { + segments := ImageId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ImageId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/images/method_createorupdate.go b/resource-manager/compute/2025-04-01/images/method_createorupdate.go new file mode 100644 index 00000000000..58619868542 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/method_createorupdate.go @@ -0,0 +1,75 @@ +package images + +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 *Image +} + +// CreateOrUpdate ... +func (c ImagesClient) CreateOrUpdate(ctx context.Context, id ImageId, input Image) (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 ImagesClient) CreateOrUpdateThenPoll(ctx context.Context, id ImageId, input Image) 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/resource-manager/compute/2025-04-01/images/method_delete.go b/resource-manager/compute/2025-04-01/images/method_delete.go new file mode 100644 index 00000000000..c16dbfc84c5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/method_delete.go @@ -0,0 +1,71 @@ +package images + +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 ImagesClient) Delete(ctx context.Context, id ImageId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ImagesClient) DeleteThenPoll(ctx context.Context, id ImageId) 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/resource-manager/compute/2025-04-01/images/method_get.go b/resource-manager/compute/2025-04-01/images/method_get.go new file mode 100644 index 00000000000..e68f9e933bb --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/method_get.go @@ -0,0 +1,83 @@ +package images + +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 *Image +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c ImagesClient) Get(ctx context.Context, id ImageId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 Image + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/images/method_list.go b/resource-manager/compute/2025-04-01/images/method_list.go new file mode 100644 index 00000000000..9a78161d8aa --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/method_list.go @@ -0,0 +1,106 @@ +package images + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Image +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Image +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c ImagesClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/images", 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 *[]Image `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ImagesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ImageOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ImagesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ImageOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Image, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/images/method_listbyresourcegroup.go b/resource-manager/compute/2025-04-01/images/method_listbyresourcegroup.go new file mode 100644 index 00000000000..3026c68a08f --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package images + +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 *[]Image +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Image +} + +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 ImagesClient) 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.Compute/images", 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 *[]Image `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 ImagesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ImageOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ImagesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ImageOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Image, 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/resource-manager/compute/2025-04-01/images/method_update.go b/resource-manager/compute/2025-04-01/images/method_update.go new file mode 100644 index 00000000000..4c98d0bf0d0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/method_update.go @@ -0,0 +1,75 @@ +package images + +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 *Image +} + +// Update ... +func (c ImagesClient) Update(ctx context.Context, id ImageId, input ImageUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + 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 ImagesClient) UpdateThenPoll(ctx context.Context, id ImageId, input ImageUpdate) 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/resource-manager/compute/2025-04-01/images/model_image.go b/resource-manager/compute/2025-04-01/images/model_image.go new file mode 100644 index 00000000000..caaa5783bb0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/model_image.go @@ -0,0 +1,20 @@ +package images + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" + "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 Image struct { + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ImageProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/images/model_imagedatadisk.go b/resource-manager/compute/2025-04-01/images/model_imagedatadisk.go new file mode 100644 index 00000000000..10ac758fce6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/model_imagedatadisk.go @@ -0,0 +1,15 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageDataDisk struct { + BlobUri *string `json:"blobUri,omitempty"` + Caching *CachingTypes `json:"caching,omitempty"` + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + Snapshot *SubResource `json:"snapshot,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/images/model_imageosdisk.go b/resource-manager/compute/2025-04-01/images/model_imageosdisk.go new file mode 100644 index 00000000000..8bfa64c5ce8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/model_imageosdisk.go @@ -0,0 +1,16 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageOSDisk struct { + BlobUri *string `json:"blobUri,omitempty"` + Caching *CachingTypes `json:"caching,omitempty"` + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + OsState OperatingSystemStateTypes `json:"osState"` + OsType OperatingSystemTypes `json:"osType"` + Snapshot *SubResource `json:"snapshot,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/images/model_imageproperties.go b/resource-manager/compute/2025-04-01/images/model_imageproperties.go new file mode 100644 index 00000000000..38a45c0e091 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/model_imageproperties.go @@ -0,0 +1,11 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageProperties struct { + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` + StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/images/model_imagestorageprofile.go b/resource-manager/compute/2025-04-01/images/model_imagestorageprofile.go new file mode 100644 index 00000000000..2629dfc3475 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/model_imagestorageprofile.go @@ -0,0 +1,10 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageStorageProfile struct { + DataDisks *[]ImageDataDisk `json:"dataDisks,omitempty"` + OsDisk *ImageOSDisk `json:"osDisk,omitempty"` + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/images/model_imageupdate.go b/resource-manager/compute/2025-04-01/images/model_imageupdate.go new file mode 100644 index 00000000000..1fb6b4c2c5c --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/model_imageupdate.go @@ -0,0 +1,9 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageUpdate struct { + Properties *ImageProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/images/model_subresource.go b/resource-manager/compute/2025-04-01/images/model_subresource.go new file mode 100644 index 00000000000..8ca624bc417 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/model_subresource.go @@ -0,0 +1,8 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/images/predicates.go b/resource-manager/compute/2025-04-01/images/predicates.go new file mode 100644 index 00000000000..7d036d2c839 --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/predicates.go @@ -0,0 +1,32 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ImageOperationPredicate) Matches(input Image) 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/resource-manager/compute/2025-04-01/images/version.go b/resource-manager/compute/2025-04-01/images/version.go new file mode 100644 index 00000000000..53993ab524d --- /dev/null +++ b/resource-manager/compute/2025-04-01/images/version.go @@ -0,0 +1,10 @@ +package images + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/images/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/README.md b/resource-manager/compute/2025-04-01/proximityplacementgroups/README.md new file mode 100644 index 00000000000..b15840b7667 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/README.md @@ -0,0 +1,129 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/proximityplacementgroups` Documentation + +The `proximityplacementgroups` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/proximityplacementgroups" +``` + + +### Client Initialization + +```go +client := proximityplacementgroups.NewProximityPlacementGroupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProximityPlacementGroupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + +payload := proximityplacementgroups.ProximityPlacementGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.Delete` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.Get` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + +read, err := client.Get(ctx, id, proximityplacementgroups.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.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: `ProximityPlacementGroupsClient.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: `ProximityPlacementGroupsClient.Update` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + +payload := proximityplacementgroups.UpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/client.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/client.go new file mode 100644 index 00000000000..1a6cf3adbc3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/client.go @@ -0,0 +1,26 @@ +package proximityplacementgroups + +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 ProximityPlacementGroupsClient struct { + Client *resourcemanager.Client +} + +func NewProximityPlacementGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*ProximityPlacementGroupsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "proximityplacementgroups", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProximityPlacementGroupsClient: %+v", err) + } + + return &ProximityPlacementGroupsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/constants.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/constants.go new file mode 100644 index 00000000000..7515ef8b9d7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/constants.go @@ -0,0 +1,95 @@ +package proximityplacementgroups + +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 ProximityPlacementGroupType string + +const ( + ProximityPlacementGroupTypeStandard ProximityPlacementGroupType = "Standard" + ProximityPlacementGroupTypeUltra ProximityPlacementGroupType = "Ultra" +) + +func PossibleValuesForProximityPlacementGroupType() []string { + return []string{ + string(ProximityPlacementGroupTypeStandard), + string(ProximityPlacementGroupTypeUltra), + } +} + +func (s *ProximityPlacementGroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProximityPlacementGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProximityPlacementGroupType(input string) (*ProximityPlacementGroupType, error) { + vals := map[string]ProximityPlacementGroupType{ + "standard": ProximityPlacementGroupTypeStandard, + "ultra": ProximityPlacementGroupTypeUltra, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProximityPlacementGroupType(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/id_proximityplacementgroup.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/id_proximityplacementgroup.go new file mode 100644 index 00000000000..0f46e6f2844 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/id_proximityplacementgroup.go @@ -0,0 +1,130 @@ +package proximityplacementgroups + +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(&ProximityPlacementGroupId{}) +} + +var _ resourceids.ResourceId = &ProximityPlacementGroupId{} + +// ProximityPlacementGroupId is a struct representing the Resource ID for a Proximity Placement Group +type ProximityPlacementGroupId struct { + SubscriptionId string + ResourceGroupName string + ProximityPlacementGroupName string +} + +// NewProximityPlacementGroupID returns a new ProximityPlacementGroupId struct +func NewProximityPlacementGroupID(subscriptionId string, resourceGroupName string, proximityPlacementGroupName string) ProximityPlacementGroupId { + return ProximityPlacementGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProximityPlacementGroupName: proximityPlacementGroupName, + } +} + +// ParseProximityPlacementGroupID parses 'input' into a ProximityPlacementGroupId +func ParseProximityPlacementGroupID(input string) (*ProximityPlacementGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProximityPlacementGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProximityPlacementGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProximityPlacementGroupIDInsensitively parses 'input' case-insensitively into a ProximityPlacementGroupId +// note: this method should only be used for API response data and not user input +func ParseProximityPlacementGroupIDInsensitively(input string) (*ProximityPlacementGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProximityPlacementGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProximityPlacementGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProximityPlacementGroupId) 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.ProximityPlacementGroupName, ok = input.Parsed["proximityPlacementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", input) + } + + return nil +} + +// ValidateProximityPlacementGroupID checks that 'input' can be parsed as a Proximity Placement Group ID +func ValidateProximityPlacementGroupID(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 := ParseProximityPlacementGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Proximity Placement Group ID +func (id ProximityPlacementGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/proximityPlacementGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProximityPlacementGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Proximity Placement Group ID +func (id ProximityPlacementGroupId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticProximityPlacementGroups", "proximityPlacementGroups", "proximityPlacementGroups"), + resourceids.UserSpecifiedSegment("proximityPlacementGroupName", "proximityPlacementGroupName"), + } +} + +// String returns a human-readable description of this Proximity Placement Group ID +func (id ProximityPlacementGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Proximity Placement Group Name: %q", id.ProximityPlacementGroupName), + } + return fmt.Sprintf("Proximity Placement Group (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/id_proximityplacementgroup_test.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/id_proximityplacementgroup_test.go new file mode 100644 index 00000000000..726fe9b2288 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/id_proximityplacementgroup_test.go @@ -0,0 +1,282 @@ +package proximityplacementgroups + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ProximityPlacementGroupId{} + +func TestNewProximityPlacementGroupID(t *testing.T) { + id := NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ProximityPlacementGroupName != "proximityPlacementGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'ProximityPlacementGroupName'", id.ProximityPlacementGroupName, "proximityPlacementGroupName") + } +} + +func TestFormatProximityPlacementGroupID(t *testing.T) { + actual := NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseProximityPlacementGroupID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProximityPlacementGroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName", + Expected: &ProximityPlacementGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ProximityPlacementGroupName: "proximityPlacementGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProximityPlacementGroupID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ProximityPlacementGroupName != v.Expected.ProximityPlacementGroupName { + t.Fatalf("Expected %q but got %q for ProximityPlacementGroupName", v.Expected.ProximityPlacementGroupName, actual.ProximityPlacementGroupName) + } + + } +} + +func TestParseProximityPlacementGroupIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProximityPlacementGroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/pRoXiMiTyPlAcEmEnTgRoUpS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName", + Expected: &ProximityPlacementGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ProximityPlacementGroupName: "proximityPlacementGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/pRoXiMiTyPlAcEmEnTgRoUpS/pRoXiMiTyPlAcEmEnTgRoUpNaMe", + Expected: &ProximityPlacementGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ProximityPlacementGroupName: "pRoXiMiTyPlAcEmEnTgRoUpNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/pRoXiMiTyPlAcEmEnTgRoUpS/pRoXiMiTyPlAcEmEnTgRoUpNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProximityPlacementGroupIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ProximityPlacementGroupName != v.Expected.ProximityPlacementGroupName { + t.Fatalf("Expected %q but got %q for ProximityPlacementGroupName", v.Expected.ProximityPlacementGroupName, actual.ProximityPlacementGroupName) + } + + } +} + +func TestSegmentsForProximityPlacementGroupId(t *testing.T) { + segments := ProximityPlacementGroupId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ProximityPlacementGroupId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/method_createorupdate.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_createorupdate.go new file mode 100644 index 00000000000..b52985d0f6c --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_createorupdate.go @@ -0,0 +1,58 @@ +package proximityplacementgroups + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProximityPlacementGroup +} + +// CreateOrUpdate ... +func (c ProximityPlacementGroupsClient) CreateOrUpdate(ctx context.Context, id ProximityPlacementGroupId, input ProximityPlacementGroup) (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 + } + + var model ProximityPlacementGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/method_delete.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_delete.go new file mode 100644 index 00000000000..a299e26f62a --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_delete.go @@ -0,0 +1,46 @@ +package proximityplacementgroups + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ProximityPlacementGroupsClient) Delete(ctx context.Context, id ProximityPlacementGroupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/method_get.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_get.go new file mode 100644 index 00000000000..9319acd4f9b --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_get.go @@ -0,0 +1,83 @@ +package proximityplacementgroups + +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 *ProximityPlacementGroup +} + +type GetOperationOptions struct { + IncludeColocationStatus *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IncludeColocationStatus != nil { + out.Append("includeColocationStatus", fmt.Sprintf("%v", *o.IncludeColocationStatus)) + } + return &out +} + +// Get ... +func (c ProximityPlacementGroupsClient) Get(ctx context.Context, id ProximityPlacementGroupId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 ProximityPlacementGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/method_listbyresourcegroup.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_listbyresourcegroup.go new file mode 100644 index 00000000000..1a30eaa36b4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package proximityplacementgroups + +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 *[]ProximityPlacementGroup +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ProximityPlacementGroup +} + +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 ProximityPlacementGroupsClient) 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.Compute/proximityPlacementGroups", 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 *[]ProximityPlacementGroup `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 ProximityPlacementGroupsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ProximityPlacementGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProximityPlacementGroupsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ProximityPlacementGroupOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ProximityPlacementGroup, 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/resource-manager/compute/2025-04-01/proximityplacementgroups/method_listbysubscription.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_listbysubscription.go new file mode 100644 index 00000000000..6cc0adf42da --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_listbysubscription.go @@ -0,0 +1,106 @@ +package proximityplacementgroups + +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 *[]ProximityPlacementGroup +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []ProximityPlacementGroup +} + +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 ProximityPlacementGroupsClient) 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.Compute/proximityPlacementGroups", 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 *[]ProximityPlacementGroup `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 ProximityPlacementGroupsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ProximityPlacementGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProximityPlacementGroupsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ProximityPlacementGroupOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ProximityPlacementGroup, 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/resource-manager/compute/2025-04-01/proximityplacementgroups/method_update.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_update.go new file mode 100644 index 00000000000..dd8d1e3003a --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/method_update.go @@ -0,0 +1,57 @@ +package proximityplacementgroups + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProximityPlacementGroup +} + +// Update ... +func (c ProximityPlacementGroupsClient) Update(ctx context.Context, id ProximityPlacementGroupId, input UpdateResource) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ProximityPlacementGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_instanceviewstatus.go new file mode 100644 index 00000000000..3b148b1d660 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package proximityplacementgroups + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/model_proximityplacementgroup.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_proximityplacementgroup.go new file mode 100644 index 00000000000..7ca136d44b6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_proximityplacementgroup.go @@ -0,0 +1,20 @@ +package proximityplacementgroups + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroup struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ProximityPlacementGroupProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/model_proximityplacementgroupproperties.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_proximityplacementgroupproperties.go new file mode 100644 index 00000000000..0c200d2620e --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_proximityplacementgroupproperties.go @@ -0,0 +1,13 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroupProperties struct { + AvailabilitySets *[]SubResourceWithColocationStatus `json:"availabilitySets,omitempty"` + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + Intent *ProximityPlacementGroupPropertiesIntent `json:"intent,omitempty"` + ProximityPlacementGroupType *ProximityPlacementGroupType `json:"proximityPlacementGroupType,omitempty"` + VirtualMachineScaleSets *[]SubResourceWithColocationStatus `json:"virtualMachineScaleSets,omitempty"` + VirtualMachines *[]SubResourceWithColocationStatus `json:"virtualMachines,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/model_proximityplacementgrouppropertiesintent.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_proximityplacementgrouppropertiesintent.go new file mode 100644 index 00000000000..d159d0d2847 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_proximityplacementgrouppropertiesintent.go @@ -0,0 +1,8 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroupPropertiesIntent struct { + VMSizes *[]string `json:"vmSizes,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go new file mode 100644 index 00000000000..a6c493baa63 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go @@ -0,0 +1,9 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceWithColocationStatus struct { + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/model_updateresource.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_updateresource.go new file mode 100644 index 00000000000..0c63bc1293b --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/model_updateresource.go @@ -0,0 +1,8 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/proximityplacementgroups/predicates.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/predicates.go new file mode 100644 index 00000000000..3e0bc38e4a2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/predicates.go @@ -0,0 +1,32 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ProximityPlacementGroupOperationPredicate) Matches(input ProximityPlacementGroup) 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/resource-manager/compute/2025-04-01/proximityplacementgroups/version.go b/resource-manager/compute/2025-04-01/proximityplacementgroups/version.go new file mode 100644 index 00000000000..8b71f52f62a --- /dev/null +++ b/resource-manager/compute/2025-04-01/proximityplacementgroups/version.go @@ -0,0 +1,10 @@ +package proximityplacementgroups + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/proximityplacementgroups/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/README.md b/resource-manager/compute/2025-04-01/restorepointcollections/README.md new file mode 100644 index 00000000000..24d71c2c451 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/README.md @@ -0,0 +1,125 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/restorepointcollections` Documentation + +The `restorepointcollections` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/restorepointcollections" +``` + + +### Client Initialization + +```go +client := restorepointcollections.NewRestorePointCollectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RestorePointCollectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := restorepointcollections.NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + +payload := restorepointcollections.RestorePointCollection{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RestorePointCollectionsClient.Delete` + +```go +ctx := context.TODO() +id := restorepointcollections.NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RestorePointCollectionsClient.Get` + +```go +ctx := context.TODO() +id := restorepointcollections.NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + +read, err := client.Get(ctx, id, restorepointcollections.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RestorePointCollectionsClient.List` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RestorePointCollectionsClient.ListAll` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListAll(ctx, id)` can be used to do batched pagination +items, err := client.ListAllComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RestorePointCollectionsClient.Update` + +```go +ctx := context.TODO() +id := restorepointcollections.NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + +payload := restorepointcollections.RestorePointCollectionUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/client.go b/resource-manager/compute/2025-04-01/restorepointcollections/client.go new file mode 100644 index 00000000000..543d327725d --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/client.go @@ -0,0 +1,26 @@ +package restorepointcollections + +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 RestorePointCollectionsClient struct { + Client *resourcemanager.Client +} + +func NewRestorePointCollectionsClientWithBaseURI(sdkApi sdkEnv.Api) (*RestorePointCollectionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "restorepointcollections", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RestorePointCollectionsClient: %+v", err) + } + + return &RestorePointCollectionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/constants.go b/resource-manager/compute/2025-04-01/restorepointcollections/constants.go new file mode 100644 index 00000000000..1483a33c1f6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/constants.go @@ -0,0 +1,1575 @@ +package restorepointcollections + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentName string + +const ( + ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentName = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentName() []string { + return []string{ + string(ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentName(input string) (*ComponentName, error) { + vals := map[string]ComponentName{ + "microsoft-windows-shell-setup": ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentName(input) + return &out, nil +} + +type ConsistencyModeTypes string + +const ( + ConsistencyModeTypesApplicationConsistent ConsistencyModeTypes = "ApplicationConsistent" + ConsistencyModeTypesCrashConsistent ConsistencyModeTypes = "CrashConsistent" + ConsistencyModeTypesFileSystemConsistent ConsistencyModeTypes = "FileSystemConsistent" +) + +func PossibleValuesForConsistencyModeTypes() []string { + return []string{ + string(ConsistencyModeTypesApplicationConsistent), + string(ConsistencyModeTypesCrashConsistent), + string(ConsistencyModeTypesFileSystemConsistent), + } +} + +func (s *ConsistencyModeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConsistencyModeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConsistencyModeTypes(input string) (*ConsistencyModeTypes, error) { + vals := map[string]ConsistencyModeTypes{ + "applicationconsistent": ConsistencyModeTypesApplicationConsistent, + "crashconsistent": ConsistencyModeTypesCrashConsistent, + "filesystemconsistent": ConsistencyModeTypesFileSystemConsistent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConsistencyModeTypes(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type HyperVGenerationTypes string + +const ( + HyperVGenerationTypesVOne HyperVGenerationTypes = "V1" + HyperVGenerationTypesVTwo HyperVGenerationTypes = "V2" +) + +func PossibleValuesForHyperVGenerationTypes() []string { + return []string{ + string(HyperVGenerationTypesVOne), + string(HyperVGenerationTypesVTwo), + } +} + +func (s *HyperVGenerationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationTypes(input string) (*HyperVGenerationTypes, error) { + vals := map[string]HyperVGenerationTypes{ + "v1": HyperVGenerationTypesVOne, + "v2": HyperVGenerationTypesVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationTypes(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type OperatingSystemType string + +const ( + OperatingSystemTypeLinux OperatingSystemType = "Linux" + OperatingSystemTypeWindows OperatingSystemType = "Windows" +) + +func PossibleValuesForOperatingSystemType() []string { + return []string{ + string(OperatingSystemTypeLinux), + string(OperatingSystemTypeWindows), + } +} + +func (s *OperatingSystemType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemType(input string) (*OperatingSystemType, error) { + vals := map[string]OperatingSystemType{ + "linux": OperatingSystemTypeLinux, + "windows": OperatingSystemTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemType(input) + return &out, nil +} + +type PassName string + +const ( + PassNameOobeSystem PassName = "OobeSystem" +) + +func PossibleValuesForPassName() []string { + return []string{ + string(PassNameOobeSystem), + } +} + +func (s *PassName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassName(input string) (*PassName, error) { + vals := map[string]PassName{ + "oobesystem": PassNameOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassName(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type RestorePointCollectionExpandOptions string + +const ( + RestorePointCollectionExpandOptionsRestorePoints RestorePointCollectionExpandOptions = "restorePoints" +) + +func PossibleValuesForRestorePointCollectionExpandOptions() []string { + return []string{ + string(RestorePointCollectionExpandOptionsRestorePoints), + } +} + +func (s *RestorePointCollectionExpandOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestorePointCollectionExpandOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRestorePointCollectionExpandOptions(input string) (*RestorePointCollectionExpandOptions, error) { + vals := map[string]RestorePointCollectionExpandOptions{ + "restorepoints": RestorePointCollectionExpandOptionsRestorePoints, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestorePointCollectionExpandOptions(input) + return &out, nil +} + +type RestorePointEncryptionType string + +const ( + RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey RestorePointEncryptionType = "EncryptionAtRestWithCustomerKey" + RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys RestorePointEncryptionType = "EncryptionAtRestWithPlatformAndCustomerKeys" + RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey RestorePointEncryptionType = "EncryptionAtRestWithPlatformKey" +) + +func PossibleValuesForRestorePointEncryptionType() []string { + return []string{ + string(RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey), + string(RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys), + string(RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey), + } +} + +func (s *RestorePointEncryptionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestorePointEncryptionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRestorePointEncryptionType(input string) (*RestorePointEncryptionType, error) { + vals := map[string]RestorePointEncryptionType{ + "encryptionatrestwithcustomerkey": RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey, + "encryptionatrestwithplatformandcustomerkeys": RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys, + "encryptionatrestwithplatformkey": RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestorePointEncryptionType(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type SnapshotAccessState string + +const ( + SnapshotAccessStateAvailable SnapshotAccessState = "Available" + SnapshotAccessStateAvailableWithInstantAccess SnapshotAccessState = "AvailableWithInstantAccess" + SnapshotAccessStateInstantAccess SnapshotAccessState = "InstantAccess" + SnapshotAccessStatePending SnapshotAccessState = "Pending" + SnapshotAccessStateUnknown SnapshotAccessState = "Unknown" +) + +func PossibleValuesForSnapshotAccessState() []string { + return []string{ + string(SnapshotAccessStateAvailable), + string(SnapshotAccessStateAvailableWithInstantAccess), + string(SnapshotAccessStateInstantAccess), + string(SnapshotAccessStatePending), + string(SnapshotAccessStateUnknown), + } +} + +func (s *SnapshotAccessState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSnapshotAccessState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSnapshotAccessState(input string) (*SnapshotAccessState, error) { + vals := map[string]SnapshotAccessState{ + "available": SnapshotAccessStateAvailable, + "availablewithinstantaccess": SnapshotAccessStateAvailableWithInstantAccess, + "instantaccess": SnapshotAccessStateInstantAccess, + "pending": SnapshotAccessStatePending, + "unknown": SnapshotAccessStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SnapshotAccessState(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicAFour VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesBasicAOne VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicAThree VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicATwo VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicAZero VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesStandardAEight VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardAEightVTwo VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardAEightmVTwo VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardAFive VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardAFour VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardAFourVTwo VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardAFourmVTwo VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardANine VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardAOne VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardAOneOne VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardAOneVTwo VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardAOneZero VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardASeven VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardASix VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardAThree VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardATwo VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardATwoVTwo VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardATwomVTwo VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardAZero VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardBEightms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardBFourms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardBOnems VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardBOnes VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardBTwoms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardBTwos VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardDEightVThree VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDEightsVThree VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardDFiveVTwo VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDFour VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardDFourVThree VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardDFourVTwo VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardDFoursVThree VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardDOne VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardDOneFiveVTwo VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardDOneFour VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardDOneFourVTwo VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardDOneOne VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardDOneOneVTwo VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardDOneSixVThree VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardDOneSixsVThree VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardDOneThree VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardDOneThreeVTwo VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardDOneTwo VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardDOneTwoVTwo VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardDOneVTwo VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardDSFiveVTwo VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardDSFour VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDSFourVTwo VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDSOne VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDSOneFiveVTwo VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDSOneFour VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDSOneFourVTwo VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDSOneOne VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDSOneOneVTwo VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDSOneThree VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDSOneThreeVTwo VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDSOneTwo VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDSOneTwoVTwo VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDSOneVTwo VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDSThree VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDSThreeVTwo VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDSTwo VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDSTwoVTwo VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDSixFourVThree VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardDSixFoursVThree VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardDThree VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardDThreeTwoVThree VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardDThreeTwosVThree VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardDThreeVTwo VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardDTwo VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardDTwoVThree VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardDTwoVTwo VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardDTwosVThree VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardEEightVThree VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardEEightsVThree VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardEFourVThree VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardEFoursVThree VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardEOneSixVThree VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardEOneSixsVThree VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardESixFourVThree VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardESixFoursVThree VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardEThreeTwoVThree VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardEThreeTwosVThree VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardETwoVThree VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardETwosVThree VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardFEight VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardFEights VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardFEightsVTwo VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardFFour VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardFFours VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardFFoursVTwo VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardFOne VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardFOneSix VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardFOneSixs VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardFOneSixsVTwo VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardFOnes VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardFSevenTwosVTwo VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardFSixFoursVTwo VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardFThreeTwosVTwo VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardFTwo VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardFTwos VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardFTwosVTwo VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardGFive VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGFour VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardGOne VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardGSFive VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGSFiveNegativeEight VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardGSFiveNegativeOneSix VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGSFour VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGSFourNegativeEight VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGSFourNegativeFour VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGSOne VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGSThree VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGSTwo VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGThree VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardGTwo VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardHEight VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardHEightm VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardHOneSix VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardHOneSixm VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardHOneSixmr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardHOneSixr VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardLEights VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardLFours VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardLOneSixs VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardLThreeTwos VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardMOneTwoEightms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardMOneTwoEights VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardMSixFourms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardMSixFours VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNCOneTwo VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNCOneTwosVThree VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNCOneTwosVTwo VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNCSix VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNCSixsVThree VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardNCSixsVTwo VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNCTwoFour VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNCTwoFourr VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNCTwoFourrsVThree VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNCTwoFourrsVTwo VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNCTwoFoursVThree VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNCTwoFoursVTwo VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNDOneTwos VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardNDSixs VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNDTwoFourrs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardNDTwoFours VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardNVOneTwo VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNVSix VirtualMachineSizeTypes = "Standard_NV6" + VirtualMachineSizeTypesStandardNVTwoFour VirtualMachineSizeTypes = "Standard_NV24" +) + +func PossibleValuesForVirtualMachineSizeTypes() []string { + return []string{ + string(VirtualMachineSizeTypesBasicAFour), + string(VirtualMachineSizeTypesBasicAOne), + string(VirtualMachineSizeTypesBasicAThree), + string(VirtualMachineSizeTypesBasicATwo), + string(VirtualMachineSizeTypesBasicAZero), + string(VirtualMachineSizeTypesStandardAEight), + string(VirtualMachineSizeTypesStandardAEightVTwo), + string(VirtualMachineSizeTypesStandardAEightmVTwo), + string(VirtualMachineSizeTypesStandardAFive), + string(VirtualMachineSizeTypesStandardAFour), + string(VirtualMachineSizeTypesStandardAFourVTwo), + string(VirtualMachineSizeTypesStandardAFourmVTwo), + string(VirtualMachineSizeTypesStandardANine), + string(VirtualMachineSizeTypesStandardAOne), + string(VirtualMachineSizeTypesStandardAOneOne), + string(VirtualMachineSizeTypesStandardAOneVTwo), + string(VirtualMachineSizeTypesStandardAOneZero), + string(VirtualMachineSizeTypesStandardASeven), + string(VirtualMachineSizeTypesStandardASix), + string(VirtualMachineSizeTypesStandardAThree), + string(VirtualMachineSizeTypesStandardATwo), + string(VirtualMachineSizeTypesStandardATwoVTwo), + string(VirtualMachineSizeTypesStandardATwomVTwo), + string(VirtualMachineSizeTypesStandardAZero), + string(VirtualMachineSizeTypesStandardBEightms), + string(VirtualMachineSizeTypesStandardBFourms), + string(VirtualMachineSizeTypesStandardBOnems), + string(VirtualMachineSizeTypesStandardBOnes), + string(VirtualMachineSizeTypesStandardBTwoms), + string(VirtualMachineSizeTypesStandardBTwos), + string(VirtualMachineSizeTypesStandardDEightVThree), + string(VirtualMachineSizeTypesStandardDEightsVThree), + string(VirtualMachineSizeTypesStandardDFiveVTwo), + string(VirtualMachineSizeTypesStandardDFour), + string(VirtualMachineSizeTypesStandardDFourVThree), + string(VirtualMachineSizeTypesStandardDFourVTwo), + string(VirtualMachineSizeTypesStandardDFoursVThree), + string(VirtualMachineSizeTypesStandardDOne), + string(VirtualMachineSizeTypesStandardDOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDOneFour), + string(VirtualMachineSizeTypesStandardDOneFourVTwo), + string(VirtualMachineSizeTypesStandardDOneOne), + string(VirtualMachineSizeTypesStandardDOneOneVTwo), + string(VirtualMachineSizeTypesStandardDOneSixVThree), + string(VirtualMachineSizeTypesStandardDOneSixsVThree), + string(VirtualMachineSizeTypesStandardDOneThree), + string(VirtualMachineSizeTypesStandardDOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDOneTwo), + string(VirtualMachineSizeTypesStandardDOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDOneVTwo), + string(VirtualMachineSizeTypesStandardDSFiveVTwo), + string(VirtualMachineSizeTypesStandardDSFour), + string(VirtualMachineSizeTypesStandardDSFourVTwo), + string(VirtualMachineSizeTypesStandardDSOne), + string(VirtualMachineSizeTypesStandardDSOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDSOneFour), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneOne), + string(VirtualMachineSizeTypesStandardDSOneOneVTwo), + string(VirtualMachineSizeTypesStandardDSOneThree), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDSOneTwo), + string(VirtualMachineSizeTypesStandardDSOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneVTwo), + string(VirtualMachineSizeTypesStandardDSThree), + string(VirtualMachineSizeTypesStandardDSThreeVTwo), + string(VirtualMachineSizeTypesStandardDSTwo), + string(VirtualMachineSizeTypesStandardDSTwoVTwo), + string(VirtualMachineSizeTypesStandardDSixFourVThree), + string(VirtualMachineSizeTypesStandardDSixFoursVThree), + string(VirtualMachineSizeTypesStandardDThree), + string(VirtualMachineSizeTypesStandardDThreeTwoVThree), + string(VirtualMachineSizeTypesStandardDThreeTwosVThree), + string(VirtualMachineSizeTypesStandardDThreeVTwo), + string(VirtualMachineSizeTypesStandardDTwo), + string(VirtualMachineSizeTypesStandardDTwoVThree), + string(VirtualMachineSizeTypesStandardDTwoVTwo), + string(VirtualMachineSizeTypesStandardDTwosVThree), + string(VirtualMachineSizeTypesStandardEEightVThree), + string(VirtualMachineSizeTypesStandardEEightsVThree), + string(VirtualMachineSizeTypesStandardEFourVThree), + string(VirtualMachineSizeTypesStandardEFoursVThree), + string(VirtualMachineSizeTypesStandardEOneSixVThree), + string(VirtualMachineSizeTypesStandardEOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree), + string(VirtualMachineSizeTypesStandardESixFourVThree), + string(VirtualMachineSizeTypesStandardESixFoursVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoVThree), + string(VirtualMachineSizeTypesStandardEThreeTwosVThree), + string(VirtualMachineSizeTypesStandardETwoVThree), + string(VirtualMachineSizeTypesStandardETwosVThree), + string(VirtualMachineSizeTypesStandardFEight), + string(VirtualMachineSizeTypesStandardFEights), + string(VirtualMachineSizeTypesStandardFEightsVTwo), + string(VirtualMachineSizeTypesStandardFFour), + string(VirtualMachineSizeTypesStandardFFours), + string(VirtualMachineSizeTypesStandardFFoursVTwo), + string(VirtualMachineSizeTypesStandardFOne), + string(VirtualMachineSizeTypesStandardFOneSix), + string(VirtualMachineSizeTypesStandardFOneSixs), + string(VirtualMachineSizeTypesStandardFOneSixsVTwo), + string(VirtualMachineSizeTypesStandardFOnes), + string(VirtualMachineSizeTypesStandardFSevenTwosVTwo), + string(VirtualMachineSizeTypesStandardFSixFoursVTwo), + string(VirtualMachineSizeTypesStandardFThreeTwosVTwo), + string(VirtualMachineSizeTypesStandardFTwo), + string(VirtualMachineSizeTypesStandardFTwos), + string(VirtualMachineSizeTypesStandardFTwosVTwo), + string(VirtualMachineSizeTypesStandardGFive), + string(VirtualMachineSizeTypesStandardGFour), + string(VirtualMachineSizeTypesStandardGOne), + string(VirtualMachineSizeTypesStandardGSFive), + string(VirtualMachineSizeTypesStandardGSFiveNegativeEight), + string(VirtualMachineSizeTypesStandardGSFiveNegativeOneSix), + string(VirtualMachineSizeTypesStandardGSFour), + string(VirtualMachineSizeTypesStandardGSFourNegativeEight), + string(VirtualMachineSizeTypesStandardGSFourNegativeFour), + string(VirtualMachineSizeTypesStandardGSOne), + string(VirtualMachineSizeTypesStandardGSThree), + string(VirtualMachineSizeTypesStandardGSTwo), + string(VirtualMachineSizeTypesStandardGThree), + string(VirtualMachineSizeTypesStandardGTwo), + string(VirtualMachineSizeTypesStandardHEight), + string(VirtualMachineSizeTypesStandardHEightm), + string(VirtualMachineSizeTypesStandardHOneSix), + string(VirtualMachineSizeTypesStandardHOneSixm), + string(VirtualMachineSizeTypesStandardHOneSixmr), + string(VirtualMachineSizeTypesStandardHOneSixr), + string(VirtualMachineSizeTypesStandardLEights), + string(VirtualMachineSizeTypesStandardLFours), + string(VirtualMachineSizeTypesStandardLOneSixs), + string(VirtualMachineSizeTypesStandardLThreeTwos), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMOneTwoEightms), + string(VirtualMachineSizeTypesStandardMOneTwoEights), + string(VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms), + string(VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMSixFourms), + string(VirtualMachineSizeTypesStandardMSixFours), + string(VirtualMachineSizeTypesStandardNCOneTwo), + string(VirtualMachineSizeTypesStandardNCOneTwosVThree), + string(VirtualMachineSizeTypesStandardNCOneTwosVTwo), + string(VirtualMachineSizeTypesStandardNCSix), + string(VirtualMachineSizeTypesStandardNCSixsVThree), + string(VirtualMachineSizeTypesStandardNCSixsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFour), + string(VirtualMachineSizeTypesStandardNCTwoFourr), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVThree), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFoursVThree), + string(VirtualMachineSizeTypesStandardNCTwoFoursVTwo), + string(VirtualMachineSizeTypesStandardNDOneTwos), + string(VirtualMachineSizeTypesStandardNDSixs), + string(VirtualMachineSizeTypesStandardNDTwoFourrs), + string(VirtualMachineSizeTypesStandardNDTwoFours), + string(VirtualMachineSizeTypesStandardNVOneTwo), + string(VirtualMachineSizeTypesStandardNVSix), + string(VirtualMachineSizeTypesStandardNVTwoFour), + } +} + +func (s *VirtualMachineSizeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineSizeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineSizeTypes(input string) (*VirtualMachineSizeTypes, error) { + vals := map[string]VirtualMachineSizeTypes{ + "basic_a4": VirtualMachineSizeTypesBasicAFour, + "basic_a1": VirtualMachineSizeTypesBasicAOne, + "basic_a3": VirtualMachineSizeTypesBasicAThree, + "basic_a2": VirtualMachineSizeTypesBasicATwo, + "basic_a0": VirtualMachineSizeTypesBasicAZero, + "standard_a8": VirtualMachineSizeTypesStandardAEight, + "standard_a8_v2": VirtualMachineSizeTypesStandardAEightVTwo, + "standard_a8m_v2": VirtualMachineSizeTypesStandardAEightmVTwo, + "standard_a5": VirtualMachineSizeTypesStandardAFive, + "standard_a4": VirtualMachineSizeTypesStandardAFour, + "standard_a4_v2": VirtualMachineSizeTypesStandardAFourVTwo, + "standard_a4m_v2": VirtualMachineSizeTypesStandardAFourmVTwo, + "standard_a9": VirtualMachineSizeTypesStandardANine, + "standard_a1": VirtualMachineSizeTypesStandardAOne, + "standard_a11": VirtualMachineSizeTypesStandardAOneOne, + "standard_a1_v2": VirtualMachineSizeTypesStandardAOneVTwo, + "standard_a10": VirtualMachineSizeTypesStandardAOneZero, + "standard_a7": VirtualMachineSizeTypesStandardASeven, + "standard_a6": VirtualMachineSizeTypesStandardASix, + "standard_a3": VirtualMachineSizeTypesStandardAThree, + "standard_a2": VirtualMachineSizeTypesStandardATwo, + "standard_a2_v2": VirtualMachineSizeTypesStandardATwoVTwo, + "standard_a2m_v2": VirtualMachineSizeTypesStandardATwomVTwo, + "standard_a0": VirtualMachineSizeTypesStandardAZero, + "standard_b8ms": VirtualMachineSizeTypesStandardBEightms, + "standard_b4ms": VirtualMachineSizeTypesStandardBFourms, + "standard_b1ms": VirtualMachineSizeTypesStandardBOnems, + "standard_b1s": VirtualMachineSizeTypesStandardBOnes, + "standard_b2ms": VirtualMachineSizeTypesStandardBTwoms, + "standard_b2s": VirtualMachineSizeTypesStandardBTwos, + "standard_d8_v3": VirtualMachineSizeTypesStandardDEightVThree, + "standard_d8s_v3": VirtualMachineSizeTypesStandardDEightsVThree, + "standard_d5_v2": VirtualMachineSizeTypesStandardDFiveVTwo, + "standard_d4": VirtualMachineSizeTypesStandardDFour, + "standard_d4_v3": VirtualMachineSizeTypesStandardDFourVThree, + "standard_d4_v2": VirtualMachineSizeTypesStandardDFourVTwo, + "standard_d4s_v3": VirtualMachineSizeTypesStandardDFoursVThree, + "standard_d1": VirtualMachineSizeTypesStandardDOne, + "standard_d15_v2": VirtualMachineSizeTypesStandardDOneFiveVTwo, + "standard_d14": VirtualMachineSizeTypesStandardDOneFour, + "standard_d14_v2": VirtualMachineSizeTypesStandardDOneFourVTwo, + "standard_d11": VirtualMachineSizeTypesStandardDOneOne, + "standard_d11_v2": VirtualMachineSizeTypesStandardDOneOneVTwo, + "standard_d16_v3": VirtualMachineSizeTypesStandardDOneSixVThree, + "standard_d16s_v3": VirtualMachineSizeTypesStandardDOneSixsVThree, + "standard_d13": VirtualMachineSizeTypesStandardDOneThree, + "standard_d13_v2": VirtualMachineSizeTypesStandardDOneThreeVTwo, + "standard_d12": VirtualMachineSizeTypesStandardDOneTwo, + "standard_d12_v2": VirtualMachineSizeTypesStandardDOneTwoVTwo, + "standard_d1_v2": VirtualMachineSizeTypesStandardDOneVTwo, + "standard_ds5_v2": VirtualMachineSizeTypesStandardDSFiveVTwo, + "standard_ds4": VirtualMachineSizeTypesStandardDSFour, + "standard_ds4_v2": VirtualMachineSizeTypesStandardDSFourVTwo, + "standard_ds1": VirtualMachineSizeTypesStandardDSOne, + "standard_ds15_v2": VirtualMachineSizeTypesStandardDSOneFiveVTwo, + "standard_ds14": VirtualMachineSizeTypesStandardDSOneFour, + "standard_ds14-8_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo, + "standard_ds14-4_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo, + "standard_ds14_v2": VirtualMachineSizeTypesStandardDSOneFourVTwo, + "standard_ds11": VirtualMachineSizeTypesStandardDSOneOne, + "standard_ds11_v2": VirtualMachineSizeTypesStandardDSOneOneVTwo, + "standard_ds13": VirtualMachineSizeTypesStandardDSOneThree, + "standard_ds13-4_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo, + "standard_ds13-2_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo, + "standard_ds13_v2": VirtualMachineSizeTypesStandardDSOneThreeVTwo, + "standard_ds12": VirtualMachineSizeTypesStandardDSOneTwo, + "standard_ds12_v2": VirtualMachineSizeTypesStandardDSOneTwoVTwo, + "standard_ds1_v2": VirtualMachineSizeTypesStandardDSOneVTwo, + "standard_ds3": VirtualMachineSizeTypesStandardDSThree, + "standard_ds3_v2": VirtualMachineSizeTypesStandardDSThreeVTwo, + "standard_ds2": VirtualMachineSizeTypesStandardDSTwo, + "standard_ds2_v2": VirtualMachineSizeTypesStandardDSTwoVTwo, + "standard_d64_v3": VirtualMachineSizeTypesStandardDSixFourVThree, + "standard_d64s_v3": VirtualMachineSizeTypesStandardDSixFoursVThree, + "standard_d3": VirtualMachineSizeTypesStandardDThree, + "standard_d32_v3": VirtualMachineSizeTypesStandardDThreeTwoVThree, + "standard_d32s_v3": VirtualMachineSizeTypesStandardDThreeTwosVThree, + "standard_d3_v2": VirtualMachineSizeTypesStandardDThreeVTwo, + "standard_d2": VirtualMachineSizeTypesStandardDTwo, + "standard_d2_v3": VirtualMachineSizeTypesStandardDTwoVThree, + "standard_d2_v2": VirtualMachineSizeTypesStandardDTwoVTwo, + "standard_d2s_v3": VirtualMachineSizeTypesStandardDTwosVThree, + "standard_e8_v3": VirtualMachineSizeTypesStandardEEightVThree, + "standard_e8s_v3": VirtualMachineSizeTypesStandardEEightsVThree, + "standard_e4_v3": VirtualMachineSizeTypesStandardEFourVThree, + "standard_e4s_v3": VirtualMachineSizeTypesStandardEFoursVThree, + "standard_e16_v3": VirtualMachineSizeTypesStandardEOneSixVThree, + "standard_e16s_v3": VirtualMachineSizeTypesStandardEOneSixsVThree, + "standard_e64-16s_v3": VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree, + "standard_e64-32s_v3": VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree, + "standard_e64_v3": VirtualMachineSizeTypesStandardESixFourVThree, + "standard_e64s_v3": VirtualMachineSizeTypesStandardESixFoursVThree, + "standard_e32-8s_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree, + "standard_e32-16_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree, + "standard_e32_v3": VirtualMachineSizeTypesStandardEThreeTwoVThree, + "standard_e32s_v3": VirtualMachineSizeTypesStandardEThreeTwosVThree, + "standard_e2_v3": VirtualMachineSizeTypesStandardETwoVThree, + "standard_e2s_v3": VirtualMachineSizeTypesStandardETwosVThree, + "standard_f8": VirtualMachineSizeTypesStandardFEight, + "standard_f8s": VirtualMachineSizeTypesStandardFEights, + "standard_f8s_v2": VirtualMachineSizeTypesStandardFEightsVTwo, + "standard_f4": VirtualMachineSizeTypesStandardFFour, + "standard_f4s": VirtualMachineSizeTypesStandardFFours, + "standard_f4s_v2": VirtualMachineSizeTypesStandardFFoursVTwo, + "standard_f1": VirtualMachineSizeTypesStandardFOne, + "standard_f16": VirtualMachineSizeTypesStandardFOneSix, + "standard_f16s": VirtualMachineSizeTypesStandardFOneSixs, + "standard_f16s_v2": VirtualMachineSizeTypesStandardFOneSixsVTwo, + "standard_f1s": VirtualMachineSizeTypesStandardFOnes, + "standard_f72s_v2": VirtualMachineSizeTypesStandardFSevenTwosVTwo, + "standard_f64s_v2": VirtualMachineSizeTypesStandardFSixFoursVTwo, + "standard_f32s_v2": VirtualMachineSizeTypesStandardFThreeTwosVTwo, + "standard_f2": VirtualMachineSizeTypesStandardFTwo, + "standard_f2s": VirtualMachineSizeTypesStandardFTwos, + "standard_f2s_v2": VirtualMachineSizeTypesStandardFTwosVTwo, + "standard_g5": VirtualMachineSizeTypesStandardGFive, + "standard_g4": VirtualMachineSizeTypesStandardGFour, + "standard_g1": VirtualMachineSizeTypesStandardGOne, + "standard_gs5": VirtualMachineSizeTypesStandardGSFive, + "standard_gs5-8": VirtualMachineSizeTypesStandardGSFiveNegativeEight, + "standard_gs5-16": VirtualMachineSizeTypesStandardGSFiveNegativeOneSix, + "standard_gs4": VirtualMachineSizeTypesStandardGSFour, + "standard_gs4-8": VirtualMachineSizeTypesStandardGSFourNegativeEight, + "standard_gs4-4": VirtualMachineSizeTypesStandardGSFourNegativeFour, + "standard_gs1": VirtualMachineSizeTypesStandardGSOne, + "standard_gs3": VirtualMachineSizeTypesStandardGSThree, + "standard_gs2": VirtualMachineSizeTypesStandardGSTwo, + "standard_g3": VirtualMachineSizeTypesStandardGThree, + "standard_g2": VirtualMachineSizeTypesStandardGTwo, + "standard_h8": VirtualMachineSizeTypesStandardHEight, + "standard_h8m": VirtualMachineSizeTypesStandardHEightm, + "standard_h16": VirtualMachineSizeTypesStandardHOneSix, + "standard_h16m": VirtualMachineSizeTypesStandardHOneSixm, + "standard_h16mr": VirtualMachineSizeTypesStandardHOneSixmr, + "standard_h16r": VirtualMachineSizeTypesStandardHOneSixr, + "standard_l8s": VirtualMachineSizeTypesStandardLEights, + "standard_l4s": VirtualMachineSizeTypesStandardLFours, + "standard_l16s": VirtualMachineSizeTypesStandardLOneSixs, + "standard_l32s": VirtualMachineSizeTypesStandardLThreeTwos, + "standard_m128-64ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms, + "standard_m128-32ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms, + "standard_m128ms": VirtualMachineSizeTypesStandardMOneTwoEightms, + "standard_m128s": VirtualMachineSizeTypesStandardMOneTwoEights, + "standard_m64-16ms": VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms, + "standard_m64-32ms": VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms, + "standard_m64ms": VirtualMachineSizeTypesStandardMSixFourms, + "standard_m64s": VirtualMachineSizeTypesStandardMSixFours, + "standard_nc12": VirtualMachineSizeTypesStandardNCOneTwo, + "standard_nc12s_v3": VirtualMachineSizeTypesStandardNCOneTwosVThree, + "standard_nc12s_v2": VirtualMachineSizeTypesStandardNCOneTwosVTwo, + "standard_nc6": VirtualMachineSizeTypesStandardNCSix, + "standard_nc6s_v3": VirtualMachineSizeTypesStandardNCSixsVThree, + "standard_nc6s_v2": VirtualMachineSizeTypesStandardNCSixsVTwo, + "standard_nc24": VirtualMachineSizeTypesStandardNCTwoFour, + "standard_nc24r": VirtualMachineSizeTypesStandardNCTwoFourr, + "standard_nc24rs_v3": VirtualMachineSizeTypesStandardNCTwoFourrsVThree, + "standard_nc24rs_v2": VirtualMachineSizeTypesStandardNCTwoFourrsVTwo, + "standard_nc24s_v3": VirtualMachineSizeTypesStandardNCTwoFoursVThree, + "standard_nc24s_v2": VirtualMachineSizeTypesStandardNCTwoFoursVTwo, + "standard_nd12s": VirtualMachineSizeTypesStandardNDOneTwos, + "standard_nd6s": VirtualMachineSizeTypesStandardNDSixs, + "standard_nd24rs": VirtualMachineSizeTypesStandardNDTwoFourrs, + "standard_nd24s": VirtualMachineSizeTypesStandardNDTwoFours, + "standard_nv12": VirtualMachineSizeTypesStandardNVOneTwo, + "standard_nv6": VirtualMachineSizeTypesStandardNVSix, + "standard_nv24": VirtualMachineSizeTypesStandardNVTwoFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineSizeTypes(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/id_restorepointcollection.go b/resource-manager/compute/2025-04-01/restorepointcollections/id_restorepointcollection.go new file mode 100644 index 00000000000..91fd3012fb1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/id_restorepointcollection.go @@ -0,0 +1,130 @@ +package restorepointcollections + +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(&RestorePointCollectionId{}) +} + +var _ resourceids.ResourceId = &RestorePointCollectionId{} + +// RestorePointCollectionId is a struct representing the Resource ID for a Restore Point Collection +type RestorePointCollectionId struct { + SubscriptionId string + ResourceGroupName string + RestorePointCollectionName string +} + +// NewRestorePointCollectionID returns a new RestorePointCollectionId struct +func NewRestorePointCollectionID(subscriptionId string, resourceGroupName string, restorePointCollectionName string) RestorePointCollectionId { + return RestorePointCollectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RestorePointCollectionName: restorePointCollectionName, + } +} + +// ParseRestorePointCollectionID parses 'input' into a RestorePointCollectionId +func ParseRestorePointCollectionID(input string) (*RestorePointCollectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&RestorePointCollectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RestorePointCollectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRestorePointCollectionIDInsensitively parses 'input' case-insensitively into a RestorePointCollectionId +// note: this method should only be used for API response data and not user input +func ParseRestorePointCollectionIDInsensitively(input string) (*RestorePointCollectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&RestorePointCollectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RestorePointCollectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointCollectionId) 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.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) + } + + return nil +} + +// ValidateRestorePointCollectionID checks that 'input' can be parsed as a Restore Point Collection ID +func ValidateRestorePointCollectionID(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 := ParseRestorePointCollectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Restore Point Collection ID +func (id RestorePointCollectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/restorePointCollections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RestorePointCollectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Restore Point Collection ID +func (id RestorePointCollectionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticRestorePointCollections", "restorePointCollections", "restorePointCollections"), + resourceids.UserSpecifiedSegment("restorePointCollectionName", "restorePointCollectionName"), + } +} + +// String returns a human-readable description of this Restore Point Collection ID +func (id RestorePointCollectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Restore Point Collection Name: %q", id.RestorePointCollectionName), + } + return fmt.Sprintf("Restore Point Collection (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/id_restorepointcollection_test.go b/resource-manager/compute/2025-04-01/restorepointcollections/id_restorepointcollection_test.go new file mode 100644 index 00000000000..bc01554f0be --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/id_restorepointcollection_test.go @@ -0,0 +1,282 @@ +package restorepointcollections + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &RestorePointCollectionId{} + +func TestNewRestorePointCollectionID(t *testing.T) { + id := NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.RestorePointCollectionName != "restorePointCollectionName" { + t.Fatalf("Expected %q but got %q for Segment 'RestorePointCollectionName'", id.RestorePointCollectionName, "restorePointCollectionName") + } +} + +func TestFormatRestorePointCollectionID(t *testing.T) { + actual := NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRestorePointCollectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RestorePointCollectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName", + Expected: &RestorePointCollectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RestorePointCollectionName: "restorePointCollectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRestorePointCollectionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RestorePointCollectionName != v.Expected.RestorePointCollectionName { + t.Fatalf("Expected %q but got %q for RestorePointCollectionName", v.Expected.RestorePointCollectionName, actual.RestorePointCollectionName) + } + + } +} + +func TestParseRestorePointCollectionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RestorePointCollectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName", + Expected: &RestorePointCollectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RestorePointCollectionName: "restorePointCollectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE", + Expected: &RestorePointCollectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RestorePointCollectionName: "rEsToRePoInTcOlLeCtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRestorePointCollectionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RestorePointCollectionName != v.Expected.RestorePointCollectionName { + t.Fatalf("Expected %q but got %q for RestorePointCollectionName", v.Expected.RestorePointCollectionName, actual.RestorePointCollectionName) + } + + } +} + +func TestSegmentsForRestorePointCollectionId(t *testing.T) { + segments := RestorePointCollectionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RestorePointCollectionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/method_createorupdate.go b/resource-manager/compute/2025-04-01/restorepointcollections/method_createorupdate.go new file mode 100644 index 00000000000..7e9dac346e3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/method_createorupdate.go @@ -0,0 +1,58 @@ +package restorepointcollections + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RestorePointCollection +} + +// CreateOrUpdate ... +func (c RestorePointCollectionsClient) CreateOrUpdate(ctx context.Context, id RestorePointCollectionId, input RestorePointCollection) (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 + } + + var model RestorePointCollection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/method_delete.go b/resource-manager/compute/2025-04-01/restorepointcollections/method_delete.go new file mode 100644 index 00000000000..3aefb2adc43 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/method_delete.go @@ -0,0 +1,71 @@ +package restorepointcollections + +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 RestorePointCollectionsClient) Delete(ctx context.Context, id RestorePointCollectionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c RestorePointCollectionsClient) DeleteThenPoll(ctx context.Context, id RestorePointCollectionId) 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/resource-manager/compute/2025-04-01/restorepointcollections/method_get.go b/resource-manager/compute/2025-04-01/restorepointcollections/method_get.go new file mode 100644 index 00000000000..636041d46c6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/method_get.go @@ -0,0 +1,83 @@ +package restorepointcollections + +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 *RestorePointCollection +} + +type GetOperationOptions struct { + Expand *RestorePointCollectionExpandOptions +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c RestorePointCollectionsClient) Get(ctx context.Context, id RestorePointCollectionId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 RestorePointCollection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/method_list.go b/resource-manager/compute/2025-04-01/restorepointcollections/method_list.go new file mode 100644 index 00000000000..ab48c476888 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/method_list.go @@ -0,0 +1,106 @@ +package restorepointcollections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RestorePointCollection +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []RestorePointCollection +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c RestorePointCollectionsClient) List(ctx context.Context, id commonids.ResourceGroupId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/restorePointCollections", 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 *[]RestorePointCollection `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c RestorePointCollectionsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, RestorePointCollectionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RestorePointCollectionsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate RestorePointCollectionOperationPredicate) (result ListCompleteResult, err error) { + items := make([]RestorePointCollection, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/method_listall.go b/resource-manager/compute/2025-04-01/restorepointcollections/method_listall.go new file mode 100644 index 00000000000..a254de39170 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/method_listall.go @@ -0,0 +1,106 @@ +package restorepointcollections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAllOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RestorePointCollection +} + +type ListAllCompleteResult struct { + LatestHttpResponse *http.Response + Items []RestorePointCollection +} + +type ListAllCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListAllCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListAll ... +func (c RestorePointCollectionsClient) ListAll(ctx context.Context, id commonids.SubscriptionId) (result ListAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListAllCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/restorePointCollections", 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 *[]RestorePointCollection `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAllComplete retrieves all the results into a single object +func (c RestorePointCollectionsClient) ListAllComplete(ctx context.Context, id commonids.SubscriptionId) (ListAllCompleteResult, error) { + return c.ListAllCompleteMatchingPredicate(ctx, id, RestorePointCollectionOperationPredicate{}) +} + +// ListAllCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RestorePointCollectionsClient) ListAllCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate RestorePointCollectionOperationPredicate) (result ListAllCompleteResult, err error) { + items := make([]RestorePointCollection, 0) + + resp, err := c.ListAll(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 = ListAllCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/method_update.go b/resource-manager/compute/2025-04-01/restorepointcollections/method_update.go new file mode 100644 index 00000000000..3aa41ed97ea --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/method_update.go @@ -0,0 +1,57 @@ +package restorepointcollections + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RestorePointCollection +} + +// Update ... +func (c RestorePointCollectionsClient) Update(ctx context.Context, id RestorePointCollectionId, input RestorePointCollectionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model RestorePointCollection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_additionalunattendcontent.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_additionalunattendcontent.go new file mode 100644 index 00000000000..b8a4446e886 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentName `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassName `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_apientityreference.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_apientityreference.go new file mode 100644 index 00000000000..727d790c656 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_apientityreference.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_bootdiagnostics.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_bootdiagnostics.go new file mode 100644 index 00000000000..f7688478a5f --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_diagnosticsprofile.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_diagnosticsprofile.go new file mode 100644 index 00000000000..0fe48b89ced --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_diskencryptionsettings.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_diskencryptionsettings.go new file mode 100644 index 00000000000..0d821506598 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_diskencryptionsettings.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_diskrestorepointattributes.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_diskrestorepointattributes.go new file mode 100644 index 00000000000..43124c8f061 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_diskrestorepointattributes.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointAttributes struct { + Encryption *RestorePointEncryption `json:"encryption,omitempty"` + Id *string `json:"id,omitempty"` + SourceDiskRestorePoint *ApiEntityReference `json:"sourceDiskRestorePoint,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_diskrestorepointinstanceview.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_diskrestorepointinstanceview.go new file mode 100644 index 00000000000..78767d1c1c8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_diskrestorepointinstanceview.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointInstanceView struct { + Id *string `json:"id,omitempty"` + ReplicationStatus *DiskRestorePointReplicationStatus `json:"replicationStatus,omitempty"` + SnapshotAccessState *SnapshotAccessState `json:"snapshotAccessState,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_diskrestorepointreplicationstatus.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_diskrestorepointreplicationstatus.go new file mode 100644 index 00000000000..a9b1c99fc37 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_diskrestorepointreplicationstatus.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointReplicationStatus struct { + CompletionPercent *int64 `json:"completionPercent,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_encryptionidentity.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_encryptionidentity.go new file mode 100644 index 00000000000..ff6228b54ee --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionIdentity struct { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_hardwareprofile.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_hardwareprofile.go new file mode 100644 index 00000000000..2d11fed2803 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_hardwareprofile.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_hostendpointsettings.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_hostendpointsettings.go new file mode 100644 index 00000000000..e562bd67338 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_instanceviewstatus.go new file mode 100644 index 00000000000..c72457c65f6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package restorepointcollections + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_keyvaultkeyreference.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_keyvaultkeyreference.go new file mode 100644 index 00000000000..e67b885cbec --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_keyvaultkeyreference.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyURL string `json:"keyUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_keyvaultsecretreference.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..f403c9277b7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_linuxconfiguration.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_linuxconfiguration.go new file mode 100644 index 00000000000..331ab8adf5f --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_linuxpatchsettings.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_linuxpatchsettings.go new file mode 100644 index 00000000000..1911d1f34cb --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..ee79a6f5155 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_manageddiskparameters.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_manageddiskparameters.go new file mode 100644 index 00000000000..c5ceac9dcb8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_manageddiskparameters.go @@ -0,0 +1,11 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Id *string `json:"id,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_osprofile.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_osprofile.go new file mode 100644 index 00000000000..2a8765dd51f --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_osprofile.go @@ -0,0 +1,16 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_patchsettings.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_patchsettings.go new file mode 100644 index 00000000000..dccbe861dcc --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_patchsettings.go @@ -0,0 +1,11 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_proxyagentsettings.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_proxyagentsettings.go new file mode 100644 index 00000000000..6bdeb2f7663 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_proxyagentsettings.go @@ -0,0 +1,13 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + AddProxyAgentExtension *bool `json:"addProxyAgentExtension,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepoint.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepoint.go new file mode 100644 index 00000000000..588d81d809b --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepoint.go @@ -0,0 +1,16 @@ +package restorepointcollections + +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 RestorePoint struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RestorePointProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollection.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollection.go new file mode 100644 index 00000000000..f2c996d4f37 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollection.go @@ -0,0 +1,18 @@ +package restorepointcollections + +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 RestorePointCollection struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *RestorePointCollectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollectionproperties.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollectionproperties.go new file mode 100644 index 00000000000..d6a639a6feb --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollectionproperties.go @@ -0,0 +1,12 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointCollectionProperties struct { + InstantAccess *bool `json:"instantAccess,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + RestorePointCollectionId *string `json:"restorePointCollectionId,omitempty"` + RestorePoints *[]RestorePoint `json:"restorePoints,omitempty"` + Source *RestorePointCollectionSourceProperties `json:"source,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollectionsourceproperties.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollectionsourceproperties.go new file mode 100644 index 00000000000..0fce692d38b --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollectionsourceproperties.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointCollectionSourceProperties struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollectionupdate.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollectionupdate.go new file mode 100644 index 00000000000..e97da7d44a8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointcollectionupdate.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointCollectionUpdate struct { + Properties *RestorePointCollectionProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointencryption.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointencryption.go new file mode 100644 index 00000000000..ac434a73886 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointencryption.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointEncryption struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Type *RestorePointEncryptionType `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointinstanceview.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointinstanceview.go new file mode 100644 index 00000000000..50af16f9dd0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointinstanceview.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointInstanceView struct { + DiskRestorePoints *[]DiskRestorePointInstanceView `json:"diskRestorePoints,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointproperties.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointproperties.go new file mode 100644 index 00000000000..578622a0636 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointproperties.go @@ -0,0 +1,33 @@ +package restorepointcollections + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointProperties struct { + ConsistencyMode *ConsistencyModeTypes `json:"consistencyMode,omitempty"` + ExcludeDisks *[]ApiEntityReference `json:"excludeDisks,omitempty"` + InstanceView *RestorePointInstanceView `json:"instanceView,omitempty"` + InstantAccessDurationMinutes *int64 `json:"instantAccessDurationMinutes,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SourceMetadata *RestorePointSourceMetadata `json:"sourceMetadata,omitempty"` + SourceRestorePoint *ApiEntityReference `json:"sourceRestorePoint,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` +} + +func (o *RestorePointProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *RestorePointProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcemetadata.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcemetadata.go new file mode 100644 index 00000000000..154a3e68682 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcemetadata.go @@ -0,0 +1,17 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceMetadata struct { + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + Location *string `json:"location,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *RestorePointSourceVMStorageProfile `json:"storageProfile,omitempty"` + UserData *string `json:"userData,omitempty"` + VMId *string `json:"vmId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcevmdatadisk.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcevmdatadisk.go new file mode 100644 index 00000000000..587b86f3ae1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcevmdatadisk.go @@ -0,0 +1,14 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMDataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DiskRestorePoint *DiskRestorePointAttributes `json:"diskRestorePoint,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun *int64 `json:"lun,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcevmosdisk.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcevmosdisk.go new file mode 100644 index 00000000000..e75634d6f6f --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcevmosdisk.go @@ -0,0 +1,15 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMOSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DiskRestorePoint *DiskRestorePointAttributes `json:"diskRestorePoint,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemType `json:"osType,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcevmstorageprofile.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcevmstorageprofile.go new file mode 100644 index 00000000000..101439cc548 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_restorepointsourcevmstorageprofile.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMStorageProfile struct { + DataDisks *[]RestorePointSourceVMDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + OsDisk *RestorePointSourceVMOSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_securityprofile.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_securityprofile.go new file mode 100644 index 00000000000..32d20891ded --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_securityprofile.go @@ -0,0 +1,12 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_sshconfiguration.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_sshconfiguration.go new file mode 100644 index 00000000000..78c9da8533f --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_sshpublickey.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_sshpublickey.go new file mode 100644 index 00000000000..e2950536919 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_sshpublickey.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_subresource.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_subresource.go new file mode 100644 index 00000000000..bd10eea4e51 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_subresource.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_uefisettings.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_uefisettings.go new file mode 100644 index 00000000000..12510ee841d --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_uefisettings.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_vaultcertificate.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_vaultcertificate.go new file mode 100644 index 00000000000..f3fd244ab96 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_vaultsecretgroup.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_vaultsecretgroup.go new file mode 100644 index 00000000000..039fc20fb7e --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_vmdisksecurityprofile.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..af2b07bc05c --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_vmsizeproperties.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_vmsizeproperties.go new file mode 100644 index 00000000000..9bd6823b54e --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_windowsconfiguration.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_windowsconfiguration.go new file mode 100644 index 00000000000..1408c9770a1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..a2b5f7d65b6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_winrmconfiguration.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_winrmconfiguration.go new file mode 100644 index 00000000000..d89758ef38f --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/model_winrmlistener.go b/resource-manager/compute/2025-04-01/restorepointcollections/model_winrmlistener.go new file mode 100644 index 00000000000..3b6dcd5d775 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/model_winrmlistener.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepointcollections/predicates.go b/resource-manager/compute/2025-04-01/restorepointcollections/predicates.go new file mode 100644 index 00000000000..6f4eb007a65 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/predicates.go @@ -0,0 +1,32 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointCollectionOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p RestorePointCollectionOperationPredicate) Matches(input RestorePointCollection) 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/resource-manager/compute/2025-04-01/restorepointcollections/version.go b/resource-manager/compute/2025-04-01/restorepointcollections/version.go new file mode 100644 index 00000000000..f8a4ea38c12 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepointcollections/version.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/restorepointcollections/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/README.md b/resource-manager/compute/2025-04-01/restorepoints/README.md new file mode 100644 index 00000000000..f8470b9913b --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/README.md @@ -0,0 +1,65 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/restorepoints` Documentation + +The `restorepoints` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/restorepoints" +``` + + +### Client Initialization + +```go +client := restorepoints.NewRestorePointsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RestorePointsClient.Create` + +```go +ctx := context.TODO() +id := restorepoints.NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName") + +payload := restorepoints.RestorePoint{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RestorePointsClient.Delete` + +```go +ctx := context.TODO() +id := restorepoints.NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RestorePointsClient.Get` + +```go +ctx := context.TODO() +id := restorepoints.NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName") + +read, err := client.Get(ctx, id, restorepoints.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2025-04-01/restorepoints/client.go b/resource-manager/compute/2025-04-01/restorepoints/client.go new file mode 100644 index 00000000000..febed9d42f1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/client.go @@ -0,0 +1,26 @@ +package restorepoints + +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 RestorePointsClient struct { + Client *resourcemanager.Client +} + +func NewRestorePointsClientWithBaseURI(sdkApi sdkEnv.Api) (*RestorePointsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "restorepoints", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RestorePointsClient: %+v", err) + } + + return &RestorePointsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/constants.go b/resource-manager/compute/2025-04-01/restorepoints/constants.go new file mode 100644 index 00000000000..6ed9f5a1312 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/constants.go @@ -0,0 +1,1575 @@ +package restorepoints + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentName string + +const ( + ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentName = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentName() []string { + return []string{ + string(ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentName(input string) (*ComponentName, error) { + vals := map[string]ComponentName{ + "microsoft-windows-shell-setup": ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentName(input) + return &out, nil +} + +type ConsistencyModeTypes string + +const ( + ConsistencyModeTypesApplicationConsistent ConsistencyModeTypes = "ApplicationConsistent" + ConsistencyModeTypesCrashConsistent ConsistencyModeTypes = "CrashConsistent" + ConsistencyModeTypesFileSystemConsistent ConsistencyModeTypes = "FileSystemConsistent" +) + +func PossibleValuesForConsistencyModeTypes() []string { + return []string{ + string(ConsistencyModeTypesApplicationConsistent), + string(ConsistencyModeTypesCrashConsistent), + string(ConsistencyModeTypesFileSystemConsistent), + } +} + +func (s *ConsistencyModeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConsistencyModeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConsistencyModeTypes(input string) (*ConsistencyModeTypes, error) { + vals := map[string]ConsistencyModeTypes{ + "applicationconsistent": ConsistencyModeTypesApplicationConsistent, + "crashconsistent": ConsistencyModeTypesCrashConsistent, + "filesystemconsistent": ConsistencyModeTypesFileSystemConsistent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConsistencyModeTypes(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type HyperVGenerationTypes string + +const ( + HyperVGenerationTypesVOne HyperVGenerationTypes = "V1" + HyperVGenerationTypesVTwo HyperVGenerationTypes = "V2" +) + +func PossibleValuesForHyperVGenerationTypes() []string { + return []string{ + string(HyperVGenerationTypesVOne), + string(HyperVGenerationTypesVTwo), + } +} + +func (s *HyperVGenerationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationTypes(input string) (*HyperVGenerationTypes, error) { + vals := map[string]HyperVGenerationTypes{ + "v1": HyperVGenerationTypesVOne, + "v2": HyperVGenerationTypesVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationTypes(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type OperatingSystemType string + +const ( + OperatingSystemTypeLinux OperatingSystemType = "Linux" + OperatingSystemTypeWindows OperatingSystemType = "Windows" +) + +func PossibleValuesForOperatingSystemType() []string { + return []string{ + string(OperatingSystemTypeLinux), + string(OperatingSystemTypeWindows), + } +} + +func (s *OperatingSystemType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemType(input string) (*OperatingSystemType, error) { + vals := map[string]OperatingSystemType{ + "linux": OperatingSystemTypeLinux, + "windows": OperatingSystemTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemType(input) + return &out, nil +} + +type PassName string + +const ( + PassNameOobeSystem PassName = "OobeSystem" +) + +func PossibleValuesForPassName() []string { + return []string{ + string(PassNameOobeSystem), + } +} + +func (s *PassName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassName(input string) (*PassName, error) { + vals := map[string]PassName{ + "oobesystem": PassNameOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassName(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type RestorePointEncryptionType string + +const ( + RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey RestorePointEncryptionType = "EncryptionAtRestWithCustomerKey" + RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys RestorePointEncryptionType = "EncryptionAtRestWithPlatformAndCustomerKeys" + RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey RestorePointEncryptionType = "EncryptionAtRestWithPlatformKey" +) + +func PossibleValuesForRestorePointEncryptionType() []string { + return []string{ + string(RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey), + string(RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys), + string(RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey), + } +} + +func (s *RestorePointEncryptionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestorePointEncryptionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRestorePointEncryptionType(input string) (*RestorePointEncryptionType, error) { + vals := map[string]RestorePointEncryptionType{ + "encryptionatrestwithcustomerkey": RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey, + "encryptionatrestwithplatformandcustomerkeys": RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys, + "encryptionatrestwithplatformkey": RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestorePointEncryptionType(input) + return &out, nil +} + +type RestorePointExpandOptions string + +const ( + RestorePointExpandOptionsInstanceView RestorePointExpandOptions = "instanceView" +) + +func PossibleValuesForRestorePointExpandOptions() []string { + return []string{ + string(RestorePointExpandOptionsInstanceView), + } +} + +func (s *RestorePointExpandOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestorePointExpandOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRestorePointExpandOptions(input string) (*RestorePointExpandOptions, error) { + vals := map[string]RestorePointExpandOptions{ + "instanceview": RestorePointExpandOptionsInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestorePointExpandOptions(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type SnapshotAccessState string + +const ( + SnapshotAccessStateAvailable SnapshotAccessState = "Available" + SnapshotAccessStateAvailableWithInstantAccess SnapshotAccessState = "AvailableWithInstantAccess" + SnapshotAccessStateInstantAccess SnapshotAccessState = "InstantAccess" + SnapshotAccessStatePending SnapshotAccessState = "Pending" + SnapshotAccessStateUnknown SnapshotAccessState = "Unknown" +) + +func PossibleValuesForSnapshotAccessState() []string { + return []string{ + string(SnapshotAccessStateAvailable), + string(SnapshotAccessStateAvailableWithInstantAccess), + string(SnapshotAccessStateInstantAccess), + string(SnapshotAccessStatePending), + string(SnapshotAccessStateUnknown), + } +} + +func (s *SnapshotAccessState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSnapshotAccessState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSnapshotAccessState(input string) (*SnapshotAccessState, error) { + vals := map[string]SnapshotAccessState{ + "available": SnapshotAccessStateAvailable, + "availablewithinstantaccess": SnapshotAccessStateAvailableWithInstantAccess, + "instantaccess": SnapshotAccessStateInstantAccess, + "pending": SnapshotAccessStatePending, + "unknown": SnapshotAccessStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SnapshotAccessState(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicAFour VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesBasicAOne VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicAThree VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicATwo VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicAZero VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesStandardAEight VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardAEightVTwo VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardAEightmVTwo VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardAFive VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardAFour VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardAFourVTwo VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardAFourmVTwo VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardANine VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardAOne VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardAOneOne VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardAOneVTwo VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardAOneZero VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardASeven VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardASix VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardAThree VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardATwo VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardATwoVTwo VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardATwomVTwo VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardAZero VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardBEightms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardBFourms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardBOnems VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardBOnes VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardBTwoms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardBTwos VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardDEightVThree VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDEightsVThree VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardDFiveVTwo VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDFour VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardDFourVThree VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardDFourVTwo VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardDFoursVThree VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardDOne VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardDOneFiveVTwo VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardDOneFour VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardDOneFourVTwo VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardDOneOne VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardDOneOneVTwo VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardDOneSixVThree VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardDOneSixsVThree VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardDOneThree VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardDOneThreeVTwo VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardDOneTwo VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardDOneTwoVTwo VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardDOneVTwo VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardDSFiveVTwo VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardDSFour VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDSFourVTwo VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDSOne VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDSOneFiveVTwo VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDSOneFour VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDSOneFourVTwo VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDSOneOne VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDSOneOneVTwo VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDSOneThree VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDSOneThreeVTwo VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDSOneTwo VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDSOneTwoVTwo VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDSOneVTwo VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDSThree VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDSThreeVTwo VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDSTwo VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDSTwoVTwo VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDSixFourVThree VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardDSixFoursVThree VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardDThree VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardDThreeTwoVThree VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardDThreeTwosVThree VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardDThreeVTwo VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardDTwo VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardDTwoVThree VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardDTwoVTwo VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardDTwosVThree VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardEEightVThree VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardEEightsVThree VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardEFourVThree VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardEFoursVThree VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardEOneSixVThree VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardEOneSixsVThree VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardESixFourVThree VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardESixFoursVThree VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardEThreeTwoVThree VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardEThreeTwosVThree VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardETwoVThree VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardETwosVThree VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardFEight VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardFEights VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardFEightsVTwo VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardFFour VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardFFours VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardFFoursVTwo VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardFOne VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardFOneSix VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardFOneSixs VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardFOneSixsVTwo VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardFOnes VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardFSevenTwosVTwo VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardFSixFoursVTwo VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardFThreeTwosVTwo VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardFTwo VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardFTwos VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardFTwosVTwo VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardGFive VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGFour VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardGOne VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardGSFive VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGSFiveNegativeEight VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardGSFiveNegativeOneSix VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGSFour VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGSFourNegativeEight VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGSFourNegativeFour VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGSOne VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGSThree VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGSTwo VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGThree VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardGTwo VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardHEight VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardHEightm VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardHOneSix VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardHOneSixm VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardHOneSixmr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardHOneSixr VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardLEights VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardLFours VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardLOneSixs VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardLThreeTwos VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardMOneTwoEightms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardMOneTwoEights VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardMSixFourms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardMSixFours VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNCOneTwo VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNCOneTwosVThree VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNCOneTwosVTwo VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNCSix VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNCSixsVThree VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardNCSixsVTwo VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNCTwoFour VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNCTwoFourr VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNCTwoFourrsVThree VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNCTwoFourrsVTwo VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNCTwoFoursVThree VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNCTwoFoursVTwo VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNDOneTwos VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardNDSixs VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNDTwoFourrs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardNDTwoFours VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardNVOneTwo VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNVSix VirtualMachineSizeTypes = "Standard_NV6" + VirtualMachineSizeTypesStandardNVTwoFour VirtualMachineSizeTypes = "Standard_NV24" +) + +func PossibleValuesForVirtualMachineSizeTypes() []string { + return []string{ + string(VirtualMachineSizeTypesBasicAFour), + string(VirtualMachineSizeTypesBasicAOne), + string(VirtualMachineSizeTypesBasicAThree), + string(VirtualMachineSizeTypesBasicATwo), + string(VirtualMachineSizeTypesBasicAZero), + string(VirtualMachineSizeTypesStandardAEight), + string(VirtualMachineSizeTypesStandardAEightVTwo), + string(VirtualMachineSizeTypesStandardAEightmVTwo), + string(VirtualMachineSizeTypesStandardAFive), + string(VirtualMachineSizeTypesStandardAFour), + string(VirtualMachineSizeTypesStandardAFourVTwo), + string(VirtualMachineSizeTypesStandardAFourmVTwo), + string(VirtualMachineSizeTypesStandardANine), + string(VirtualMachineSizeTypesStandardAOne), + string(VirtualMachineSizeTypesStandardAOneOne), + string(VirtualMachineSizeTypesStandardAOneVTwo), + string(VirtualMachineSizeTypesStandardAOneZero), + string(VirtualMachineSizeTypesStandardASeven), + string(VirtualMachineSizeTypesStandardASix), + string(VirtualMachineSizeTypesStandardAThree), + string(VirtualMachineSizeTypesStandardATwo), + string(VirtualMachineSizeTypesStandardATwoVTwo), + string(VirtualMachineSizeTypesStandardATwomVTwo), + string(VirtualMachineSizeTypesStandardAZero), + string(VirtualMachineSizeTypesStandardBEightms), + string(VirtualMachineSizeTypesStandardBFourms), + string(VirtualMachineSizeTypesStandardBOnems), + string(VirtualMachineSizeTypesStandardBOnes), + string(VirtualMachineSizeTypesStandardBTwoms), + string(VirtualMachineSizeTypesStandardBTwos), + string(VirtualMachineSizeTypesStandardDEightVThree), + string(VirtualMachineSizeTypesStandardDEightsVThree), + string(VirtualMachineSizeTypesStandardDFiveVTwo), + string(VirtualMachineSizeTypesStandardDFour), + string(VirtualMachineSizeTypesStandardDFourVThree), + string(VirtualMachineSizeTypesStandardDFourVTwo), + string(VirtualMachineSizeTypesStandardDFoursVThree), + string(VirtualMachineSizeTypesStandardDOne), + string(VirtualMachineSizeTypesStandardDOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDOneFour), + string(VirtualMachineSizeTypesStandardDOneFourVTwo), + string(VirtualMachineSizeTypesStandardDOneOne), + string(VirtualMachineSizeTypesStandardDOneOneVTwo), + string(VirtualMachineSizeTypesStandardDOneSixVThree), + string(VirtualMachineSizeTypesStandardDOneSixsVThree), + string(VirtualMachineSizeTypesStandardDOneThree), + string(VirtualMachineSizeTypesStandardDOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDOneTwo), + string(VirtualMachineSizeTypesStandardDOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDOneVTwo), + string(VirtualMachineSizeTypesStandardDSFiveVTwo), + string(VirtualMachineSizeTypesStandardDSFour), + string(VirtualMachineSizeTypesStandardDSFourVTwo), + string(VirtualMachineSizeTypesStandardDSOne), + string(VirtualMachineSizeTypesStandardDSOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDSOneFour), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneOne), + string(VirtualMachineSizeTypesStandardDSOneOneVTwo), + string(VirtualMachineSizeTypesStandardDSOneThree), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDSOneTwo), + string(VirtualMachineSizeTypesStandardDSOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneVTwo), + string(VirtualMachineSizeTypesStandardDSThree), + string(VirtualMachineSizeTypesStandardDSThreeVTwo), + string(VirtualMachineSizeTypesStandardDSTwo), + string(VirtualMachineSizeTypesStandardDSTwoVTwo), + string(VirtualMachineSizeTypesStandardDSixFourVThree), + string(VirtualMachineSizeTypesStandardDSixFoursVThree), + string(VirtualMachineSizeTypesStandardDThree), + string(VirtualMachineSizeTypesStandardDThreeTwoVThree), + string(VirtualMachineSizeTypesStandardDThreeTwosVThree), + string(VirtualMachineSizeTypesStandardDThreeVTwo), + string(VirtualMachineSizeTypesStandardDTwo), + string(VirtualMachineSizeTypesStandardDTwoVThree), + string(VirtualMachineSizeTypesStandardDTwoVTwo), + string(VirtualMachineSizeTypesStandardDTwosVThree), + string(VirtualMachineSizeTypesStandardEEightVThree), + string(VirtualMachineSizeTypesStandardEEightsVThree), + string(VirtualMachineSizeTypesStandardEFourVThree), + string(VirtualMachineSizeTypesStandardEFoursVThree), + string(VirtualMachineSizeTypesStandardEOneSixVThree), + string(VirtualMachineSizeTypesStandardEOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree), + string(VirtualMachineSizeTypesStandardESixFourVThree), + string(VirtualMachineSizeTypesStandardESixFoursVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoVThree), + string(VirtualMachineSizeTypesStandardEThreeTwosVThree), + string(VirtualMachineSizeTypesStandardETwoVThree), + string(VirtualMachineSizeTypesStandardETwosVThree), + string(VirtualMachineSizeTypesStandardFEight), + string(VirtualMachineSizeTypesStandardFEights), + string(VirtualMachineSizeTypesStandardFEightsVTwo), + string(VirtualMachineSizeTypesStandardFFour), + string(VirtualMachineSizeTypesStandardFFours), + string(VirtualMachineSizeTypesStandardFFoursVTwo), + string(VirtualMachineSizeTypesStandardFOne), + string(VirtualMachineSizeTypesStandardFOneSix), + string(VirtualMachineSizeTypesStandardFOneSixs), + string(VirtualMachineSizeTypesStandardFOneSixsVTwo), + string(VirtualMachineSizeTypesStandardFOnes), + string(VirtualMachineSizeTypesStandardFSevenTwosVTwo), + string(VirtualMachineSizeTypesStandardFSixFoursVTwo), + string(VirtualMachineSizeTypesStandardFThreeTwosVTwo), + string(VirtualMachineSizeTypesStandardFTwo), + string(VirtualMachineSizeTypesStandardFTwos), + string(VirtualMachineSizeTypesStandardFTwosVTwo), + string(VirtualMachineSizeTypesStandardGFive), + string(VirtualMachineSizeTypesStandardGFour), + string(VirtualMachineSizeTypesStandardGOne), + string(VirtualMachineSizeTypesStandardGSFive), + string(VirtualMachineSizeTypesStandardGSFiveNegativeEight), + string(VirtualMachineSizeTypesStandardGSFiveNegativeOneSix), + string(VirtualMachineSizeTypesStandardGSFour), + string(VirtualMachineSizeTypesStandardGSFourNegativeEight), + string(VirtualMachineSizeTypesStandardGSFourNegativeFour), + string(VirtualMachineSizeTypesStandardGSOne), + string(VirtualMachineSizeTypesStandardGSThree), + string(VirtualMachineSizeTypesStandardGSTwo), + string(VirtualMachineSizeTypesStandardGThree), + string(VirtualMachineSizeTypesStandardGTwo), + string(VirtualMachineSizeTypesStandardHEight), + string(VirtualMachineSizeTypesStandardHEightm), + string(VirtualMachineSizeTypesStandardHOneSix), + string(VirtualMachineSizeTypesStandardHOneSixm), + string(VirtualMachineSizeTypesStandardHOneSixmr), + string(VirtualMachineSizeTypesStandardHOneSixr), + string(VirtualMachineSizeTypesStandardLEights), + string(VirtualMachineSizeTypesStandardLFours), + string(VirtualMachineSizeTypesStandardLOneSixs), + string(VirtualMachineSizeTypesStandardLThreeTwos), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMOneTwoEightms), + string(VirtualMachineSizeTypesStandardMOneTwoEights), + string(VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms), + string(VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMSixFourms), + string(VirtualMachineSizeTypesStandardMSixFours), + string(VirtualMachineSizeTypesStandardNCOneTwo), + string(VirtualMachineSizeTypesStandardNCOneTwosVThree), + string(VirtualMachineSizeTypesStandardNCOneTwosVTwo), + string(VirtualMachineSizeTypesStandardNCSix), + string(VirtualMachineSizeTypesStandardNCSixsVThree), + string(VirtualMachineSizeTypesStandardNCSixsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFour), + string(VirtualMachineSizeTypesStandardNCTwoFourr), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVThree), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFoursVThree), + string(VirtualMachineSizeTypesStandardNCTwoFoursVTwo), + string(VirtualMachineSizeTypesStandardNDOneTwos), + string(VirtualMachineSizeTypesStandardNDSixs), + string(VirtualMachineSizeTypesStandardNDTwoFourrs), + string(VirtualMachineSizeTypesStandardNDTwoFours), + string(VirtualMachineSizeTypesStandardNVOneTwo), + string(VirtualMachineSizeTypesStandardNVSix), + string(VirtualMachineSizeTypesStandardNVTwoFour), + } +} + +func (s *VirtualMachineSizeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineSizeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineSizeTypes(input string) (*VirtualMachineSizeTypes, error) { + vals := map[string]VirtualMachineSizeTypes{ + "basic_a4": VirtualMachineSizeTypesBasicAFour, + "basic_a1": VirtualMachineSizeTypesBasicAOne, + "basic_a3": VirtualMachineSizeTypesBasicAThree, + "basic_a2": VirtualMachineSizeTypesBasicATwo, + "basic_a0": VirtualMachineSizeTypesBasicAZero, + "standard_a8": VirtualMachineSizeTypesStandardAEight, + "standard_a8_v2": VirtualMachineSizeTypesStandardAEightVTwo, + "standard_a8m_v2": VirtualMachineSizeTypesStandardAEightmVTwo, + "standard_a5": VirtualMachineSizeTypesStandardAFive, + "standard_a4": VirtualMachineSizeTypesStandardAFour, + "standard_a4_v2": VirtualMachineSizeTypesStandardAFourVTwo, + "standard_a4m_v2": VirtualMachineSizeTypesStandardAFourmVTwo, + "standard_a9": VirtualMachineSizeTypesStandardANine, + "standard_a1": VirtualMachineSizeTypesStandardAOne, + "standard_a11": VirtualMachineSizeTypesStandardAOneOne, + "standard_a1_v2": VirtualMachineSizeTypesStandardAOneVTwo, + "standard_a10": VirtualMachineSizeTypesStandardAOneZero, + "standard_a7": VirtualMachineSizeTypesStandardASeven, + "standard_a6": VirtualMachineSizeTypesStandardASix, + "standard_a3": VirtualMachineSizeTypesStandardAThree, + "standard_a2": VirtualMachineSizeTypesStandardATwo, + "standard_a2_v2": VirtualMachineSizeTypesStandardATwoVTwo, + "standard_a2m_v2": VirtualMachineSizeTypesStandardATwomVTwo, + "standard_a0": VirtualMachineSizeTypesStandardAZero, + "standard_b8ms": VirtualMachineSizeTypesStandardBEightms, + "standard_b4ms": VirtualMachineSizeTypesStandardBFourms, + "standard_b1ms": VirtualMachineSizeTypesStandardBOnems, + "standard_b1s": VirtualMachineSizeTypesStandardBOnes, + "standard_b2ms": VirtualMachineSizeTypesStandardBTwoms, + "standard_b2s": VirtualMachineSizeTypesStandardBTwos, + "standard_d8_v3": VirtualMachineSizeTypesStandardDEightVThree, + "standard_d8s_v3": VirtualMachineSizeTypesStandardDEightsVThree, + "standard_d5_v2": VirtualMachineSizeTypesStandardDFiveVTwo, + "standard_d4": VirtualMachineSizeTypesStandardDFour, + "standard_d4_v3": VirtualMachineSizeTypesStandardDFourVThree, + "standard_d4_v2": VirtualMachineSizeTypesStandardDFourVTwo, + "standard_d4s_v3": VirtualMachineSizeTypesStandardDFoursVThree, + "standard_d1": VirtualMachineSizeTypesStandardDOne, + "standard_d15_v2": VirtualMachineSizeTypesStandardDOneFiveVTwo, + "standard_d14": VirtualMachineSizeTypesStandardDOneFour, + "standard_d14_v2": VirtualMachineSizeTypesStandardDOneFourVTwo, + "standard_d11": VirtualMachineSizeTypesStandardDOneOne, + "standard_d11_v2": VirtualMachineSizeTypesStandardDOneOneVTwo, + "standard_d16_v3": VirtualMachineSizeTypesStandardDOneSixVThree, + "standard_d16s_v3": VirtualMachineSizeTypesStandardDOneSixsVThree, + "standard_d13": VirtualMachineSizeTypesStandardDOneThree, + "standard_d13_v2": VirtualMachineSizeTypesStandardDOneThreeVTwo, + "standard_d12": VirtualMachineSizeTypesStandardDOneTwo, + "standard_d12_v2": VirtualMachineSizeTypesStandardDOneTwoVTwo, + "standard_d1_v2": VirtualMachineSizeTypesStandardDOneVTwo, + "standard_ds5_v2": VirtualMachineSizeTypesStandardDSFiveVTwo, + "standard_ds4": VirtualMachineSizeTypesStandardDSFour, + "standard_ds4_v2": VirtualMachineSizeTypesStandardDSFourVTwo, + "standard_ds1": VirtualMachineSizeTypesStandardDSOne, + "standard_ds15_v2": VirtualMachineSizeTypesStandardDSOneFiveVTwo, + "standard_ds14": VirtualMachineSizeTypesStandardDSOneFour, + "standard_ds14-8_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo, + "standard_ds14-4_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo, + "standard_ds14_v2": VirtualMachineSizeTypesStandardDSOneFourVTwo, + "standard_ds11": VirtualMachineSizeTypesStandardDSOneOne, + "standard_ds11_v2": VirtualMachineSizeTypesStandardDSOneOneVTwo, + "standard_ds13": VirtualMachineSizeTypesStandardDSOneThree, + "standard_ds13-4_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo, + "standard_ds13-2_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo, + "standard_ds13_v2": VirtualMachineSizeTypesStandardDSOneThreeVTwo, + "standard_ds12": VirtualMachineSizeTypesStandardDSOneTwo, + "standard_ds12_v2": VirtualMachineSizeTypesStandardDSOneTwoVTwo, + "standard_ds1_v2": VirtualMachineSizeTypesStandardDSOneVTwo, + "standard_ds3": VirtualMachineSizeTypesStandardDSThree, + "standard_ds3_v2": VirtualMachineSizeTypesStandardDSThreeVTwo, + "standard_ds2": VirtualMachineSizeTypesStandardDSTwo, + "standard_ds2_v2": VirtualMachineSizeTypesStandardDSTwoVTwo, + "standard_d64_v3": VirtualMachineSizeTypesStandardDSixFourVThree, + "standard_d64s_v3": VirtualMachineSizeTypesStandardDSixFoursVThree, + "standard_d3": VirtualMachineSizeTypesStandardDThree, + "standard_d32_v3": VirtualMachineSizeTypesStandardDThreeTwoVThree, + "standard_d32s_v3": VirtualMachineSizeTypesStandardDThreeTwosVThree, + "standard_d3_v2": VirtualMachineSizeTypesStandardDThreeVTwo, + "standard_d2": VirtualMachineSizeTypesStandardDTwo, + "standard_d2_v3": VirtualMachineSizeTypesStandardDTwoVThree, + "standard_d2_v2": VirtualMachineSizeTypesStandardDTwoVTwo, + "standard_d2s_v3": VirtualMachineSizeTypesStandardDTwosVThree, + "standard_e8_v3": VirtualMachineSizeTypesStandardEEightVThree, + "standard_e8s_v3": VirtualMachineSizeTypesStandardEEightsVThree, + "standard_e4_v3": VirtualMachineSizeTypesStandardEFourVThree, + "standard_e4s_v3": VirtualMachineSizeTypesStandardEFoursVThree, + "standard_e16_v3": VirtualMachineSizeTypesStandardEOneSixVThree, + "standard_e16s_v3": VirtualMachineSizeTypesStandardEOneSixsVThree, + "standard_e64-16s_v3": VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree, + "standard_e64-32s_v3": VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree, + "standard_e64_v3": VirtualMachineSizeTypesStandardESixFourVThree, + "standard_e64s_v3": VirtualMachineSizeTypesStandardESixFoursVThree, + "standard_e32-8s_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree, + "standard_e32-16_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree, + "standard_e32_v3": VirtualMachineSizeTypesStandardEThreeTwoVThree, + "standard_e32s_v3": VirtualMachineSizeTypesStandardEThreeTwosVThree, + "standard_e2_v3": VirtualMachineSizeTypesStandardETwoVThree, + "standard_e2s_v3": VirtualMachineSizeTypesStandardETwosVThree, + "standard_f8": VirtualMachineSizeTypesStandardFEight, + "standard_f8s": VirtualMachineSizeTypesStandardFEights, + "standard_f8s_v2": VirtualMachineSizeTypesStandardFEightsVTwo, + "standard_f4": VirtualMachineSizeTypesStandardFFour, + "standard_f4s": VirtualMachineSizeTypesStandardFFours, + "standard_f4s_v2": VirtualMachineSizeTypesStandardFFoursVTwo, + "standard_f1": VirtualMachineSizeTypesStandardFOne, + "standard_f16": VirtualMachineSizeTypesStandardFOneSix, + "standard_f16s": VirtualMachineSizeTypesStandardFOneSixs, + "standard_f16s_v2": VirtualMachineSizeTypesStandardFOneSixsVTwo, + "standard_f1s": VirtualMachineSizeTypesStandardFOnes, + "standard_f72s_v2": VirtualMachineSizeTypesStandardFSevenTwosVTwo, + "standard_f64s_v2": VirtualMachineSizeTypesStandardFSixFoursVTwo, + "standard_f32s_v2": VirtualMachineSizeTypesStandardFThreeTwosVTwo, + "standard_f2": VirtualMachineSizeTypesStandardFTwo, + "standard_f2s": VirtualMachineSizeTypesStandardFTwos, + "standard_f2s_v2": VirtualMachineSizeTypesStandardFTwosVTwo, + "standard_g5": VirtualMachineSizeTypesStandardGFive, + "standard_g4": VirtualMachineSizeTypesStandardGFour, + "standard_g1": VirtualMachineSizeTypesStandardGOne, + "standard_gs5": VirtualMachineSizeTypesStandardGSFive, + "standard_gs5-8": VirtualMachineSizeTypesStandardGSFiveNegativeEight, + "standard_gs5-16": VirtualMachineSizeTypesStandardGSFiveNegativeOneSix, + "standard_gs4": VirtualMachineSizeTypesStandardGSFour, + "standard_gs4-8": VirtualMachineSizeTypesStandardGSFourNegativeEight, + "standard_gs4-4": VirtualMachineSizeTypesStandardGSFourNegativeFour, + "standard_gs1": VirtualMachineSizeTypesStandardGSOne, + "standard_gs3": VirtualMachineSizeTypesStandardGSThree, + "standard_gs2": VirtualMachineSizeTypesStandardGSTwo, + "standard_g3": VirtualMachineSizeTypesStandardGThree, + "standard_g2": VirtualMachineSizeTypesStandardGTwo, + "standard_h8": VirtualMachineSizeTypesStandardHEight, + "standard_h8m": VirtualMachineSizeTypesStandardHEightm, + "standard_h16": VirtualMachineSizeTypesStandardHOneSix, + "standard_h16m": VirtualMachineSizeTypesStandardHOneSixm, + "standard_h16mr": VirtualMachineSizeTypesStandardHOneSixmr, + "standard_h16r": VirtualMachineSizeTypesStandardHOneSixr, + "standard_l8s": VirtualMachineSizeTypesStandardLEights, + "standard_l4s": VirtualMachineSizeTypesStandardLFours, + "standard_l16s": VirtualMachineSizeTypesStandardLOneSixs, + "standard_l32s": VirtualMachineSizeTypesStandardLThreeTwos, + "standard_m128-64ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms, + "standard_m128-32ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms, + "standard_m128ms": VirtualMachineSizeTypesStandardMOneTwoEightms, + "standard_m128s": VirtualMachineSizeTypesStandardMOneTwoEights, + "standard_m64-16ms": VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms, + "standard_m64-32ms": VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms, + "standard_m64ms": VirtualMachineSizeTypesStandardMSixFourms, + "standard_m64s": VirtualMachineSizeTypesStandardMSixFours, + "standard_nc12": VirtualMachineSizeTypesStandardNCOneTwo, + "standard_nc12s_v3": VirtualMachineSizeTypesStandardNCOneTwosVThree, + "standard_nc12s_v2": VirtualMachineSizeTypesStandardNCOneTwosVTwo, + "standard_nc6": VirtualMachineSizeTypesStandardNCSix, + "standard_nc6s_v3": VirtualMachineSizeTypesStandardNCSixsVThree, + "standard_nc6s_v2": VirtualMachineSizeTypesStandardNCSixsVTwo, + "standard_nc24": VirtualMachineSizeTypesStandardNCTwoFour, + "standard_nc24r": VirtualMachineSizeTypesStandardNCTwoFourr, + "standard_nc24rs_v3": VirtualMachineSizeTypesStandardNCTwoFourrsVThree, + "standard_nc24rs_v2": VirtualMachineSizeTypesStandardNCTwoFourrsVTwo, + "standard_nc24s_v3": VirtualMachineSizeTypesStandardNCTwoFoursVThree, + "standard_nc24s_v2": VirtualMachineSizeTypesStandardNCTwoFoursVTwo, + "standard_nd12s": VirtualMachineSizeTypesStandardNDOneTwos, + "standard_nd6s": VirtualMachineSizeTypesStandardNDSixs, + "standard_nd24rs": VirtualMachineSizeTypesStandardNDTwoFourrs, + "standard_nd24s": VirtualMachineSizeTypesStandardNDTwoFours, + "standard_nv12": VirtualMachineSizeTypesStandardNVOneTwo, + "standard_nv6": VirtualMachineSizeTypesStandardNVSix, + "standard_nv24": VirtualMachineSizeTypesStandardNVTwoFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineSizeTypes(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/id_restorepoint.go b/resource-manager/compute/2025-04-01/restorepoints/id_restorepoint.go new file mode 100644 index 00000000000..5644a05c4f4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/id_restorepoint.go @@ -0,0 +1,139 @@ +package restorepoints + +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(&RestorePointId{}) +} + +var _ resourceids.ResourceId = &RestorePointId{} + +// RestorePointId is a struct representing the Resource ID for a Restore Point +type RestorePointId struct { + SubscriptionId string + ResourceGroupName string + RestorePointCollectionName string + RestorePointName string +} + +// NewRestorePointID returns a new RestorePointId struct +func NewRestorePointID(subscriptionId string, resourceGroupName string, restorePointCollectionName string, restorePointName string) RestorePointId { + return RestorePointId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RestorePointCollectionName: restorePointCollectionName, + RestorePointName: restorePointName, + } +} + +// ParseRestorePointID parses 'input' into a RestorePointId +func ParseRestorePointID(input string) (*RestorePointId, error) { + parser := resourceids.NewParserFromResourceIdType(&RestorePointId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RestorePointId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRestorePointIDInsensitively parses 'input' case-insensitively into a RestorePointId +// note: this method should only be used for API response data and not user input +func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { + parser := resourceids.NewParserFromResourceIdType(&RestorePointId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RestorePointId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointId) 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.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) + } + + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) + } + + return nil +} + +// ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID +func ValidateRestorePointID(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 := ParseRestorePointID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Restore Point ID +func (id RestorePointId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/restorePointCollections/%s/restorePoints/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RestorePointCollectionName, id.RestorePointName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Restore Point ID +func (id RestorePointId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticRestorePointCollections", "restorePointCollections", "restorePointCollections"), + resourceids.UserSpecifiedSegment("restorePointCollectionName", "restorePointCollectionName"), + resourceids.StaticSegment("staticRestorePoints", "restorePoints", "restorePoints"), + resourceids.UserSpecifiedSegment("restorePointName", "restorePointName"), + } +} + +// String returns a human-readable description of this Restore Point ID +func (id RestorePointId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Restore Point Collection Name: %q", id.RestorePointCollectionName), + fmt.Sprintf("Restore Point Name: %q", id.RestorePointName), + } + return fmt.Sprintf("Restore Point (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/id_restorepoint_test.go b/resource-manager/compute/2025-04-01/restorepoints/id_restorepoint_test.go new file mode 100644 index 00000000000..ea64d98dc47 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/id_restorepoint_test.go @@ -0,0 +1,327 @@ +package restorepoints + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &RestorePointId{} + +func TestNewRestorePointID(t *testing.T) { + id := NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.RestorePointCollectionName != "restorePointCollectionName" { + t.Fatalf("Expected %q but got %q for Segment 'RestorePointCollectionName'", id.RestorePointCollectionName, "restorePointCollectionName") + } + + if id.RestorePointName != "restorePointName" { + t.Fatalf("Expected %q but got %q for Segment 'RestorePointName'", id.RestorePointName, "restorePointName") + } +} + +func TestFormatRestorePointID(t *testing.T) { + actual := NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRestorePointID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RestorePointId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName", + Expected: &RestorePointId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RestorePointCollectionName: "restorePointCollectionName", + RestorePointName: "restorePointName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRestorePointID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RestorePointCollectionName != v.Expected.RestorePointCollectionName { + t.Fatalf("Expected %q but got %q for RestorePointCollectionName", v.Expected.RestorePointCollectionName, actual.RestorePointCollectionName) + } + + if actual.RestorePointName != v.Expected.RestorePointName { + t.Fatalf("Expected %q but got %q for RestorePointName", v.Expected.RestorePointName, actual.RestorePointName) + } + + } +} + +func TestParseRestorePointIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RestorePointId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE/rEsToRePoInTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName", + Expected: &RestorePointId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RestorePointCollectionName: "restorePointCollectionName", + RestorePointName: "restorePointName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE/rEsToRePoInTs/rEsToRePoInTnAmE", + Expected: &RestorePointId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RestorePointCollectionName: "rEsToRePoInTcOlLeCtIoNnAmE", + RestorePointName: "rEsToRePoInTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE/rEsToRePoInTs/rEsToRePoInTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRestorePointIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RestorePointCollectionName != v.Expected.RestorePointCollectionName { + t.Fatalf("Expected %q but got %q for RestorePointCollectionName", v.Expected.RestorePointCollectionName, actual.RestorePointCollectionName) + } + + if actual.RestorePointName != v.Expected.RestorePointName { + t.Fatalf("Expected %q but got %q for RestorePointName", v.Expected.RestorePointName, actual.RestorePointName) + } + + } +} + +func TestSegmentsForRestorePointId(t *testing.T) { + segments := RestorePointId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RestorePointId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/method_create.go b/resource-manager/compute/2025-04-01/restorepoints/method_create.go new file mode 100644 index 00000000000..25a29454e02 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/method_create.go @@ -0,0 +1,74 @@ +package restorepoints + +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 CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RestorePoint +} + +// Create ... +func (c RestorePointsClient) Create(ctx context.Context, id RestorePointId, input RestorePoint) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + }, + 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 +} + +// CreateThenPoll performs Create then polls until it's completed +func (c RestorePointsClient) CreateThenPoll(ctx context.Context, id RestorePointId, input RestorePoint) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/method_delete.go b/resource-manager/compute/2025-04-01/restorepoints/method_delete.go new file mode 100644 index 00000000000..6830e37f87d --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/method_delete.go @@ -0,0 +1,71 @@ +package restorepoints + +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 RestorePointsClient) Delete(ctx context.Context, id RestorePointId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c RestorePointsClient) DeleteThenPoll(ctx context.Context, id RestorePointId) 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/resource-manager/compute/2025-04-01/restorepoints/method_get.go b/resource-manager/compute/2025-04-01/restorepoints/method_get.go new file mode 100644 index 00000000000..ccf229525cb --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/method_get.go @@ -0,0 +1,83 @@ +package restorepoints + +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 *RestorePoint +} + +type GetOperationOptions struct { + Expand *RestorePointExpandOptions +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c RestorePointsClient) Get(ctx context.Context, id RestorePointId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 RestorePoint + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_additionalunattendcontent.go b/resource-manager/compute/2025-04-01/restorepoints/model_additionalunattendcontent.go new file mode 100644 index 00000000000..dc077d5c982 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentName `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassName `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_apientityreference.go b/resource-manager/compute/2025-04-01/restorepoints/model_apientityreference.go new file mode 100644 index 00000000000..babd48c96f3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_apientityreference.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_bootdiagnostics.go b/resource-manager/compute/2025-04-01/restorepoints/model_bootdiagnostics.go new file mode 100644 index 00000000000..2504b8f2cd9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_diagnosticsprofile.go b/resource-manager/compute/2025-04-01/restorepoints/model_diagnosticsprofile.go new file mode 100644 index 00000000000..7da951f723e --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_diskencryptionsettings.go b/resource-manager/compute/2025-04-01/restorepoints/model_diskencryptionsettings.go new file mode 100644 index 00000000000..5fbbed53677 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_diskencryptionsettings.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_diskrestorepointattributes.go b/resource-manager/compute/2025-04-01/restorepoints/model_diskrestorepointattributes.go new file mode 100644 index 00000000000..22984929525 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_diskrestorepointattributes.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointAttributes struct { + Encryption *RestorePointEncryption `json:"encryption,omitempty"` + Id *string `json:"id,omitempty"` + SourceDiskRestorePoint *ApiEntityReference `json:"sourceDiskRestorePoint,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_diskrestorepointinstanceview.go b/resource-manager/compute/2025-04-01/restorepoints/model_diskrestorepointinstanceview.go new file mode 100644 index 00000000000..8179a9e7af8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_diskrestorepointinstanceview.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointInstanceView struct { + Id *string `json:"id,omitempty"` + ReplicationStatus *DiskRestorePointReplicationStatus `json:"replicationStatus,omitempty"` + SnapshotAccessState *SnapshotAccessState `json:"snapshotAccessState,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_diskrestorepointreplicationstatus.go b/resource-manager/compute/2025-04-01/restorepoints/model_diskrestorepointreplicationstatus.go new file mode 100644 index 00000000000..40951229dac --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_diskrestorepointreplicationstatus.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointReplicationStatus struct { + CompletionPercent *int64 `json:"completionPercent,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_encryptionidentity.go b/resource-manager/compute/2025-04-01/restorepoints/model_encryptionidentity.go new file mode 100644 index 00000000000..3d64c837abc --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionIdentity struct { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_hardwareprofile.go b/resource-manager/compute/2025-04-01/restorepoints/model_hardwareprofile.go new file mode 100644 index 00000000000..6284b4bfbea --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_hardwareprofile.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_hostendpointsettings.go b/resource-manager/compute/2025-04-01/restorepoints/model_hostendpointsettings.go new file mode 100644 index 00000000000..e719148bc61 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/restorepoints/model_instanceviewstatus.go new file mode 100644 index 00000000000..bb4210653e0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package restorepoints + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_keyvaultkeyreference.go b/resource-manager/compute/2025-04-01/restorepoints/model_keyvaultkeyreference.go new file mode 100644 index 00000000000..a84afc6404c --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_keyvaultkeyreference.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyURL string `json:"keyUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_keyvaultsecretreference.go b/resource-manager/compute/2025-04-01/restorepoints/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..473adafc492 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_linuxconfiguration.go b/resource-manager/compute/2025-04-01/restorepoints/model_linuxconfiguration.go new file mode 100644 index 00000000000..c61f1ead4b8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_linuxpatchsettings.go b/resource-manager/compute/2025-04-01/restorepoints/model_linuxpatchsettings.go new file mode 100644 index 00000000000..4363078db3a --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/restorepoints/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..3ed5d0d1c14 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_manageddiskparameters.go b/resource-manager/compute/2025-04-01/restorepoints/model_manageddiskparameters.go new file mode 100644 index 00000000000..c60383cf664 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_manageddiskparameters.go @@ -0,0 +1,11 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Id *string `json:"id,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_osprofile.go b/resource-manager/compute/2025-04-01/restorepoints/model_osprofile.go new file mode 100644 index 00000000000..0bb7cb7670b --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_osprofile.go @@ -0,0 +1,16 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_patchsettings.go b/resource-manager/compute/2025-04-01/restorepoints/model_patchsettings.go new file mode 100644 index 00000000000..3e237d16e78 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_patchsettings.go @@ -0,0 +1,11 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_proxyagentsettings.go b/resource-manager/compute/2025-04-01/restorepoints/model_proxyagentsettings.go new file mode 100644 index 00000000000..e3a9705bdb3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_proxyagentsettings.go @@ -0,0 +1,13 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + AddProxyAgentExtension *bool `json:"addProxyAgentExtension,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_restorepoint.go b/resource-manager/compute/2025-04-01/restorepoints/model_restorepoint.go new file mode 100644 index 00000000000..3160a5aa9a7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_restorepoint.go @@ -0,0 +1,16 @@ +package restorepoints + +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 RestorePoint struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RestorePointProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_restorepointencryption.go b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointencryption.go new file mode 100644 index 00000000000..7c39e4aeb50 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointencryption.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointEncryption struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Type *RestorePointEncryptionType `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_restorepointinstanceview.go b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointinstanceview.go new file mode 100644 index 00000000000..d91bef8b2c7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointinstanceview.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointInstanceView struct { + DiskRestorePoints *[]DiskRestorePointInstanceView `json:"diskRestorePoints,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_restorepointproperties.go b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointproperties.go new file mode 100644 index 00000000000..1ea8847702f --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointproperties.go @@ -0,0 +1,33 @@ +package restorepoints + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointProperties struct { + ConsistencyMode *ConsistencyModeTypes `json:"consistencyMode,omitempty"` + ExcludeDisks *[]ApiEntityReference `json:"excludeDisks,omitempty"` + InstanceView *RestorePointInstanceView `json:"instanceView,omitempty"` + InstantAccessDurationMinutes *int64 `json:"instantAccessDurationMinutes,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SourceMetadata *RestorePointSourceMetadata `json:"sourceMetadata,omitempty"` + SourceRestorePoint *ApiEntityReference `json:"sourceRestorePoint,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` +} + +func (o *RestorePointProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *RestorePointProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcemetadata.go b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcemetadata.go new file mode 100644 index 00000000000..4a71d34dcb1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcemetadata.go @@ -0,0 +1,17 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceMetadata struct { + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + Location *string `json:"location,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *RestorePointSourceVMStorageProfile `json:"storageProfile,omitempty"` + UserData *string `json:"userData,omitempty"` + VMId *string `json:"vmId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcevmdatadisk.go b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcevmdatadisk.go new file mode 100644 index 00000000000..846b38eea30 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcevmdatadisk.go @@ -0,0 +1,14 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMDataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DiskRestorePoint *DiskRestorePointAttributes `json:"diskRestorePoint,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun *int64 `json:"lun,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcevmosdisk.go b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcevmosdisk.go new file mode 100644 index 00000000000..f61bf9ba4f5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcevmosdisk.go @@ -0,0 +1,15 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMOSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DiskRestorePoint *DiskRestorePointAttributes `json:"diskRestorePoint,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemType `json:"osType,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcevmstorageprofile.go b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcevmstorageprofile.go new file mode 100644 index 00000000000..6122c5ab170 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_restorepointsourcevmstorageprofile.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMStorageProfile struct { + DataDisks *[]RestorePointSourceVMDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + OsDisk *RestorePointSourceVMOSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_securityprofile.go b/resource-manager/compute/2025-04-01/restorepoints/model_securityprofile.go new file mode 100644 index 00000000000..944bde89038 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_securityprofile.go @@ -0,0 +1,12 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_sshconfiguration.go b/resource-manager/compute/2025-04-01/restorepoints/model_sshconfiguration.go new file mode 100644 index 00000000000..af61ff07f8f --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_sshpublickey.go b/resource-manager/compute/2025-04-01/restorepoints/model_sshpublickey.go new file mode 100644 index 00000000000..3f9651d567c --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_sshpublickey.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_subresource.go b/resource-manager/compute/2025-04-01/restorepoints/model_subresource.go new file mode 100644 index 00000000000..a2e5c085ec2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_subresource.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_uefisettings.go b/resource-manager/compute/2025-04-01/restorepoints/model_uefisettings.go new file mode 100644 index 00000000000..9878e8a1f4b --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_uefisettings.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_vaultcertificate.go b/resource-manager/compute/2025-04-01/restorepoints/model_vaultcertificate.go new file mode 100644 index 00000000000..7ace154164b --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_vaultsecretgroup.go b/resource-manager/compute/2025-04-01/restorepoints/model_vaultsecretgroup.go new file mode 100644 index 00000000000..04d2ed6ef06 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_vmdisksecurityprofile.go b/resource-manager/compute/2025-04-01/restorepoints/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..bdf4f1b0785 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_vmsizeproperties.go b/resource-manager/compute/2025-04-01/restorepoints/model_vmsizeproperties.go new file mode 100644 index 00000000000..5e877d0f4d5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_windowsconfiguration.go b/resource-manager/compute/2025-04-01/restorepoints/model_windowsconfiguration.go new file mode 100644 index 00000000000..8260015420f --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/restorepoints/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..4a654678566 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_winrmconfiguration.go b/resource-manager/compute/2025-04-01/restorepoints/model_winrmconfiguration.go new file mode 100644 index 00000000000..09a7b12f0d3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/model_winrmlistener.go b/resource-manager/compute/2025-04-01/restorepoints/model_winrmlistener.go new file mode 100644 index 00000000000..7d06a9d1480 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/model_winrmlistener.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/restorepoints/version.go b/resource-manager/compute/2025-04-01/restorepoints/version.go new file mode 100644 index 00000000000..4d7946e96f8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/restorepoints/version.go @@ -0,0 +1,10 @@ +package restorepoints + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/restorepoints/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/README.md b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/README.md new file mode 100644 index 00000000000..6aa37a213c8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/rollingupgradestatusinfos` Documentation + +The `rollingupgradestatusinfos` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/rollingupgradestatusinfos" +``` + + +### Client Initialization + +```go +client := rollingupgradestatusinfos.NewRollingUpgradeStatusInfosClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RollingUpgradeStatusInfosClient.VirtualMachineScaleSetRollingUpgradesGetLatest` + +```go +ctx := context.TODO() +id := rollingupgradestatusinfos.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +read, err := client.VirtualMachineScaleSetRollingUpgradesGetLatest(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/client.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/client.go new file mode 100644 index 00000000000..696839efed8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/client.go @@ -0,0 +1,26 @@ +package rollingupgradestatusinfos + +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 RollingUpgradeStatusInfosClient struct { + Client *resourcemanager.Client +} + +func NewRollingUpgradeStatusInfosClientWithBaseURI(sdkApi sdkEnv.Api) (*RollingUpgradeStatusInfosClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "rollingupgradestatusinfos", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RollingUpgradeStatusInfosClient: %+v", err) + } + + return &RollingUpgradeStatusInfosClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/constants.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/constants.go new file mode 100644 index 00000000000..c3faa7d99f0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/constants.go @@ -0,0 +1,98 @@ +package rollingupgradestatusinfos + +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 RollingUpgradeActionType string + +const ( + RollingUpgradeActionTypeCancel RollingUpgradeActionType = "Cancel" + RollingUpgradeActionTypeStart RollingUpgradeActionType = "Start" +) + +func PossibleValuesForRollingUpgradeActionType() []string { + return []string{ + string(RollingUpgradeActionTypeCancel), + string(RollingUpgradeActionTypeStart), + } +} + +func (s *RollingUpgradeActionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRollingUpgradeActionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRollingUpgradeActionType(input string) (*RollingUpgradeActionType, error) { + vals := map[string]RollingUpgradeActionType{ + "cancel": RollingUpgradeActionTypeCancel, + "start": RollingUpgradeActionTypeStart, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RollingUpgradeActionType(input) + return &out, nil +} + +type RollingUpgradeStatusCode string + +const ( + RollingUpgradeStatusCodeCancelled RollingUpgradeStatusCode = "Cancelled" + RollingUpgradeStatusCodeCompleted RollingUpgradeStatusCode = "Completed" + RollingUpgradeStatusCodeFaulted RollingUpgradeStatusCode = "Faulted" + RollingUpgradeStatusCodeRollingForward RollingUpgradeStatusCode = "RollingForward" +) + +func PossibleValuesForRollingUpgradeStatusCode() []string { + return []string{ + string(RollingUpgradeStatusCodeCancelled), + string(RollingUpgradeStatusCodeCompleted), + string(RollingUpgradeStatusCodeFaulted), + string(RollingUpgradeStatusCodeRollingForward), + } +} + +func (s *RollingUpgradeStatusCode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRollingUpgradeStatusCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRollingUpgradeStatusCode(input string) (*RollingUpgradeStatusCode, error) { + vals := map[string]RollingUpgradeStatusCode{ + "cancelled": RollingUpgradeStatusCodeCancelled, + "completed": RollingUpgradeStatusCodeCompleted, + "faulted": RollingUpgradeStatusCodeFaulted, + "rollingforward": RollingUpgradeStatusCodeRollingForward, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RollingUpgradeStatusCode(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/id_virtualmachinescaleset.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/id_virtualmachinescaleset.go new file mode 100644 index 00000000000..52aeca3e059 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/id_virtualmachinescaleset.go @@ -0,0 +1,130 @@ +package rollingupgradestatusinfos + +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(&VirtualMachineScaleSetId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +// VirtualMachineScaleSetId is a struct representing the Resource ID for a Virtual Machine Scale Set +type VirtualMachineScaleSetId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string +} + +// NewVirtualMachineScaleSetID returns a new VirtualMachineScaleSetId struct +func NewVirtualMachineScaleSetID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string) VirtualMachineScaleSetId { + return VirtualMachineScaleSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + } +} + +// ParseVirtualMachineScaleSetID parses 'input' into a VirtualMachineScaleSetId +func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID +func ValidateVirtualMachineScaleSetID(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 := ParseVirtualMachineScaleSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + } + return fmt.Sprintf("Virtual Machine Scale Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/id_virtualmachinescaleset_test.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/id_virtualmachinescaleset_test.go new file mode 100644 index 00000000000..2f3cef7d636 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/id_virtualmachinescaleset_test.go @@ -0,0 +1,282 @@ +package rollingupgradestatusinfos + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +func TestNewVirtualMachineScaleSetID(t *testing.T) { + id := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } +} + +func TestFormatVirtualMachineScaleSetID(t *testing.T) { + actual := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestParseVirtualMachineScaleSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetId(t *testing.T) { + segments := VirtualMachineScaleSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/method_virtualmachinescalesetrollingupgradesgetlatest.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/method_virtualmachinescalesetrollingupgradesgetlatest.go new file mode 100644 index 00000000000..b21c68a1456 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/method_virtualmachinescalesetrollingupgradesgetlatest.go @@ -0,0 +1,54 @@ +package rollingupgradestatusinfos + +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 VirtualMachineScaleSetRollingUpgradesGetLatestOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RollingUpgradeStatusInfo +} + +// VirtualMachineScaleSetRollingUpgradesGetLatest ... +func (c RollingUpgradeStatusInfosClient) VirtualMachineScaleSetRollingUpgradesGetLatest(ctx context.Context, id VirtualMachineScaleSetId) (result VirtualMachineScaleSetRollingUpgradesGetLatestOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/rollingUpgrades/latest", 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 RollingUpgradeStatusInfo + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_apierror.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_apierror.go new file mode 100644 index 00000000000..8bb31a8f76a --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_apierror.go @@ -0,0 +1,12 @@ +package rollingupgradestatusinfos + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiError struct { + Code *string `json:"code,omitempty"` + Details *[]ApiErrorBase `json:"details,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_apierrorbase.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_apierrorbase.go new file mode 100644 index 00000000000..0ff0b7e8f85 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_apierrorbase.go @@ -0,0 +1,10 @@ +package rollingupgradestatusinfos + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiErrorBase struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_innererror.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_innererror.go new file mode 100644 index 00000000000..34f5d1e1294 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_innererror.go @@ -0,0 +1,9 @@ +package rollingupgradestatusinfos + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InnerError struct { + Errordetail *string `json:"errordetail,omitempty"` + Exceptiontype *string `json:"exceptiontype,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradepolicy.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradepolicy.go new file mode 100644 index 00000000000..25eab4271ad --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradepolicy.go @@ -0,0 +1,15 @@ +package rollingupgradestatusinfos + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradePolicy struct { + EnableCrossZoneUpgrade *bool `json:"enableCrossZoneUpgrade,omitempty"` + MaxBatchInstancePercent *int64 `json:"maxBatchInstancePercent,omitempty"` + MaxSurge *bool `json:"maxSurge,omitempty"` + MaxUnhealthyInstancePercent *int64 `json:"maxUnhealthyInstancePercent,omitempty"` + MaxUnhealthyUpgradedInstancePercent *int64 `json:"maxUnhealthyUpgradedInstancePercent,omitempty"` + PauseTimeBetweenBatches *string `json:"pauseTimeBetweenBatches,omitempty"` + PrioritizeUnhealthyInstances *bool `json:"prioritizeUnhealthyInstances,omitempty"` + RollbackFailedInstancesOnPolicyBreach *bool `json:"rollbackFailedInstancesOnPolicyBreach,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradeprogressinfo.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradeprogressinfo.go new file mode 100644 index 00000000000..6ab1f5a7cf2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradeprogressinfo.go @@ -0,0 +1,11 @@ +package rollingupgradestatusinfos + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradeProgressInfo struct { + FailedInstanceCount *int64 `json:"failedInstanceCount,omitempty"` + InProgressInstanceCount *int64 `json:"inProgressInstanceCount,omitempty"` + PendingInstanceCount *int64 `json:"pendingInstanceCount,omitempty"` + SuccessfulInstanceCount *int64 `json:"successfulInstanceCount,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgraderunningstatus.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgraderunningstatus.go new file mode 100644 index 00000000000..0a7b601b700 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgraderunningstatus.go @@ -0,0 +1,41 @@ +package rollingupgradestatusinfos + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradeRunningStatus struct { + Code *RollingUpgradeStatusCode `json:"code,omitempty"` + LastAction *RollingUpgradeActionType `json:"lastAction,omitempty"` + LastActionTime *string `json:"lastActionTime,omitempty"` + StartTime *string `json:"startTime,omitempty"` +} + +func (o *RollingUpgradeRunningStatus) GetLastActionTimeAsTime() (*time.Time, error) { + if o.LastActionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastActionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RollingUpgradeRunningStatus) SetLastActionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastActionTime = &formatted +} + +func (o *RollingUpgradeRunningStatus) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RollingUpgradeRunningStatus) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradestatusinfo.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradestatusinfo.go new file mode 100644 index 00000000000..ffbd0d6cd00 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradestatusinfo.go @@ -0,0 +1,18 @@ +package rollingupgradestatusinfos + +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 RollingUpgradeStatusInfo struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *RollingUpgradeStatusInfoProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradestatusinfoproperties.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradestatusinfoproperties.go new file mode 100644 index 00000000000..f929949c0f7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/model_rollingupgradestatusinfoproperties.go @@ -0,0 +1,11 @@ +package rollingupgradestatusinfos + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradeStatusInfoProperties struct { + Error *ApiError `json:"error,omitempty"` + Policy *RollingUpgradePolicy `json:"policy,omitempty"` + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty"` + RunningStatus *RollingUpgradeRunningStatus `json:"runningStatus,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/version.go b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/version.go new file mode 100644 index 00000000000..3aba0c5749b --- /dev/null +++ b/resource-manager/compute/2025-04-01/rollingupgradestatusinfos/version.go @@ -0,0 +1,10 @@ +package rollingupgradestatusinfos + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/rollingupgradestatusinfos/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/README.md b/resource-manager/compute/2025-04-01/sshpublickeyresources/README.md new file mode 100644 index 00000000000..5806e951900 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/README.md @@ -0,0 +1,150 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/sshpublickeyresources` Documentation + +The `sshpublickeyresources` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/sshpublickeyresources" +``` + + +### Client Initialization + +```go +client := sshpublickeyresources.NewSshPublicKeyResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SshPublicKeyResourcesClient.SshPublicKeysCreate` + +```go +ctx := context.TODO() +id := sshpublickeyresources.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +payload := sshpublickeyresources.SshPublicKeyResource{ + // ... +} + + +read, err := client.SshPublicKeysCreate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeyResourcesClient.SshPublicKeysDelete` + +```go +ctx := context.TODO() +id := sshpublickeyresources.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +read, err := client.SshPublicKeysDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeyResourcesClient.SshPublicKeysGenerateKeyPair` + +```go +ctx := context.TODO() +id := sshpublickeyresources.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +payload := sshpublickeyresources.SshGenerateKeyPairInputParameters{ + // ... +} + + +read, err := client.SshPublicKeysGenerateKeyPair(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeyResourcesClient.SshPublicKeysGet` + +```go +ctx := context.TODO() +id := sshpublickeyresources.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +read, err := client.SshPublicKeysGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeyResourcesClient.SshPublicKeysListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.SshPublicKeysListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.SshPublicKeysListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SshPublicKeyResourcesClient.SshPublicKeysListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.SshPublicKeysListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.SshPublicKeysListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SshPublicKeyResourcesClient.SshPublicKeysUpdate` + +```go +ctx := context.TODO() +id := sshpublickeyresources.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +payload := sshpublickeyresources.SshPublicKeyUpdateResource{ + // ... +} + + +read, err := client.SshPublicKeysUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/client.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/client.go new file mode 100644 index 00000000000..67f756f32e6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/client.go @@ -0,0 +1,26 @@ +package sshpublickeyresources + +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 SshPublicKeyResourcesClient struct { + Client *resourcemanager.Client +} + +func NewSshPublicKeyResourcesClientWithBaseURI(sdkApi sdkEnv.Api) (*SshPublicKeyResourcesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "sshpublickeyresources", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SshPublicKeyResourcesClient: %+v", err) + } + + return &SshPublicKeyResourcesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/constants.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/constants.go new file mode 100644 index 00000000000..39e77f307ed --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/constants.go @@ -0,0 +1,51 @@ +package sshpublickeyresources + +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 SshEncryptionTypes string + +const ( + SshEncryptionTypesEdTwoFiveFiveOneNine SshEncryptionTypes = "Ed25519" + SshEncryptionTypesRSA SshEncryptionTypes = "RSA" +) + +func PossibleValuesForSshEncryptionTypes() []string { + return []string{ + string(SshEncryptionTypesEdTwoFiveFiveOneNine), + string(SshEncryptionTypesRSA), + } +} + +func (s *SshEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSshEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSshEncryptionTypes(input string) (*SshEncryptionTypes, error) { + vals := map[string]SshEncryptionTypes{ + "ed25519": SshEncryptionTypesEdTwoFiveFiveOneNine, + "rsa": SshEncryptionTypesRSA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SshEncryptionTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/id_sshpublickey.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/id_sshpublickey.go new file mode 100644 index 00000000000..53e0f0b0cb7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/id_sshpublickey.go @@ -0,0 +1,130 @@ +package sshpublickeyresources + +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(&SshPublicKeyId{}) +} + +var _ resourceids.ResourceId = &SshPublicKeyId{} + +// SshPublicKeyId is a struct representing the Resource ID for a Ssh Public Key +type SshPublicKeyId struct { + SubscriptionId string + ResourceGroupName string + SshPublicKeyName string +} + +// NewSshPublicKeyID returns a new SshPublicKeyId struct +func NewSshPublicKeyID(subscriptionId string, resourceGroupName string, sshPublicKeyName string) SshPublicKeyId { + return SshPublicKeyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SshPublicKeyName: sshPublicKeyName, + } +} + +// ParseSshPublicKeyID parses 'input' into a SshPublicKeyId +func ParseSshPublicKeyID(input string) (*SshPublicKeyId, error) { + parser := resourceids.NewParserFromResourceIdType(&SshPublicKeyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SshPublicKeyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSshPublicKeyIDInsensitively parses 'input' case-insensitively into a SshPublicKeyId +// note: this method should only be used for API response data and not user input +func ParseSshPublicKeyIDInsensitively(input string) (*SshPublicKeyId, error) { + parser := resourceids.NewParserFromResourceIdType(&SshPublicKeyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SshPublicKeyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SshPublicKeyId) 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.SshPublicKeyName, ok = input.Parsed["sshPublicKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", input) + } + + return nil +} + +// ValidateSshPublicKeyID checks that 'input' can be parsed as a Ssh Public Key ID +func ValidateSshPublicKeyID(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 := ParseSshPublicKeyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Ssh Public Key ID +func (id SshPublicKeyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/sshPublicKeys/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SshPublicKeyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Ssh Public Key ID +func (id SshPublicKeyId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticSshPublicKeys", "sshPublicKeys", "sshPublicKeys"), + resourceids.UserSpecifiedSegment("sshPublicKeyName", "sshPublicKeyName"), + } +} + +// String returns a human-readable description of this Ssh Public Key ID +func (id SshPublicKeyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Ssh Public Key Name: %q", id.SshPublicKeyName), + } + return fmt.Sprintf("Ssh Public Key (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/id_sshpublickey_test.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/id_sshpublickey_test.go new file mode 100644 index 00000000000..c15845df192 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/id_sshpublickey_test.go @@ -0,0 +1,282 @@ +package sshpublickeyresources + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &SshPublicKeyId{} + +func TestNewSshPublicKeyID(t *testing.T) { + id := NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.SshPublicKeyName != "sshPublicKeyName" { + t.Fatalf("Expected %q but got %q for Segment 'SshPublicKeyName'", id.SshPublicKeyName, "sshPublicKeyName") + } +} + +func TestFormatSshPublicKeyID(t *testing.T) { + actual := NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseSshPublicKeyID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SshPublicKeyId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName", + Expected: &SshPublicKeyId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SshPublicKeyName: "sshPublicKeyName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSshPublicKeyID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SshPublicKeyName != v.Expected.SshPublicKeyName { + t.Fatalf("Expected %q but got %q for SshPublicKeyName", v.Expected.SshPublicKeyName, actual.SshPublicKeyName) + } + + } +} + +func TestParseSshPublicKeyIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SshPublicKeyId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/sShPuBlIcKeYs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName", + Expected: &SshPublicKeyId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SshPublicKeyName: "sshPublicKeyName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/sShPuBlIcKeYs/sShPuBlIcKeYnAmE", + Expected: &SshPublicKeyId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SshPublicKeyName: "sShPuBlIcKeYnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/sShPuBlIcKeYs/sShPuBlIcKeYnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSshPublicKeyIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.SshPublicKeyName != v.Expected.SshPublicKeyName { + t.Fatalf("Expected %q but got %q for SshPublicKeyName", v.Expected.SshPublicKeyName, actual.SshPublicKeyName) + } + + } +} + +func TestSegmentsForSshPublicKeyId(t *testing.T) { + segments := SshPublicKeyId{}.Segments() + if len(segments) == 0 { + t.Fatalf("SshPublicKeyId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeyscreate.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeyscreate.go new file mode 100644 index 00000000000..35a05c66d5c --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeyscreate.go @@ -0,0 +1,58 @@ +package sshpublickeyresources + +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 SshPublicKeysCreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SshPublicKeyResource +} + +// SshPublicKeysCreate ... +func (c SshPublicKeyResourcesClient) SshPublicKeysCreate(ctx context.Context, id SshPublicKeyId, input SshPublicKeyResource) (result SshPublicKeysCreateOperationResponse, 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 + } + + var model SshPublicKeyResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysdelete.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysdelete.go new file mode 100644 index 00000000000..17d96677bb1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysdelete.go @@ -0,0 +1,47 @@ +package sshpublickeyresources + +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 SshPublicKeysDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// SshPublicKeysDelete ... +func (c SshPublicKeyResourcesClient) SshPublicKeysDelete(ctx context.Context, id SshPublicKeyId) (result SshPublicKeysDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysgeneratekeypair.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysgeneratekeypair.go new file mode 100644 index 00000000000..e74d264147e --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysgeneratekeypair.go @@ -0,0 +1,58 @@ +package sshpublickeyresources + +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 SshPublicKeysGenerateKeyPairOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SshPublicKeyGenerateKeyPairResult +} + +// SshPublicKeysGenerateKeyPair ... +func (c SshPublicKeyResourcesClient) SshPublicKeysGenerateKeyPair(ctx context.Context, id SshPublicKeyId, input SshGenerateKeyPairInputParameters) (result SshPublicKeysGenerateKeyPairOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateKeyPair", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SshPublicKeyGenerateKeyPairResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysget.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysget.go new file mode 100644 index 00000000000..05ba8d4c8c0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysget.go @@ -0,0 +1,53 @@ +package sshpublickeyresources + +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 SshPublicKeysGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SshPublicKeyResource +} + +// SshPublicKeysGet ... +func (c SshPublicKeyResourcesClient) SshPublicKeysGet(ctx context.Context, id SshPublicKeyId) (result SshPublicKeysGetOperationResponse, 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 SshPublicKeyResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeyslistbyresourcegroup.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeyslistbyresourcegroup.go new file mode 100644 index 00000000000..5cb749d93c3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeyslistbyresourcegroup.go @@ -0,0 +1,106 @@ +package sshpublickeyresources + +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 SshPublicKeysListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SshPublicKeyResource +} + +type SshPublicKeysListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []SshPublicKeyResource +} + +type SshPublicKeysListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *SshPublicKeysListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// SshPublicKeysListByResourceGroup ... +func (c SshPublicKeyResourcesClient) SshPublicKeysListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result SshPublicKeysListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &SshPublicKeysListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/sshPublicKeys", 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 *[]SshPublicKeyResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// SshPublicKeysListByResourceGroupComplete retrieves all the results into a single object +func (c SshPublicKeyResourcesClient) SshPublicKeysListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (SshPublicKeysListByResourceGroupCompleteResult, error) { + return c.SshPublicKeysListByResourceGroupCompleteMatchingPredicate(ctx, id, SshPublicKeyResourceOperationPredicate{}) +} + +// SshPublicKeysListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SshPublicKeyResourcesClient) SshPublicKeysListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SshPublicKeyResourceOperationPredicate) (result SshPublicKeysListByResourceGroupCompleteResult, err error) { + items := make([]SshPublicKeyResource, 0) + + resp, err := c.SshPublicKeysListByResourceGroup(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 = SshPublicKeysListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeyslistbysubscription.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeyslistbysubscription.go new file mode 100644 index 00000000000..952d3145225 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeyslistbysubscription.go @@ -0,0 +1,106 @@ +package sshpublickeyresources + +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 SshPublicKeysListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SshPublicKeyResource +} + +type SshPublicKeysListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []SshPublicKeyResource +} + +type SshPublicKeysListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *SshPublicKeysListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// SshPublicKeysListBySubscription ... +func (c SshPublicKeyResourcesClient) SshPublicKeysListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result SshPublicKeysListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &SshPublicKeysListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/sshPublicKeys", 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 *[]SshPublicKeyResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// SshPublicKeysListBySubscriptionComplete retrieves all the results into a single object +func (c SshPublicKeyResourcesClient) SshPublicKeysListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (SshPublicKeysListBySubscriptionCompleteResult, error) { + return c.SshPublicKeysListBySubscriptionCompleteMatchingPredicate(ctx, id, SshPublicKeyResourceOperationPredicate{}) +} + +// SshPublicKeysListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SshPublicKeyResourcesClient) SshPublicKeysListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SshPublicKeyResourceOperationPredicate) (result SshPublicKeysListBySubscriptionCompleteResult, err error) { + items := make([]SshPublicKeyResource, 0) + + resp, err := c.SshPublicKeysListBySubscription(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 = SshPublicKeysListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysupdate.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysupdate.go new file mode 100644 index 00000000000..19601d91a7a --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/method_sshpublickeysupdate.go @@ -0,0 +1,57 @@ +package sshpublickeyresources + +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 SshPublicKeysUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SshPublicKeyResource +} + +// SshPublicKeysUpdate ... +func (c SshPublicKeyResourcesClient) SshPublicKeysUpdate(ctx context.Context, id SshPublicKeyId, input SshPublicKeyUpdateResource) (result SshPublicKeysUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SshPublicKeyResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshgeneratekeypairinputparameters.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshgeneratekeypairinputparameters.go new file mode 100644 index 00000000000..fe60b8f2335 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshgeneratekeypairinputparameters.go @@ -0,0 +1,8 @@ +package sshpublickeyresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshGenerateKeyPairInputParameters struct { + EncryptionType *SshEncryptionTypes `json:"encryptionType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeygeneratekeypairresult.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeygeneratekeypairresult.go new file mode 100644 index 00000000000..8c5d91f7156 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeygeneratekeypairresult.go @@ -0,0 +1,10 @@ +package sshpublickeyresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyGenerateKeyPairResult struct { + Id string `json:"id"` + PrivateKey string `json:"privateKey"` + PublicKey string `json:"publicKey"` +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeyresource.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeyresource.go new file mode 100644 index 00000000000..dd312dafb89 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeyresource.go @@ -0,0 +1,18 @@ +package sshpublickeyresources + +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 SshPublicKeyResource struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SshPublicKeyResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeyresourceproperties.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeyresourceproperties.go new file mode 100644 index 00000000000..59db50c5682 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeyresourceproperties.go @@ -0,0 +1,8 @@ +package sshpublickeyresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyResourceProperties struct { + PublicKey *string `json:"publicKey,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeyupdateresource.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeyupdateresource.go new file mode 100644 index 00000000000..f6242d454a2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/model_sshpublickeyupdateresource.go @@ -0,0 +1,9 @@ +package sshpublickeyresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyUpdateResource struct { + Properties *SshPublicKeyResourceProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/sshpublickeyresources/predicates.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/predicates.go new file mode 100644 index 00000000000..8fd9d844b17 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/predicates.go @@ -0,0 +1,32 @@ +package sshpublickeyresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SshPublicKeyResourceOperationPredicate) Matches(input SshPublicKeyResource) 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/resource-manager/compute/2025-04-01/sshpublickeyresources/version.go b/resource-manager/compute/2025-04-01/sshpublickeyresources/version.go new file mode 100644 index 00000000000..ecf3b5c5e86 --- /dev/null +++ b/resource-manager/compute/2025-04-01/sshpublickeyresources/version.go @@ -0,0 +1,10 @@ +package sshpublickeyresources + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/sshpublickeyresources/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/README.md b/resource-manager/compute/2025-04-01/virtualmachineextensions/README.md new file mode 100644 index 00000000000..4059181b116 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/README.md @@ -0,0 +1,98 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachineextensions` Documentation + +The `virtualmachineextensions` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/virtualmachineextensions" +``` + + +### Client Initialization + +```go +client := virtualmachineextensions.NewVirtualMachineExtensionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineExtensionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + +payload := virtualmachineextensions.VirtualMachineExtension{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineExtensionsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineExtensionsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + +read, err := client.Get(ctx, id, virtualmachineextensions.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineExtensionsClient.List` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.List(ctx, id, virtualmachineextensions.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineExtensionsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + +payload := virtualmachineextensions.VirtualMachineExtensionUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/client.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/client.go new file mode 100644 index 00000000000..c049fb742ed --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/client.go @@ -0,0 +1,26 @@ +package virtualmachineextensions + +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 VirtualMachineExtensionsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineExtensionsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineExtensionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachineextensions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineExtensionsClient: %+v", err) + } + + return &VirtualMachineExtensionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/constants.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/constants.go new file mode 100644 index 00000000000..d07852c0696 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/constants.go @@ -0,0 +1,54 @@ +package virtualmachineextensions + +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 StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/id_extension.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/id_extension.go new file mode 100644 index 00000000000..72168cd7ce0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/id_extension.go @@ -0,0 +1,139 @@ +package virtualmachineextensions + +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(&ExtensionId{}) +} + +var _ resourceids.ResourceId = &ExtensionId{} + +// ExtensionId is a struct representing the Resource ID for a Extension +type ExtensionId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string + ExtensionName string +} + +// NewExtensionID returns a new ExtensionId struct +func NewExtensionID(subscriptionId string, resourceGroupName string, virtualMachineName string, extensionName string) ExtensionId { + return ExtensionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + ExtensionName: extensionName, + } +} + +// ParseExtensionID parses 'input' into a ExtensionId +func ParseExtensionID(input string) (*ExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExtensionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseExtensionIDInsensitively parses 'input' case-insensitively into a ExtensionId +// note: this method should only be used for API response data and not user input +func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExtensionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) + } + + return nil +} + +// ValidateExtensionID checks that 'input' can be parsed as a Extension ID +func ValidateExtensionID(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 := ParseExtensionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Extension ID +func (id ExtensionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s/extensions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName, id.ExtensionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Extension ID +func (id ExtensionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + resourceids.StaticSegment("staticExtensions", "extensions", "extensions"), + resourceids.UserSpecifiedSegment("extensionName", "extensionName"), + } +} + +// String returns a human-readable description of this Extension ID +func (id ExtensionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + fmt.Sprintf("Extension Name: %q", id.ExtensionName), + } + return fmt.Sprintf("Extension (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/id_extension_test.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/id_extension_test.go new file mode 100644 index 00000000000..29ca0c38d57 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/id_extension_test.go @@ -0,0 +1,327 @@ +package virtualmachineextensions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ExtensionId{} + +func TestNewExtensionID(t *testing.T) { + id := NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } + + if id.ExtensionName != "extensionName" { + t.Fatalf("Expected %q but got %q for Segment 'ExtensionName'", id.ExtensionName, "extensionName") + } +} + +func TestFormatExtensionID(t *testing.T) { + actual := NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseExtensionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExtensionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName", + Expected: &ExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExtensionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestParseExtensionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExtensionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/eXtEnSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName", + Expected: &ExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/eXtEnSiOnS/eXtEnSiOnNaMe", + Expected: &ExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + ExtensionName: "eXtEnSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/eXtEnSiOnS/eXtEnSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExtensionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestSegmentsForExtensionId(t *testing.T) { + segments := ExtensionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ExtensionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/id_virtualmachine.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/id_virtualmachine.go new file mode 100644 index 00000000000..01381ed6d4b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/id_virtualmachine.go @@ -0,0 +1,130 @@ +package virtualmachineextensions + +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(&VirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineId{} + +// VirtualMachineId is a struct representing the Resource ID for a Virtual Machine +type VirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string +} + +// NewVirtualMachineID returns a new VirtualMachineId struct +func NewVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineName string) VirtualMachineId { + return VirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + } +} + +// ParseVirtualMachineID parses 'input' into a VirtualMachineId +func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + return nil +} + +// ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID +func ValidateVirtualMachineID(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 := ParseVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine ID +func (id VirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine ID +func (id VirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + } +} + +// String returns a human-readable description of this Virtual Machine ID +func (id VirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + } + return fmt.Sprintf("Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/id_virtualmachine_test.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/id_virtualmachine_test.go new file mode 100644 index 00000000000..2987f6776a3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/id_virtualmachine_test.go @@ -0,0 +1,282 @@ +package virtualmachineextensions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineId{} + +func TestNewVirtualMachineID(t *testing.T) { + id := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } +} + +func TestFormatVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestParseVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestSegmentsForVirtualMachineId(t *testing.T) { + segments := VirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/method_createorupdate.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_createorupdate.go new file mode 100644 index 00000000000..c4663f81156 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachineextensions + +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 *VirtualMachineExtension +} + +// CreateOrUpdate ... +func (c VirtualMachineExtensionsClient) CreateOrUpdate(ctx context.Context, id ExtensionId, input VirtualMachineExtension) (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 VirtualMachineExtensionsClient) CreateOrUpdateThenPoll(ctx context.Context, id ExtensionId, input VirtualMachineExtension) 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/resource-manager/compute/2025-04-01/virtualmachineextensions/method_delete.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_delete.go new file mode 100644 index 00000000000..6af6e709fe4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachineextensions + +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 VirtualMachineExtensionsClient) Delete(ctx context.Context, id ExtensionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachineExtensionsClient) DeleteThenPoll(ctx context.Context, id ExtensionId) 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/resource-manager/compute/2025-04-01/virtualmachineextensions/method_get.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_get.go new file mode 100644 index 00000000000..081bdecb6ff --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_get.go @@ -0,0 +1,83 @@ +package virtualmachineextensions + +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 *VirtualMachineExtension +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineExtensionsClient) Get(ctx context.Context, id ExtensionId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 VirtualMachineExtension + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/method_list.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_list.go new file mode 100644 index 00000000000..b495c3fa1d5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_list.go @@ -0,0 +1,83 @@ +package virtualmachineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineExtensionsListResult +} + +type ListOperationOptions struct { + Expand *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// List ... +func (c VirtualMachineExtensionsClient) List(ctx context.Context, id VirtualMachineId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/extensions", 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 VirtualMachineExtensionsListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/method_update.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_update.go new file mode 100644 index 00000000000..b83bdd84908 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/method_update.go @@ -0,0 +1,74 @@ +package virtualmachineextensions + +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 *VirtualMachineExtension +} + +// Update ... +func (c VirtualMachineExtensionsClient) Update(ctx context.Context, id ExtensionId, input VirtualMachineExtensionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VirtualMachineExtensionsClient) UpdateThenPoll(ctx context.Context, id ExtensionId, input VirtualMachineExtensionUpdate) 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/resource-manager/compute/2025-04-01/virtualmachineextensions/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_instanceviewstatus.go new file mode 100644 index 00000000000..88fe6a10b4d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachineextensions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/model_keyvaultsecretreference.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..ba308b046a4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/model_subresource.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_subresource.go new file mode 100644 index 00000000000..1bd7575c8ac --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextension.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextension.go new file mode 100644 index 00000000000..c3a7e60abc9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextension.go @@ -0,0 +1,18 @@ +package virtualmachineextensions + +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 VirtualMachineExtension struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensioninstanceview.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensioninstanceview.go new file mode 100644 index 00000000000..f9209af2f35 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensioninstanceview.go @@ -0,0 +1,12 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionproperties.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionproperties.go new file mode 100644 index 00000000000..04be01e454a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionproperties.go @@ -0,0 +1,20 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionslistresult.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionslistresult.go new file mode 100644 index 00000000000..006db2198b4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionslistresult.go @@ -0,0 +1,8 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionsListResult struct { + Value *[]VirtualMachineExtension `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionupdate.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionupdate.go new file mode 100644 index 00000000000..55b5acdf30e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionupdate.go @@ -0,0 +1,9 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionUpdate struct { + Properties *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionupdateproperties.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionupdateproperties.go new file mode 100644 index 00000000000..e000a1a1b65 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/model_virtualmachineextensionupdateproperties.go @@ -0,0 +1,17 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionUpdateProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineextensions/version.go b/resource-manager/compute/2025-04-01/virtualmachineextensions/version.go new file mode 100644 index 00000000000..be624f51398 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineextensions/version.go @@ -0,0 +1,10 @@ +package virtualmachineextensions + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachineextensions/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/README.md b/resource-manager/compute/2025-04-01/virtualmachineruncommands/README.md new file mode 100644 index 00000000000..b0de2dbde1d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachineruncommands` Documentation + +The `virtualmachineruncommands` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/virtualmachineruncommands" +``` + + +### Client Initialization + +```go +client := virtualmachineruncommands.NewVirtualMachineRunCommandsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + +payload := virtualmachineruncommands.VirtualMachineRunCommand{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.GetByVirtualMachine` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + +read, err := client.GetByVirtualMachine(ctx, id, virtualmachineruncommands.DefaultGetByVirtualMachineOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.ListByVirtualMachine` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +// alternatively `client.ListByVirtualMachine(ctx, id, virtualmachineruncommands.DefaultListByVirtualMachineOperationOptions())` can be used to do batched pagination +items, err := client.ListByVirtualMachineComplete(ctx, id, virtualmachineruncommands.DefaultListByVirtualMachineOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + +payload := virtualmachineruncommands.VirtualMachineRunCommandUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/client.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/client.go new file mode 100644 index 00000000000..48e134abb29 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/client.go @@ -0,0 +1,26 @@ +package virtualmachineruncommands + +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 VirtualMachineRunCommandsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineRunCommandsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineRunCommandsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachineruncommands", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineRunCommandsClient: %+v", err) + } + + return &VirtualMachineRunCommandsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/constants.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/constants.go new file mode 100644 index 00000000000..21baf5c61e8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/constants.go @@ -0,0 +1,151 @@ +package virtualmachineruncommands + +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 ExecutionState string + +const ( + ExecutionStateCanceled ExecutionState = "Canceled" + ExecutionStateFailed ExecutionState = "Failed" + ExecutionStatePending ExecutionState = "Pending" + ExecutionStateRunning ExecutionState = "Running" + ExecutionStateSucceeded ExecutionState = "Succeeded" + ExecutionStateTimedOut ExecutionState = "TimedOut" + ExecutionStateUnknown ExecutionState = "Unknown" +) + +func PossibleValuesForExecutionState() []string { + return []string{ + string(ExecutionStateCanceled), + string(ExecutionStateFailed), + string(ExecutionStatePending), + string(ExecutionStateRunning), + string(ExecutionStateSucceeded), + string(ExecutionStateTimedOut), + string(ExecutionStateUnknown), + } +} + +func (s *ExecutionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExecutionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExecutionState(input string) (*ExecutionState, error) { + vals := map[string]ExecutionState{ + "canceled": ExecutionStateCanceled, + "failed": ExecutionStateFailed, + "pending": ExecutionStatePending, + "running": ExecutionStateRunning, + "succeeded": ExecutionStateSucceeded, + "timedout": ExecutionStateTimedOut, + "unknown": ExecutionStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExecutionState(input) + return &out, nil +} + +type ScriptShellTypes string + +const ( + ScriptShellTypesDefault ScriptShellTypes = "Default" + ScriptShellTypesPowershellSeven ScriptShellTypes = "Powershell7" +) + +func PossibleValuesForScriptShellTypes() []string { + return []string{ + string(ScriptShellTypesDefault), + string(ScriptShellTypesPowershellSeven), + } +} + +func (s *ScriptShellTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScriptShellTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseScriptShellTypes(input string) (*ScriptShellTypes, error) { + vals := map[string]ScriptShellTypes{ + "default": ScriptShellTypesDefault, + "powershell7": ScriptShellTypesPowershellSeven, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScriptShellTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachine.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachine.go new file mode 100644 index 00000000000..1ee0639845f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachine.go @@ -0,0 +1,130 @@ +package virtualmachineruncommands + +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(&VirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineId{} + +// VirtualMachineId is a struct representing the Resource ID for a Virtual Machine +type VirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string +} + +// NewVirtualMachineID returns a new VirtualMachineId struct +func NewVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineName string) VirtualMachineId { + return VirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + } +} + +// ParseVirtualMachineID parses 'input' into a VirtualMachineId +func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + return nil +} + +// ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID +func ValidateVirtualMachineID(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 := ParseVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine ID +func (id VirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine ID +func (id VirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + } +} + +// String returns a human-readable description of this Virtual Machine ID +func (id VirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + } + return fmt.Sprintf("Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachine_test.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachine_test.go new file mode 100644 index 00000000000..9be9a3ac5ae --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachine_test.go @@ -0,0 +1,282 @@ +package virtualmachineruncommands + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineId{} + +func TestNewVirtualMachineID(t *testing.T) { + id := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } +} + +func TestFormatVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestParseVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestSegmentsForVirtualMachineId(t *testing.T) { + segments := VirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachineruncommand.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachineruncommand.go new file mode 100644 index 00000000000..158a3e80bdd --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachineruncommand.go @@ -0,0 +1,139 @@ +package virtualmachineruncommands + +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(&VirtualMachineRunCommandId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineRunCommandId{} + +// VirtualMachineRunCommandId is a struct representing the Resource ID for a Virtual Machine Run Command +type VirtualMachineRunCommandId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string + RunCommandName string +} + +// NewVirtualMachineRunCommandID returns a new VirtualMachineRunCommandId struct +func NewVirtualMachineRunCommandID(subscriptionId string, resourceGroupName string, virtualMachineName string, runCommandName string) VirtualMachineRunCommandId { + return VirtualMachineRunCommandId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + RunCommandName: runCommandName, + } +} + +// ParseVirtualMachineRunCommandID parses 'input' into a VirtualMachineRunCommandId +func ParseVirtualMachineRunCommandID(input string) (*VirtualMachineRunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineRunCommandId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineRunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineRunCommandIDInsensitively parses 'input' case-insensitively into a VirtualMachineRunCommandId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineRunCommandIDInsensitively(input string) (*VirtualMachineRunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineRunCommandId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineRunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineRunCommandId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) + } + + return nil +} + +// ValidateVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Run Command ID +func ValidateVirtualMachineRunCommandID(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 := ParseVirtualMachineRunCommandID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Run Command ID +func (id VirtualMachineRunCommandId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s/runCommands/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName, id.RunCommandName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Run Command ID +func (id VirtualMachineRunCommandId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + resourceids.StaticSegment("staticRunCommands", "runCommands", "runCommands"), + resourceids.UserSpecifiedSegment("runCommandName", "runCommandName"), + } +} + +// String returns a human-readable description of this Virtual Machine Run Command ID +func (id VirtualMachineRunCommandId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + fmt.Sprintf("Run Command Name: %q", id.RunCommandName), + } + return fmt.Sprintf("Virtual Machine Run Command (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachineruncommand_test.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachineruncommand_test.go new file mode 100644 index 00000000000..09a2aec7edd --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/id_virtualmachineruncommand_test.go @@ -0,0 +1,327 @@ +package virtualmachineruncommands + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineRunCommandId{} + +func TestNewVirtualMachineRunCommandID(t *testing.T) { + id := NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } + + if id.RunCommandName != "runCommandName" { + t.Fatalf("Expected %q but got %q for Segment 'RunCommandName'", id.RunCommandName, "runCommandName") + } +} + +func TestFormatVirtualMachineRunCommandID(t *testing.T) { + actual := NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineRunCommandID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineRunCommandId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName", + Expected: &VirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + RunCommandName: "runCommandName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineRunCommandID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + if actual.RunCommandName != v.Expected.RunCommandName { + t.Fatalf("Expected %q but got %q for RunCommandName", v.Expected.RunCommandName, actual.RunCommandName) + } + + } +} + +func TestParseVirtualMachineRunCommandIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineRunCommandId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/rUnCoMmAnDs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName", + Expected: &VirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + RunCommandName: "runCommandName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/rUnCoMmAnDs/rUnCoMmAnDnAmE", + Expected: &VirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + RunCommandName: "rUnCoMmAnDnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/rUnCoMmAnDs/rUnCoMmAnDnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineRunCommandIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + if actual.RunCommandName != v.Expected.RunCommandName { + t.Fatalf("Expected %q but got %q for RunCommandName", v.Expected.RunCommandName, actual.RunCommandName) + } + + } +} + +func TestSegmentsForVirtualMachineRunCommandId(t *testing.T) { + segments := VirtualMachineRunCommandId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineRunCommandId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_createorupdate.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_createorupdate.go new file mode 100644 index 00000000000..6507e0920af --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachineruncommands + +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 *VirtualMachineRunCommand +} + +// CreateOrUpdate ... +func (c VirtualMachineRunCommandsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineRunCommandId, input VirtualMachineRunCommand) (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 VirtualMachineRunCommandsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineRunCommandId, input VirtualMachineRunCommand) 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/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_delete.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_delete.go new file mode 100644 index 00000000000..c1a11a3b561 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachineruncommands + +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 VirtualMachineRunCommandsClient) Delete(ctx context.Context, id VirtualMachineRunCommandId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachineRunCommandsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineRunCommandId) 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/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_getbyvirtualmachine.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_getbyvirtualmachine.go new file mode 100644 index 00000000000..f603e128c0c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_getbyvirtualmachine.go @@ -0,0 +1,83 @@ +package virtualmachineruncommands + +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 GetByVirtualMachineOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineRunCommand +} + +type GetByVirtualMachineOperationOptions struct { + Expand *string +} + +func DefaultGetByVirtualMachineOperationOptions() GetByVirtualMachineOperationOptions { + return GetByVirtualMachineOperationOptions{} +} + +func (o GetByVirtualMachineOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetByVirtualMachineOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetByVirtualMachineOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// GetByVirtualMachine ... +func (c VirtualMachineRunCommandsClient) GetByVirtualMachine(ctx context.Context, id VirtualMachineRunCommandId, options GetByVirtualMachineOperationOptions) (result GetByVirtualMachineOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 VirtualMachineRunCommand + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_listbyvirtualmachine.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_listbyvirtualmachine.go new file mode 100644 index 00000000000..739e09cd17f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_listbyvirtualmachine.go @@ -0,0 +1,134 @@ +package virtualmachineruncommands + +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 ListByVirtualMachineOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineRunCommand +} + +type ListByVirtualMachineCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineRunCommand +} + +type ListByVirtualMachineOperationOptions struct { + Expand *string +} + +func DefaultListByVirtualMachineOperationOptions() ListByVirtualMachineOperationOptions { + return ListByVirtualMachineOperationOptions{} +} + +func (o ListByVirtualMachineOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByVirtualMachineOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByVirtualMachineOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +type ListByVirtualMachineCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByVirtualMachineCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByVirtualMachine ... +func (c VirtualMachineRunCommandsClient) ListByVirtualMachine(ctx context.Context, id VirtualMachineId, options ListByVirtualMachineOperationOptions) (result ListByVirtualMachineOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByVirtualMachineCustomPager{}, + Path: fmt.Sprintf("%s/runCommands", 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 *[]VirtualMachineRunCommand `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByVirtualMachineComplete retrieves all the results into a single object +func (c VirtualMachineRunCommandsClient) ListByVirtualMachineComplete(ctx context.Context, id VirtualMachineId, options ListByVirtualMachineOperationOptions) (ListByVirtualMachineCompleteResult, error) { + return c.ListByVirtualMachineCompleteMatchingPredicate(ctx, id, options, VirtualMachineRunCommandOperationPredicate{}) +} + +// ListByVirtualMachineCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineRunCommandsClient) ListByVirtualMachineCompleteMatchingPredicate(ctx context.Context, id VirtualMachineId, options ListByVirtualMachineOperationOptions, predicate VirtualMachineRunCommandOperationPredicate) (result ListByVirtualMachineCompleteResult, err error) { + items := make([]VirtualMachineRunCommand, 0) + + resp, err := c.ListByVirtualMachine(ctx, id, options) + 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 = ListByVirtualMachineCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_update.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_update.go new file mode 100644 index 00000000000..50ec375b474 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/method_update.go @@ -0,0 +1,74 @@ +package virtualmachineruncommands + +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 *VirtualMachineRunCommand +} + +// Update ... +func (c VirtualMachineRunCommandsClient) Update(ctx context.Context, id VirtualMachineRunCommandId, input VirtualMachineRunCommandUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VirtualMachineRunCommandsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineRunCommandId, input VirtualMachineRunCommandUpdate) 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/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_instanceviewstatus.go new file mode 100644 index 00000000000..dc520cf9a16 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachineruncommands + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_runcommandinputparameter.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_runcommandinputparameter.go new file mode 100644 index 00000000000..f95d29616c9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_runcommandinputparameter.go @@ -0,0 +1,9 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInputParameter struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_runcommandmanagedidentity.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_runcommandmanagedidentity.go new file mode 100644 index 00000000000..ee70096b558 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_runcommandmanagedidentity.go @@ -0,0 +1,9 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandManagedIdentity struct { + ClientId *string `json:"clientId,omitempty"` + ObjectId *string `json:"objectId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommand.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommand.go new file mode 100644 index 00000000000..68dc500476f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommand.go @@ -0,0 +1,18 @@ +package virtualmachineruncommands + +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 VirtualMachineRunCommand struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandinstanceview.go new file mode 100644 index 00000000000..d5d051e09a1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandinstanceview.go @@ -0,0 +1,45 @@ +package virtualmachineruncommands + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandInstanceView struct { + EndTime *string `json:"endTime,omitempty"` + Error *string `json:"error,omitempty"` + ExecutionMessage *string `json:"executionMessage,omitempty"` + ExecutionState *ExecutionState `json:"executionState,omitempty"` + ExitCode *int64 `json:"exitCode,omitempty"` + Output *string `json:"output,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +func (o *VirtualMachineRunCommandInstanceView) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineRunCommandInstanceView) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *VirtualMachineRunCommandInstanceView) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineRunCommandInstanceView) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandproperties.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandproperties.go new file mode 100644 index 00000000000..dea84642c36 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandproperties.go @@ -0,0 +1,21 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandProperties struct { + AsyncExecution *bool `json:"asyncExecution,omitempty"` + ErrorBlobManagedIdentity *RunCommandManagedIdentity `json:"errorBlobManagedIdentity,omitempty"` + ErrorBlobUri *string `json:"errorBlobUri,omitempty"` + InstanceView *VirtualMachineRunCommandInstanceView `json:"instanceView,omitempty"` + OutputBlobManagedIdentity *RunCommandManagedIdentity `json:"outputBlobManagedIdentity,omitempty"` + OutputBlobUri *string `json:"outputBlobUri,omitempty"` + Parameters *[]RunCommandInputParameter `json:"parameters,omitempty"` + ProtectedParameters *[]RunCommandInputParameter `json:"protectedParameters,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + RunAsPassword *string `json:"runAsPassword,omitempty"` + RunAsUser *string `json:"runAsUser,omitempty"` + Source *VirtualMachineRunCommandScriptSource `json:"source,omitempty"` + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandscriptsource.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandscriptsource.go new file mode 100644 index 00000000000..e7b633ba654 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandscriptsource.go @@ -0,0 +1,13 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandScriptSource struct { + CommandId *string `json:"commandId,omitempty"` + GalleryScriptReferenceId *string `json:"galleryScriptReferenceId,omitempty"` + Script *string `json:"script,omitempty"` + ScriptShell *ScriptShellTypes `json:"scriptShell,omitempty"` + ScriptUri *string `json:"scriptUri,omitempty"` + ScriptUriManagedIdentity *RunCommandManagedIdentity `json:"scriptUriManagedIdentity,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandupdate.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandupdate.go new file mode 100644 index 00000000000..b8440a0baa2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/model_virtualmachineruncommandupdate.go @@ -0,0 +1,9 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandUpdate struct { + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachineruncommands/predicates.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/predicates.go new file mode 100644 index 00000000000..51f33e55e50 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/predicates.go @@ -0,0 +1,32 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineRunCommandOperationPredicate) Matches(input VirtualMachineRunCommand) 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/resource-manager/compute/2025-04-01/virtualmachineruncommands/version.go b/resource-manager/compute/2025-04-01/virtualmachineruncommands/version.go new file mode 100644 index 00000000000..24c4e09228a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachineruncommands/version.go @@ -0,0 +1,10 @@ +package virtualmachineruncommands + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachineruncommands/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/README.md b/resource-manager/compute/2025-04-01/virtualmachines/README.md new file mode 100644 index 00000000000..ca47a7bf10e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/README.md @@ -0,0 +1,408 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachines` Documentation + +The `virtualmachines` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/virtualmachines" +``` + + +### Client Initialization + +```go +client := virtualmachines.NewVirtualMachinesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachinesClient.AssessPatches` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.AssessPatchesThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.AttachDetachDataDisks` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.AttachDetachDataDisksRequest{ + // ... +} + + +if err := client.AttachDetachDataDisksThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Capture` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachineCaptureParameters{ + // ... +} + + +if err := client.CaptureThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.ConvertToManagedDisks` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.ConvertToManagedDisksThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachine{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, virtualmachines.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Deallocate` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.DeallocateThenPoll(ctx, id, virtualmachines.DefaultDeallocateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.DeleteThenPoll(ctx, id, virtualmachines.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Generalize` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.Generalize(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.Get` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.Get(ctx, id, virtualmachines.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.InstallPatches` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachineInstallPatchesParameters{ + // ... +} + + +if err := client.InstallPatchesThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.InstanceView` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.InstanceView(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.List` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.List(ctx, id, virtualmachines.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, virtualmachines.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachinesClient.ListAll` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListAll(ctx, id, virtualmachines.DefaultListAllOperationOptions())` can be used to do batched pagination +items, err := client.ListAllComplete(ctx, id, virtualmachines.DefaultListAllOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachinesClient.ListAvailableSizes` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +// alternatively `client.ListAvailableSizes(ctx, id)` can be used to do batched pagination +items, err := client.ListAvailableSizesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachinesClient.MigrateToVMScaleSet` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.MigrateVMToVirtualMachineScaleSetInput{ + // ... +} + + +if err := client.MigrateToVMScaleSetThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.PerformMaintenance` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.PerformMaintenanceThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.PowerOff` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.PowerOffThenPoll(ctx, id, virtualmachines.DefaultPowerOffOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Reapply` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.ReapplyThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Redeploy` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.RedeployThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Reimage` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachineReimageParameters{ + // ... +} + + +if err := client.ReimageThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Restart` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.RetrieveBootDiagnosticsData` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.RetrieveBootDiagnosticsData(ctx, id, virtualmachines.DefaultRetrieveBootDiagnosticsDataOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.RunCommand` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.RunCommandInput{ + // ... +} + + +if err := client.RunCommandThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.SimulateEviction` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.SimulateEviction(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.Start` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Update` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachineUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, virtualmachines.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/virtualmachines/client.go b/resource-manager/compute/2025-04-01/virtualmachines/client.go new file mode 100644 index 00000000000..51127106436 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/client.go @@ -0,0 +1,26 @@ +package virtualmachines + +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 VirtualMachinesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachinesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachinesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachines", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachinesClient: %+v", err) + } + + return &VirtualMachinesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/constants.go b/resource-manager/compute/2025-04-01/virtualmachines/constants.go new file mode 100644 index 00000000000..74eb4b9985a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/constants.go @@ -0,0 +1,2681 @@ +package virtualmachines + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentName string + +const ( + ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentName = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentName() []string { + return []string{ + string(ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentName(input string) (*ComponentName, error) { + vals := map[string]ComponentName{ + "microsoft-windows-shell-setup": ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentName(input) + return &out, nil +} + +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +func PossibleValuesForDeleteOptions() []string { + return []string{ + string(DeleteOptionsDelete), + string(DeleteOptionsDetach), + } +} + +func (s *DeleteOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeleteOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeleteOptions(input string) (*DeleteOptions, error) { + vals := map[string]DeleteOptions{ + "delete": DeleteOptionsDelete, + "detach": DeleteOptionsDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeleteOptions(input) + return &out, nil +} + +type DiffDiskOptions string + +const ( + DiffDiskOptionsLocal DiffDiskOptions = "Local" +) + +func PossibleValuesForDiffDiskOptions() []string { + return []string{ + string(DiffDiskOptionsLocal), + } +} + +func (s *DiffDiskOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskOptions(input string) (*DiffDiskOptions, error) { + vals := map[string]DiffDiskOptions{ + "local": DiffDiskOptionsLocal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskOptions(input) + return &out, nil +} + +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" + DiffDiskPlacementNVMeDisk DiffDiskPlacement = "NvmeDisk" + DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" +) + +func PossibleValuesForDiffDiskPlacement() []string { + return []string{ + string(DiffDiskPlacementCacheDisk), + string(DiffDiskPlacementNVMeDisk), + string(DiffDiskPlacementResourceDisk), + } +} + +func (s *DiffDiskPlacement) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskPlacement(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) { + vals := map[string]DiffDiskPlacement{ + "cachedisk": DiffDiskPlacementCacheDisk, + "nvmedisk": DiffDiskPlacementNVMeDisk, + "resourcedisk": DiffDiskPlacementResourceDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskPlacement(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + DiskCreateOptionTypesCopy DiskCreateOptionTypes = "Copy" + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" + DiskCreateOptionTypesRestore DiskCreateOptionTypes = "Restore" +) + +func PossibleValuesForDiskCreateOptionTypes() []string { + return []string{ + string(DiskCreateOptionTypesAttach), + string(DiskCreateOptionTypesCopy), + string(DiskCreateOptionTypesEmpty), + string(DiskCreateOptionTypesFromImage), + string(DiskCreateOptionTypesRestore), + } +} + +func (s *DiskCreateOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskCreateOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskCreateOptionTypes(input string) (*DiskCreateOptionTypes, error) { + vals := map[string]DiskCreateOptionTypes{ + "attach": DiskCreateOptionTypesAttach, + "copy": DiskCreateOptionTypesCopy, + "empty": DiskCreateOptionTypesEmpty, + "fromimage": DiskCreateOptionTypesFromImage, + "restore": DiskCreateOptionTypesRestore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskCreateOptionTypes(input) + return &out, nil +} + +type DiskDeleteOptionTypes string + +const ( + DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete" + DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach" +) + +func PossibleValuesForDiskDeleteOptionTypes() []string { + return []string{ + string(DiskDeleteOptionTypesDelete), + string(DiskDeleteOptionTypesDetach), + } +} + +func (s *DiskDeleteOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDeleteOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDeleteOptionTypes(input string) (*DiskDeleteOptionTypes, error) { + vals := map[string]DiskDeleteOptionTypes{ + "delete": DiskDeleteOptionTypesDelete, + "detach": DiskDeleteOptionTypesDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDeleteOptionTypes(input) + return &out, nil +} + +type DiskDetachOptionTypes string + +const ( + DiskDetachOptionTypesForceDetach DiskDetachOptionTypes = "ForceDetach" +) + +func PossibleValuesForDiskDetachOptionTypes() []string { + return []string{ + string(DiskDetachOptionTypesForceDetach), + } +} + +func (s *DiskDetachOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDetachOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDetachOptionTypes(input string) (*DiskDetachOptionTypes, error) { + vals := map[string]DiskDetachOptionTypes{ + "forcedetach": DiskDetachOptionTypesForceDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDetachOptionTypes(input) + return &out, nil +} + +type DomainNameLabelScopeTypes string + +const ( + DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse" + DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse" + DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse" + DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse" +) + +func PossibleValuesForDomainNameLabelScopeTypes() []string { + return []string{ + string(DomainNameLabelScopeTypesNoReuse), + string(DomainNameLabelScopeTypesResourceGroupReuse), + string(DomainNameLabelScopeTypesSubscriptionReuse), + string(DomainNameLabelScopeTypesTenantReuse), + } +} + +func (s *DomainNameLabelScopeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDomainNameLabelScopeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDomainNameLabelScopeTypes(input string) (*DomainNameLabelScopeTypes, error) { + vals := map[string]DomainNameLabelScopeTypes{ + "noreuse": DomainNameLabelScopeTypesNoReuse, + "resourcegroupreuse": DomainNameLabelScopeTypesResourceGroupReuse, + "subscriptionreuse": DomainNameLabelScopeTypesSubscriptionReuse, + "tenantreuse": DomainNameLabelScopeTypesTenantReuse, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DomainNameLabelScopeTypes(input) + return &out, nil +} + +type ExpandTypeForListVMs string + +const ( + ExpandTypeForListVMsInstanceView ExpandTypeForListVMs = "instanceView" +) + +func PossibleValuesForExpandTypeForListVMs() []string { + return []string{ + string(ExpandTypeForListVMsInstanceView), + } +} + +func (s *ExpandTypeForListVMs) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpandTypeForListVMs(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExpandTypeForListVMs(input string) (*ExpandTypeForListVMs, error) { + vals := map[string]ExpandTypeForListVMs{ + "instanceview": ExpandTypeForListVMsInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpandTypeForListVMs(input) + return &out, nil +} + +type ExpandTypesForListVMs string + +const ( + ExpandTypesForListVMsInstanceView ExpandTypesForListVMs = "instanceView" +) + +func PossibleValuesForExpandTypesForListVMs() []string { + return []string{ + string(ExpandTypesForListVMsInstanceView), + } +} + +func (s *ExpandTypesForListVMs) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpandTypesForListVMs(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExpandTypesForListVMs(input string) (*ExpandTypesForListVMs, error) { + vals := map[string]ExpandTypesForListVMs{ + "instanceview": ExpandTypesForListVMsInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpandTypesForListVMs(input) + return &out, nil +} + +type HyperVGenerationType string + +const ( + HyperVGenerationTypeVOne HyperVGenerationType = "V1" + HyperVGenerationTypeVTwo HyperVGenerationType = "V2" +) + +func PossibleValuesForHyperVGenerationType() []string { + return []string{ + string(HyperVGenerationTypeVOne), + string(HyperVGenerationTypeVTwo), + } +} + +func (s *HyperVGenerationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationType(input string) (*HyperVGenerationType, error) { + vals := map[string]HyperVGenerationType{ + "v1": HyperVGenerationTypeVOne, + "v2": HyperVGenerationTypeVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationType(input) + return &out, nil +} + +type IPVersions string + +const ( + IPVersionsIPvFour IPVersions = "IPv4" + IPVersionsIPvSix IPVersions = "IPv6" +) + +func PossibleValuesForIPVersions() []string { + return []string{ + string(IPVersionsIPvFour), + string(IPVersionsIPvSix), + } +} + +func (s *IPVersions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersions(input string) (*IPVersions, error) { + vals := map[string]IPVersions{ + "ipv4": IPVersionsIPvFour, + "ipv6": IPVersionsIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersions(input) + return &out, nil +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesResiliencyView InstanceViewTypes = "resiliencyView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesResiliencyView), + string(InstanceViewTypesUserData), + } +} + +func (s *InstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "resiliencyview": InstanceViewTypesResiliencyView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type MaintenanceOperationResultCodeTypes string + +const ( + MaintenanceOperationResultCodeTypesMaintenanceAborted MaintenanceOperationResultCodeTypes = "MaintenanceAborted" + MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted" + MaintenanceOperationResultCodeTypesNone MaintenanceOperationResultCodeTypes = "None" + MaintenanceOperationResultCodeTypesRetryLater MaintenanceOperationResultCodeTypes = "RetryLater" +) + +func PossibleValuesForMaintenanceOperationResultCodeTypes() []string { + return []string{ + string(MaintenanceOperationResultCodeTypesMaintenanceAborted), + string(MaintenanceOperationResultCodeTypesMaintenanceCompleted), + string(MaintenanceOperationResultCodeTypesNone), + string(MaintenanceOperationResultCodeTypesRetryLater), + } +} + +func (s *MaintenanceOperationResultCodeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMaintenanceOperationResultCodeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMaintenanceOperationResultCodeTypes(input string) (*MaintenanceOperationResultCodeTypes, error) { + vals := map[string]MaintenanceOperationResultCodeTypes{ + "maintenanceaborted": MaintenanceOperationResultCodeTypesMaintenanceAborted, + "maintenancecompleted": MaintenanceOperationResultCodeTypesMaintenanceCompleted, + "none": MaintenanceOperationResultCodeTypesNone, + "retrylater": MaintenanceOperationResultCodeTypesRetryLater, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MaintenanceOperationResultCodeTypes(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type NetworkApiVersion string + +const ( + NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne NetworkApiVersion = "2022-11-01" + NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne NetworkApiVersion = "2020-11-01" +) + +func PossibleValuesForNetworkApiVersion() []string { + return []string{ + string(NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne), + string(NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne), + } +} + +func (s *NetworkApiVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkApiVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkApiVersion(input string) (*NetworkApiVersion, error) { + vals := map[string]NetworkApiVersion{ + "2022-11-01": NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne, + "2020-11-01": NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkApiVersion(input) + return &out, nil +} + +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliaryMode() []string { + return []string{ + string(NetworkInterfaceAuxiliaryModeAcceleratedConnections), + string(NetworkInterfaceAuxiliaryModeFloating), + string(NetworkInterfaceAuxiliaryModeNone), + } +} + +func (s *NetworkInterfaceAuxiliaryMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliaryMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliaryMode(input string) (*NetworkInterfaceAuxiliaryMode, error) { + vals := map[string]NetworkInterfaceAuxiliaryMode{ + "acceleratedconnections": NetworkInterfaceAuxiliaryModeAcceleratedConnections, + "floating": NetworkInterfaceAuxiliaryModeFloating, + "none": NetworkInterfaceAuxiliaryModeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliaryMode(input) + return &out, nil +} + +type NetworkInterfaceAuxiliarySku string + +const ( + NetworkInterfaceAuxiliarySkuAEight NetworkInterfaceAuxiliarySku = "A8" + NetworkInterfaceAuxiliarySkuAFour NetworkInterfaceAuxiliarySku = "A4" + NetworkInterfaceAuxiliarySkuAOne NetworkInterfaceAuxiliarySku = "A1" + NetworkInterfaceAuxiliarySkuATwo NetworkInterfaceAuxiliarySku = "A2" + NetworkInterfaceAuxiliarySkuNone NetworkInterfaceAuxiliarySku = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliarySku() []string { + return []string{ + string(NetworkInterfaceAuxiliarySkuAEight), + string(NetworkInterfaceAuxiliarySkuAFour), + string(NetworkInterfaceAuxiliarySkuAOne), + string(NetworkInterfaceAuxiliarySkuATwo), + string(NetworkInterfaceAuxiliarySkuNone), + } +} + +func (s *NetworkInterfaceAuxiliarySku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliarySku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliarySku(input string) (*NetworkInterfaceAuxiliarySku, error) { + vals := map[string]NetworkInterfaceAuxiliarySku{ + "a8": NetworkInterfaceAuxiliarySkuAEight, + "a4": NetworkInterfaceAuxiliarySkuAFour, + "a1": NetworkInterfaceAuxiliarySkuAOne, + "a2": NetworkInterfaceAuxiliarySkuATwo, + "none": NetworkInterfaceAuxiliarySkuNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliarySku(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type PassName string + +const ( + PassNameOobeSystem PassName = "OobeSystem" +) + +func PossibleValuesForPassName() []string { + return []string{ + string(PassNameOobeSystem), + } +} + +func (s *PassName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassName(input string) (*PassName, error) { + vals := map[string]PassName{ + "oobesystem": PassNameOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassName(input) + return &out, nil +} + +type PatchAssessmentState string + +const ( + PatchAssessmentStateAvailable PatchAssessmentState = "Available" + PatchAssessmentStateUnknown PatchAssessmentState = "Unknown" +) + +func PossibleValuesForPatchAssessmentState() []string { + return []string{ + string(PatchAssessmentStateAvailable), + string(PatchAssessmentStateUnknown), + } +} + +func (s *PatchAssessmentState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePatchAssessmentState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePatchAssessmentState(input string) (*PatchAssessmentState, error) { + vals := map[string]PatchAssessmentState{ + "available": PatchAssessmentStateAvailable, + "unknown": PatchAssessmentStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PatchAssessmentState(input) + return &out, nil +} + +type PatchInstallationState string + +const ( + PatchInstallationStateExcluded PatchInstallationState = "Excluded" + PatchInstallationStateFailed PatchInstallationState = "Failed" + PatchInstallationStateInstalled PatchInstallationState = "Installed" + PatchInstallationStateNotSelected PatchInstallationState = "NotSelected" + PatchInstallationStatePending PatchInstallationState = "Pending" + PatchInstallationStateUnknown PatchInstallationState = "Unknown" +) + +func PossibleValuesForPatchInstallationState() []string { + return []string{ + string(PatchInstallationStateExcluded), + string(PatchInstallationStateFailed), + string(PatchInstallationStateInstalled), + string(PatchInstallationStateNotSelected), + string(PatchInstallationStatePending), + string(PatchInstallationStateUnknown), + } +} + +func (s *PatchInstallationState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePatchInstallationState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePatchInstallationState(input string) (*PatchInstallationState, error) { + vals := map[string]PatchInstallationState{ + "excluded": PatchInstallationStateExcluded, + "failed": PatchInstallationStateFailed, + "installed": PatchInstallationStateInstalled, + "notselected": PatchInstallationStateNotSelected, + "pending": PatchInstallationStatePending, + "unknown": PatchInstallationStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PatchInstallationState(input) + return &out, nil +} + +type PatchOperationStatus string + +const ( + PatchOperationStatusCompletedWithWarnings PatchOperationStatus = "CompletedWithWarnings" + PatchOperationStatusFailed PatchOperationStatus = "Failed" + PatchOperationStatusInProgress PatchOperationStatus = "InProgress" + PatchOperationStatusSucceeded PatchOperationStatus = "Succeeded" + PatchOperationStatusUnknown PatchOperationStatus = "Unknown" +) + +func PossibleValuesForPatchOperationStatus() []string { + return []string{ + string(PatchOperationStatusCompletedWithWarnings), + string(PatchOperationStatusFailed), + string(PatchOperationStatusInProgress), + string(PatchOperationStatusSucceeded), + string(PatchOperationStatusUnknown), + } +} + +func (s *PatchOperationStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePatchOperationStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePatchOperationStatus(input string) (*PatchOperationStatus, error) { + vals := map[string]PatchOperationStatus{ + "completedwithwarnings": PatchOperationStatusCompletedWithWarnings, + "failed": PatchOperationStatusFailed, + "inprogress": PatchOperationStatusInProgress, + "succeeded": PatchOperationStatusSucceeded, + "unknown": PatchOperationStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PatchOperationStatus(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type PublicIPAddressSkuName string + +const ( + PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" + PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" +) + +func PossibleValuesForPublicIPAddressSkuName() []string { + return []string{ + string(PublicIPAddressSkuNameBasic), + string(PublicIPAddressSkuNameStandard), + } +} + +func (s *PublicIPAddressSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuName(input string) (*PublicIPAddressSkuName, error) { + vals := map[string]PublicIPAddressSkuName{ + "basic": PublicIPAddressSkuNameBasic, + "standard": PublicIPAddressSkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuName(input) + return &out, nil +} + +type PublicIPAddressSkuTier string + +const ( + PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" + PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" +) + +func PossibleValuesForPublicIPAddressSkuTier() []string { + return []string{ + string(PublicIPAddressSkuTierGlobal), + string(PublicIPAddressSkuTierRegional), + } +} + +func (s *PublicIPAddressSkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuTier(input string) (*PublicIPAddressSkuTier, error) { + vals := map[string]PublicIPAddressSkuTier{ + "global": PublicIPAddressSkuTierGlobal, + "regional": PublicIPAddressSkuTierRegional, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuTier(input) + return &out, nil +} + +type PublicIPAllocationMethod string + +const ( + PublicIPAllocationMethodDynamic PublicIPAllocationMethod = "Dynamic" + PublicIPAllocationMethodStatic PublicIPAllocationMethod = "Static" +) + +func PossibleValuesForPublicIPAllocationMethod() []string { + return []string{ + string(PublicIPAllocationMethodDynamic), + string(PublicIPAllocationMethodStatic), + } +} + +func (s *PublicIPAllocationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAllocationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAllocationMethod(input string) (*PublicIPAllocationMethod, error) { + vals := map[string]PublicIPAllocationMethod{ + "dynamic": PublicIPAllocationMethodDynamic, + "static": PublicIPAllocationMethodStatic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAllocationMethod(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type VMGuestPatchClassificationLinux string + +const ( + VMGuestPatchClassificationLinuxCritical VMGuestPatchClassificationLinux = "Critical" + VMGuestPatchClassificationLinuxOther VMGuestPatchClassificationLinux = "Other" + VMGuestPatchClassificationLinuxSecurity VMGuestPatchClassificationLinux = "Security" +) + +func PossibleValuesForVMGuestPatchClassificationLinux() []string { + return []string{ + string(VMGuestPatchClassificationLinuxCritical), + string(VMGuestPatchClassificationLinuxOther), + string(VMGuestPatchClassificationLinuxSecurity), + } +} + +func (s *VMGuestPatchClassificationLinux) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchClassificationLinux(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchClassificationLinux(input string) (*VMGuestPatchClassificationLinux, error) { + vals := map[string]VMGuestPatchClassificationLinux{ + "critical": VMGuestPatchClassificationLinuxCritical, + "other": VMGuestPatchClassificationLinuxOther, + "security": VMGuestPatchClassificationLinuxSecurity, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchClassificationLinux(input) + return &out, nil +} + +type VMGuestPatchClassificationWindows string + +const ( + VMGuestPatchClassificationWindowsCritical VMGuestPatchClassificationWindows = "Critical" + VMGuestPatchClassificationWindowsDefinition VMGuestPatchClassificationWindows = "Definition" + VMGuestPatchClassificationWindowsFeaturePack VMGuestPatchClassificationWindows = "FeaturePack" + VMGuestPatchClassificationWindowsSecurity VMGuestPatchClassificationWindows = "Security" + VMGuestPatchClassificationWindowsServicePack VMGuestPatchClassificationWindows = "ServicePack" + VMGuestPatchClassificationWindowsTools VMGuestPatchClassificationWindows = "Tools" + VMGuestPatchClassificationWindowsUpdateRollUp VMGuestPatchClassificationWindows = "UpdateRollUp" + VMGuestPatchClassificationWindowsUpdates VMGuestPatchClassificationWindows = "Updates" +) + +func PossibleValuesForVMGuestPatchClassificationWindows() []string { + return []string{ + string(VMGuestPatchClassificationWindowsCritical), + string(VMGuestPatchClassificationWindowsDefinition), + string(VMGuestPatchClassificationWindowsFeaturePack), + string(VMGuestPatchClassificationWindowsSecurity), + string(VMGuestPatchClassificationWindowsServicePack), + string(VMGuestPatchClassificationWindowsTools), + string(VMGuestPatchClassificationWindowsUpdateRollUp), + string(VMGuestPatchClassificationWindowsUpdates), + } +} + +func (s *VMGuestPatchClassificationWindows) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchClassificationWindows(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchClassificationWindows(input string) (*VMGuestPatchClassificationWindows, error) { + vals := map[string]VMGuestPatchClassificationWindows{ + "critical": VMGuestPatchClassificationWindowsCritical, + "definition": VMGuestPatchClassificationWindowsDefinition, + "featurepack": VMGuestPatchClassificationWindowsFeaturePack, + "security": VMGuestPatchClassificationWindowsSecurity, + "servicepack": VMGuestPatchClassificationWindowsServicePack, + "tools": VMGuestPatchClassificationWindowsTools, + "updaterollup": VMGuestPatchClassificationWindowsUpdateRollUp, + "updates": VMGuestPatchClassificationWindowsUpdates, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchClassificationWindows(input) + return &out, nil +} + +type VMGuestPatchRebootBehavior string + +const ( + VMGuestPatchRebootBehaviorAlwaysRequiresReboot VMGuestPatchRebootBehavior = "AlwaysRequiresReboot" + VMGuestPatchRebootBehaviorCanRequestReboot VMGuestPatchRebootBehavior = "CanRequestReboot" + VMGuestPatchRebootBehaviorNeverReboots VMGuestPatchRebootBehavior = "NeverReboots" + VMGuestPatchRebootBehaviorUnknown VMGuestPatchRebootBehavior = "Unknown" +) + +func PossibleValuesForVMGuestPatchRebootBehavior() []string { + return []string{ + string(VMGuestPatchRebootBehaviorAlwaysRequiresReboot), + string(VMGuestPatchRebootBehaviorCanRequestReboot), + string(VMGuestPatchRebootBehaviorNeverReboots), + string(VMGuestPatchRebootBehaviorUnknown), + } +} + +func (s *VMGuestPatchRebootBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchRebootBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchRebootBehavior(input string) (*VMGuestPatchRebootBehavior, error) { + vals := map[string]VMGuestPatchRebootBehavior{ + "alwaysrequiresreboot": VMGuestPatchRebootBehaviorAlwaysRequiresReboot, + "canrequestreboot": VMGuestPatchRebootBehaviorCanRequestReboot, + "neverreboots": VMGuestPatchRebootBehaviorNeverReboots, + "unknown": VMGuestPatchRebootBehaviorUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchRebootBehavior(input) + return &out, nil +} + +type VMGuestPatchRebootSetting string + +const ( + VMGuestPatchRebootSettingAlways VMGuestPatchRebootSetting = "Always" + VMGuestPatchRebootSettingIfRequired VMGuestPatchRebootSetting = "IfRequired" + VMGuestPatchRebootSettingNever VMGuestPatchRebootSetting = "Never" +) + +func PossibleValuesForVMGuestPatchRebootSetting() []string { + return []string{ + string(VMGuestPatchRebootSettingAlways), + string(VMGuestPatchRebootSettingIfRequired), + string(VMGuestPatchRebootSettingNever), + } +} + +func (s *VMGuestPatchRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchRebootSetting(input string) (*VMGuestPatchRebootSetting, error) { + vals := map[string]VMGuestPatchRebootSetting{ + "always": VMGuestPatchRebootSettingAlways, + "ifrequired": VMGuestPatchRebootSettingIfRequired, + "never": VMGuestPatchRebootSettingNever, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchRebootSetting(input) + return &out, nil +} + +type VMGuestPatchRebootStatus string + +const ( + VMGuestPatchRebootStatusCompleted VMGuestPatchRebootStatus = "Completed" + VMGuestPatchRebootStatusFailed VMGuestPatchRebootStatus = "Failed" + VMGuestPatchRebootStatusNotNeeded VMGuestPatchRebootStatus = "NotNeeded" + VMGuestPatchRebootStatusRequired VMGuestPatchRebootStatus = "Required" + VMGuestPatchRebootStatusStarted VMGuestPatchRebootStatus = "Started" + VMGuestPatchRebootStatusUnknown VMGuestPatchRebootStatus = "Unknown" +) + +func PossibleValuesForVMGuestPatchRebootStatus() []string { + return []string{ + string(VMGuestPatchRebootStatusCompleted), + string(VMGuestPatchRebootStatusFailed), + string(VMGuestPatchRebootStatusNotNeeded), + string(VMGuestPatchRebootStatusRequired), + string(VMGuestPatchRebootStatusStarted), + string(VMGuestPatchRebootStatusUnknown), + } +} + +func (s *VMGuestPatchRebootStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchRebootStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchRebootStatus(input string) (*VMGuestPatchRebootStatus, error) { + vals := map[string]VMGuestPatchRebootStatus{ + "completed": VMGuestPatchRebootStatusCompleted, + "failed": VMGuestPatchRebootStatusFailed, + "notneeded": VMGuestPatchRebootStatusNotNeeded, + "required": VMGuestPatchRebootStatusRequired, + "started": VMGuestPatchRebootStatusStarted, + "unknown": VMGuestPatchRebootStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchRebootStatus(input) + return &out, nil +} + +type VirtualMachineEvictionPolicyTypes string + +const ( + VirtualMachineEvictionPolicyTypesDeallocate VirtualMachineEvictionPolicyTypes = "Deallocate" + VirtualMachineEvictionPolicyTypesDelete VirtualMachineEvictionPolicyTypes = "Delete" +) + +func PossibleValuesForVirtualMachineEvictionPolicyTypes() []string { + return []string{ + string(VirtualMachineEvictionPolicyTypesDeallocate), + string(VirtualMachineEvictionPolicyTypesDelete), + } +} + +func (s *VirtualMachineEvictionPolicyTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineEvictionPolicyTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineEvictionPolicyTypes(input string) (*VirtualMachineEvictionPolicyTypes, error) { + vals := map[string]VirtualMachineEvictionPolicyTypes{ + "deallocate": VirtualMachineEvictionPolicyTypesDeallocate, + "delete": VirtualMachineEvictionPolicyTypesDelete, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineEvictionPolicyTypes(input) + return &out, nil +} + +type VirtualMachinePriorityTypes string + +const ( + VirtualMachinePriorityTypesLow VirtualMachinePriorityTypes = "Low" + VirtualMachinePriorityTypesRegular VirtualMachinePriorityTypes = "Regular" + VirtualMachinePriorityTypesSpot VirtualMachinePriorityTypes = "Spot" +) + +func PossibleValuesForVirtualMachinePriorityTypes() []string { + return []string{ + string(VirtualMachinePriorityTypesLow), + string(VirtualMachinePriorityTypesRegular), + string(VirtualMachinePriorityTypesSpot), + } +} + +func (s *VirtualMachinePriorityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachinePriorityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachinePriorityTypes(input string) (*VirtualMachinePriorityTypes, error) { + vals := map[string]VirtualMachinePriorityTypes{ + "low": VirtualMachinePriorityTypesLow, + "regular": VirtualMachinePriorityTypesRegular, + "spot": VirtualMachinePriorityTypesSpot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachinePriorityTypes(input) + return &out, nil +} + +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicAFour VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesBasicAOne VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicAThree VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicATwo VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicAZero VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesStandardAEight VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardAEightVTwo VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardAEightmVTwo VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardAFive VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardAFour VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardAFourVTwo VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardAFourmVTwo VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardANine VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardAOne VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardAOneOne VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardAOneVTwo VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardAOneZero VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardASeven VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardASix VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardAThree VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardATwo VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardATwoVTwo VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardATwomVTwo VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardAZero VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardBEightms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardBFourms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardBOnems VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardBOnes VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardBTwoms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardBTwos VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardDEightVThree VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDEightsVThree VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardDFiveVTwo VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDFour VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardDFourVThree VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardDFourVTwo VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardDFoursVThree VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardDOne VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardDOneFiveVTwo VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardDOneFour VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardDOneFourVTwo VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardDOneOne VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardDOneOneVTwo VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardDOneSixVThree VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardDOneSixsVThree VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardDOneThree VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardDOneThreeVTwo VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardDOneTwo VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardDOneTwoVTwo VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardDOneVTwo VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardDSFiveVTwo VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardDSFour VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDSFourVTwo VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDSOne VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDSOneFiveVTwo VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDSOneFour VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDSOneFourVTwo VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDSOneOne VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDSOneOneVTwo VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDSOneThree VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDSOneThreeVTwo VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDSOneTwo VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDSOneTwoVTwo VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDSOneVTwo VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDSThree VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDSThreeVTwo VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDSTwo VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDSTwoVTwo VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDSixFourVThree VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardDSixFoursVThree VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardDThree VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardDThreeTwoVThree VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardDThreeTwosVThree VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardDThreeVTwo VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardDTwo VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardDTwoVThree VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardDTwoVTwo VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardDTwosVThree VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardEEightVThree VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardEEightsVThree VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardEFourVThree VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardEFoursVThree VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardEOneSixVThree VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardEOneSixsVThree VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardESixFourVThree VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardESixFoursVThree VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardEThreeTwoVThree VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardEThreeTwosVThree VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardETwoVThree VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardETwosVThree VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardFEight VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardFEights VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardFEightsVTwo VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardFFour VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardFFours VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardFFoursVTwo VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardFOne VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardFOneSix VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardFOneSixs VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardFOneSixsVTwo VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardFOnes VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardFSevenTwosVTwo VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardFSixFoursVTwo VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardFThreeTwosVTwo VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardFTwo VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardFTwos VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardFTwosVTwo VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardGFive VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGFour VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardGOne VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardGSFive VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGSFiveNegativeEight VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardGSFiveNegativeOneSix VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGSFour VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGSFourNegativeEight VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGSFourNegativeFour VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGSOne VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGSThree VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGSTwo VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGThree VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardGTwo VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardHEight VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardHEightm VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardHOneSix VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardHOneSixm VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardHOneSixmr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardHOneSixr VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardLEights VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardLFours VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardLOneSixs VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardLThreeTwos VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardMOneTwoEightms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardMOneTwoEights VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardMSixFourms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardMSixFours VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNCOneTwo VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNCOneTwosVThree VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNCOneTwosVTwo VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNCSix VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNCSixsVThree VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardNCSixsVTwo VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNCTwoFour VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNCTwoFourr VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNCTwoFourrsVThree VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNCTwoFourrsVTwo VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNCTwoFoursVThree VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNCTwoFoursVTwo VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNDOneTwos VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardNDSixs VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNDTwoFourrs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardNDTwoFours VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardNVOneTwo VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNVSix VirtualMachineSizeTypes = "Standard_NV6" + VirtualMachineSizeTypesStandardNVTwoFour VirtualMachineSizeTypes = "Standard_NV24" +) + +func PossibleValuesForVirtualMachineSizeTypes() []string { + return []string{ + string(VirtualMachineSizeTypesBasicAFour), + string(VirtualMachineSizeTypesBasicAOne), + string(VirtualMachineSizeTypesBasicAThree), + string(VirtualMachineSizeTypesBasicATwo), + string(VirtualMachineSizeTypesBasicAZero), + string(VirtualMachineSizeTypesStandardAEight), + string(VirtualMachineSizeTypesStandardAEightVTwo), + string(VirtualMachineSizeTypesStandardAEightmVTwo), + string(VirtualMachineSizeTypesStandardAFive), + string(VirtualMachineSizeTypesStandardAFour), + string(VirtualMachineSizeTypesStandardAFourVTwo), + string(VirtualMachineSizeTypesStandardAFourmVTwo), + string(VirtualMachineSizeTypesStandardANine), + string(VirtualMachineSizeTypesStandardAOne), + string(VirtualMachineSizeTypesStandardAOneOne), + string(VirtualMachineSizeTypesStandardAOneVTwo), + string(VirtualMachineSizeTypesStandardAOneZero), + string(VirtualMachineSizeTypesStandardASeven), + string(VirtualMachineSizeTypesStandardASix), + string(VirtualMachineSizeTypesStandardAThree), + string(VirtualMachineSizeTypesStandardATwo), + string(VirtualMachineSizeTypesStandardATwoVTwo), + string(VirtualMachineSizeTypesStandardATwomVTwo), + string(VirtualMachineSizeTypesStandardAZero), + string(VirtualMachineSizeTypesStandardBEightms), + string(VirtualMachineSizeTypesStandardBFourms), + string(VirtualMachineSizeTypesStandardBOnems), + string(VirtualMachineSizeTypesStandardBOnes), + string(VirtualMachineSizeTypesStandardBTwoms), + string(VirtualMachineSizeTypesStandardBTwos), + string(VirtualMachineSizeTypesStandardDEightVThree), + string(VirtualMachineSizeTypesStandardDEightsVThree), + string(VirtualMachineSizeTypesStandardDFiveVTwo), + string(VirtualMachineSizeTypesStandardDFour), + string(VirtualMachineSizeTypesStandardDFourVThree), + string(VirtualMachineSizeTypesStandardDFourVTwo), + string(VirtualMachineSizeTypesStandardDFoursVThree), + string(VirtualMachineSizeTypesStandardDOne), + string(VirtualMachineSizeTypesStandardDOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDOneFour), + string(VirtualMachineSizeTypesStandardDOneFourVTwo), + string(VirtualMachineSizeTypesStandardDOneOne), + string(VirtualMachineSizeTypesStandardDOneOneVTwo), + string(VirtualMachineSizeTypesStandardDOneSixVThree), + string(VirtualMachineSizeTypesStandardDOneSixsVThree), + string(VirtualMachineSizeTypesStandardDOneThree), + string(VirtualMachineSizeTypesStandardDOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDOneTwo), + string(VirtualMachineSizeTypesStandardDOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDOneVTwo), + string(VirtualMachineSizeTypesStandardDSFiveVTwo), + string(VirtualMachineSizeTypesStandardDSFour), + string(VirtualMachineSizeTypesStandardDSFourVTwo), + string(VirtualMachineSizeTypesStandardDSOne), + string(VirtualMachineSizeTypesStandardDSOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDSOneFour), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneOne), + string(VirtualMachineSizeTypesStandardDSOneOneVTwo), + string(VirtualMachineSizeTypesStandardDSOneThree), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDSOneTwo), + string(VirtualMachineSizeTypesStandardDSOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneVTwo), + string(VirtualMachineSizeTypesStandardDSThree), + string(VirtualMachineSizeTypesStandardDSThreeVTwo), + string(VirtualMachineSizeTypesStandardDSTwo), + string(VirtualMachineSizeTypesStandardDSTwoVTwo), + string(VirtualMachineSizeTypesStandardDSixFourVThree), + string(VirtualMachineSizeTypesStandardDSixFoursVThree), + string(VirtualMachineSizeTypesStandardDThree), + string(VirtualMachineSizeTypesStandardDThreeTwoVThree), + string(VirtualMachineSizeTypesStandardDThreeTwosVThree), + string(VirtualMachineSizeTypesStandardDThreeVTwo), + string(VirtualMachineSizeTypesStandardDTwo), + string(VirtualMachineSizeTypesStandardDTwoVThree), + string(VirtualMachineSizeTypesStandardDTwoVTwo), + string(VirtualMachineSizeTypesStandardDTwosVThree), + string(VirtualMachineSizeTypesStandardEEightVThree), + string(VirtualMachineSizeTypesStandardEEightsVThree), + string(VirtualMachineSizeTypesStandardEFourVThree), + string(VirtualMachineSizeTypesStandardEFoursVThree), + string(VirtualMachineSizeTypesStandardEOneSixVThree), + string(VirtualMachineSizeTypesStandardEOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree), + string(VirtualMachineSizeTypesStandardESixFourVThree), + string(VirtualMachineSizeTypesStandardESixFoursVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoVThree), + string(VirtualMachineSizeTypesStandardEThreeTwosVThree), + string(VirtualMachineSizeTypesStandardETwoVThree), + string(VirtualMachineSizeTypesStandardETwosVThree), + string(VirtualMachineSizeTypesStandardFEight), + string(VirtualMachineSizeTypesStandardFEights), + string(VirtualMachineSizeTypesStandardFEightsVTwo), + string(VirtualMachineSizeTypesStandardFFour), + string(VirtualMachineSizeTypesStandardFFours), + string(VirtualMachineSizeTypesStandardFFoursVTwo), + string(VirtualMachineSizeTypesStandardFOne), + string(VirtualMachineSizeTypesStandardFOneSix), + string(VirtualMachineSizeTypesStandardFOneSixs), + string(VirtualMachineSizeTypesStandardFOneSixsVTwo), + string(VirtualMachineSizeTypesStandardFOnes), + string(VirtualMachineSizeTypesStandardFSevenTwosVTwo), + string(VirtualMachineSizeTypesStandardFSixFoursVTwo), + string(VirtualMachineSizeTypesStandardFThreeTwosVTwo), + string(VirtualMachineSizeTypesStandardFTwo), + string(VirtualMachineSizeTypesStandardFTwos), + string(VirtualMachineSizeTypesStandardFTwosVTwo), + string(VirtualMachineSizeTypesStandardGFive), + string(VirtualMachineSizeTypesStandardGFour), + string(VirtualMachineSizeTypesStandardGOne), + string(VirtualMachineSizeTypesStandardGSFive), + string(VirtualMachineSizeTypesStandardGSFiveNegativeEight), + string(VirtualMachineSizeTypesStandardGSFiveNegativeOneSix), + string(VirtualMachineSizeTypesStandardGSFour), + string(VirtualMachineSizeTypesStandardGSFourNegativeEight), + string(VirtualMachineSizeTypesStandardGSFourNegativeFour), + string(VirtualMachineSizeTypesStandardGSOne), + string(VirtualMachineSizeTypesStandardGSThree), + string(VirtualMachineSizeTypesStandardGSTwo), + string(VirtualMachineSizeTypesStandardGThree), + string(VirtualMachineSizeTypesStandardGTwo), + string(VirtualMachineSizeTypesStandardHEight), + string(VirtualMachineSizeTypesStandardHEightm), + string(VirtualMachineSizeTypesStandardHOneSix), + string(VirtualMachineSizeTypesStandardHOneSixm), + string(VirtualMachineSizeTypesStandardHOneSixmr), + string(VirtualMachineSizeTypesStandardHOneSixr), + string(VirtualMachineSizeTypesStandardLEights), + string(VirtualMachineSizeTypesStandardLFours), + string(VirtualMachineSizeTypesStandardLOneSixs), + string(VirtualMachineSizeTypesStandardLThreeTwos), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMOneTwoEightms), + string(VirtualMachineSizeTypesStandardMOneTwoEights), + string(VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms), + string(VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMSixFourms), + string(VirtualMachineSizeTypesStandardMSixFours), + string(VirtualMachineSizeTypesStandardNCOneTwo), + string(VirtualMachineSizeTypesStandardNCOneTwosVThree), + string(VirtualMachineSizeTypesStandardNCOneTwosVTwo), + string(VirtualMachineSizeTypesStandardNCSix), + string(VirtualMachineSizeTypesStandardNCSixsVThree), + string(VirtualMachineSizeTypesStandardNCSixsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFour), + string(VirtualMachineSizeTypesStandardNCTwoFourr), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVThree), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFoursVThree), + string(VirtualMachineSizeTypesStandardNCTwoFoursVTwo), + string(VirtualMachineSizeTypesStandardNDOneTwos), + string(VirtualMachineSizeTypesStandardNDSixs), + string(VirtualMachineSizeTypesStandardNDTwoFourrs), + string(VirtualMachineSizeTypesStandardNDTwoFours), + string(VirtualMachineSizeTypesStandardNVOneTwo), + string(VirtualMachineSizeTypesStandardNVSix), + string(VirtualMachineSizeTypesStandardNVTwoFour), + } +} + +func (s *VirtualMachineSizeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineSizeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineSizeTypes(input string) (*VirtualMachineSizeTypes, error) { + vals := map[string]VirtualMachineSizeTypes{ + "basic_a4": VirtualMachineSizeTypesBasicAFour, + "basic_a1": VirtualMachineSizeTypesBasicAOne, + "basic_a3": VirtualMachineSizeTypesBasicAThree, + "basic_a2": VirtualMachineSizeTypesBasicATwo, + "basic_a0": VirtualMachineSizeTypesBasicAZero, + "standard_a8": VirtualMachineSizeTypesStandardAEight, + "standard_a8_v2": VirtualMachineSizeTypesStandardAEightVTwo, + "standard_a8m_v2": VirtualMachineSizeTypesStandardAEightmVTwo, + "standard_a5": VirtualMachineSizeTypesStandardAFive, + "standard_a4": VirtualMachineSizeTypesStandardAFour, + "standard_a4_v2": VirtualMachineSizeTypesStandardAFourVTwo, + "standard_a4m_v2": VirtualMachineSizeTypesStandardAFourmVTwo, + "standard_a9": VirtualMachineSizeTypesStandardANine, + "standard_a1": VirtualMachineSizeTypesStandardAOne, + "standard_a11": VirtualMachineSizeTypesStandardAOneOne, + "standard_a1_v2": VirtualMachineSizeTypesStandardAOneVTwo, + "standard_a10": VirtualMachineSizeTypesStandardAOneZero, + "standard_a7": VirtualMachineSizeTypesStandardASeven, + "standard_a6": VirtualMachineSizeTypesStandardASix, + "standard_a3": VirtualMachineSizeTypesStandardAThree, + "standard_a2": VirtualMachineSizeTypesStandardATwo, + "standard_a2_v2": VirtualMachineSizeTypesStandardATwoVTwo, + "standard_a2m_v2": VirtualMachineSizeTypesStandardATwomVTwo, + "standard_a0": VirtualMachineSizeTypesStandardAZero, + "standard_b8ms": VirtualMachineSizeTypesStandardBEightms, + "standard_b4ms": VirtualMachineSizeTypesStandardBFourms, + "standard_b1ms": VirtualMachineSizeTypesStandardBOnems, + "standard_b1s": VirtualMachineSizeTypesStandardBOnes, + "standard_b2ms": VirtualMachineSizeTypesStandardBTwoms, + "standard_b2s": VirtualMachineSizeTypesStandardBTwos, + "standard_d8_v3": VirtualMachineSizeTypesStandardDEightVThree, + "standard_d8s_v3": VirtualMachineSizeTypesStandardDEightsVThree, + "standard_d5_v2": VirtualMachineSizeTypesStandardDFiveVTwo, + "standard_d4": VirtualMachineSizeTypesStandardDFour, + "standard_d4_v3": VirtualMachineSizeTypesStandardDFourVThree, + "standard_d4_v2": VirtualMachineSizeTypesStandardDFourVTwo, + "standard_d4s_v3": VirtualMachineSizeTypesStandardDFoursVThree, + "standard_d1": VirtualMachineSizeTypesStandardDOne, + "standard_d15_v2": VirtualMachineSizeTypesStandardDOneFiveVTwo, + "standard_d14": VirtualMachineSizeTypesStandardDOneFour, + "standard_d14_v2": VirtualMachineSizeTypesStandardDOneFourVTwo, + "standard_d11": VirtualMachineSizeTypesStandardDOneOne, + "standard_d11_v2": VirtualMachineSizeTypesStandardDOneOneVTwo, + "standard_d16_v3": VirtualMachineSizeTypesStandardDOneSixVThree, + "standard_d16s_v3": VirtualMachineSizeTypesStandardDOneSixsVThree, + "standard_d13": VirtualMachineSizeTypesStandardDOneThree, + "standard_d13_v2": VirtualMachineSizeTypesStandardDOneThreeVTwo, + "standard_d12": VirtualMachineSizeTypesStandardDOneTwo, + "standard_d12_v2": VirtualMachineSizeTypesStandardDOneTwoVTwo, + "standard_d1_v2": VirtualMachineSizeTypesStandardDOneVTwo, + "standard_ds5_v2": VirtualMachineSizeTypesStandardDSFiveVTwo, + "standard_ds4": VirtualMachineSizeTypesStandardDSFour, + "standard_ds4_v2": VirtualMachineSizeTypesStandardDSFourVTwo, + "standard_ds1": VirtualMachineSizeTypesStandardDSOne, + "standard_ds15_v2": VirtualMachineSizeTypesStandardDSOneFiveVTwo, + "standard_ds14": VirtualMachineSizeTypesStandardDSOneFour, + "standard_ds14-8_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo, + "standard_ds14-4_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo, + "standard_ds14_v2": VirtualMachineSizeTypesStandardDSOneFourVTwo, + "standard_ds11": VirtualMachineSizeTypesStandardDSOneOne, + "standard_ds11_v2": VirtualMachineSizeTypesStandardDSOneOneVTwo, + "standard_ds13": VirtualMachineSizeTypesStandardDSOneThree, + "standard_ds13-4_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo, + "standard_ds13-2_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo, + "standard_ds13_v2": VirtualMachineSizeTypesStandardDSOneThreeVTwo, + "standard_ds12": VirtualMachineSizeTypesStandardDSOneTwo, + "standard_ds12_v2": VirtualMachineSizeTypesStandardDSOneTwoVTwo, + "standard_ds1_v2": VirtualMachineSizeTypesStandardDSOneVTwo, + "standard_ds3": VirtualMachineSizeTypesStandardDSThree, + "standard_ds3_v2": VirtualMachineSizeTypesStandardDSThreeVTwo, + "standard_ds2": VirtualMachineSizeTypesStandardDSTwo, + "standard_ds2_v2": VirtualMachineSizeTypesStandardDSTwoVTwo, + "standard_d64_v3": VirtualMachineSizeTypesStandardDSixFourVThree, + "standard_d64s_v3": VirtualMachineSizeTypesStandardDSixFoursVThree, + "standard_d3": VirtualMachineSizeTypesStandardDThree, + "standard_d32_v3": VirtualMachineSizeTypesStandardDThreeTwoVThree, + "standard_d32s_v3": VirtualMachineSizeTypesStandardDThreeTwosVThree, + "standard_d3_v2": VirtualMachineSizeTypesStandardDThreeVTwo, + "standard_d2": VirtualMachineSizeTypesStandardDTwo, + "standard_d2_v3": VirtualMachineSizeTypesStandardDTwoVThree, + "standard_d2_v2": VirtualMachineSizeTypesStandardDTwoVTwo, + "standard_d2s_v3": VirtualMachineSizeTypesStandardDTwosVThree, + "standard_e8_v3": VirtualMachineSizeTypesStandardEEightVThree, + "standard_e8s_v3": VirtualMachineSizeTypesStandardEEightsVThree, + "standard_e4_v3": VirtualMachineSizeTypesStandardEFourVThree, + "standard_e4s_v3": VirtualMachineSizeTypesStandardEFoursVThree, + "standard_e16_v3": VirtualMachineSizeTypesStandardEOneSixVThree, + "standard_e16s_v3": VirtualMachineSizeTypesStandardEOneSixsVThree, + "standard_e64-16s_v3": VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree, + "standard_e64-32s_v3": VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree, + "standard_e64_v3": VirtualMachineSizeTypesStandardESixFourVThree, + "standard_e64s_v3": VirtualMachineSizeTypesStandardESixFoursVThree, + "standard_e32-8s_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree, + "standard_e32-16_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree, + "standard_e32_v3": VirtualMachineSizeTypesStandardEThreeTwoVThree, + "standard_e32s_v3": VirtualMachineSizeTypesStandardEThreeTwosVThree, + "standard_e2_v3": VirtualMachineSizeTypesStandardETwoVThree, + "standard_e2s_v3": VirtualMachineSizeTypesStandardETwosVThree, + "standard_f8": VirtualMachineSizeTypesStandardFEight, + "standard_f8s": VirtualMachineSizeTypesStandardFEights, + "standard_f8s_v2": VirtualMachineSizeTypesStandardFEightsVTwo, + "standard_f4": VirtualMachineSizeTypesStandardFFour, + "standard_f4s": VirtualMachineSizeTypesStandardFFours, + "standard_f4s_v2": VirtualMachineSizeTypesStandardFFoursVTwo, + "standard_f1": VirtualMachineSizeTypesStandardFOne, + "standard_f16": VirtualMachineSizeTypesStandardFOneSix, + "standard_f16s": VirtualMachineSizeTypesStandardFOneSixs, + "standard_f16s_v2": VirtualMachineSizeTypesStandardFOneSixsVTwo, + "standard_f1s": VirtualMachineSizeTypesStandardFOnes, + "standard_f72s_v2": VirtualMachineSizeTypesStandardFSevenTwosVTwo, + "standard_f64s_v2": VirtualMachineSizeTypesStandardFSixFoursVTwo, + "standard_f32s_v2": VirtualMachineSizeTypesStandardFThreeTwosVTwo, + "standard_f2": VirtualMachineSizeTypesStandardFTwo, + "standard_f2s": VirtualMachineSizeTypesStandardFTwos, + "standard_f2s_v2": VirtualMachineSizeTypesStandardFTwosVTwo, + "standard_g5": VirtualMachineSizeTypesStandardGFive, + "standard_g4": VirtualMachineSizeTypesStandardGFour, + "standard_g1": VirtualMachineSizeTypesStandardGOne, + "standard_gs5": VirtualMachineSizeTypesStandardGSFive, + "standard_gs5-8": VirtualMachineSizeTypesStandardGSFiveNegativeEight, + "standard_gs5-16": VirtualMachineSizeTypesStandardGSFiveNegativeOneSix, + "standard_gs4": VirtualMachineSizeTypesStandardGSFour, + "standard_gs4-8": VirtualMachineSizeTypesStandardGSFourNegativeEight, + "standard_gs4-4": VirtualMachineSizeTypesStandardGSFourNegativeFour, + "standard_gs1": VirtualMachineSizeTypesStandardGSOne, + "standard_gs3": VirtualMachineSizeTypesStandardGSThree, + "standard_gs2": VirtualMachineSizeTypesStandardGSTwo, + "standard_g3": VirtualMachineSizeTypesStandardGThree, + "standard_g2": VirtualMachineSizeTypesStandardGTwo, + "standard_h8": VirtualMachineSizeTypesStandardHEight, + "standard_h8m": VirtualMachineSizeTypesStandardHEightm, + "standard_h16": VirtualMachineSizeTypesStandardHOneSix, + "standard_h16m": VirtualMachineSizeTypesStandardHOneSixm, + "standard_h16mr": VirtualMachineSizeTypesStandardHOneSixmr, + "standard_h16r": VirtualMachineSizeTypesStandardHOneSixr, + "standard_l8s": VirtualMachineSizeTypesStandardLEights, + "standard_l4s": VirtualMachineSizeTypesStandardLFours, + "standard_l16s": VirtualMachineSizeTypesStandardLOneSixs, + "standard_l32s": VirtualMachineSizeTypesStandardLThreeTwos, + "standard_m128-64ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms, + "standard_m128-32ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms, + "standard_m128ms": VirtualMachineSizeTypesStandardMOneTwoEightms, + "standard_m128s": VirtualMachineSizeTypesStandardMOneTwoEights, + "standard_m64-16ms": VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms, + "standard_m64-32ms": VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms, + "standard_m64ms": VirtualMachineSizeTypesStandardMSixFourms, + "standard_m64s": VirtualMachineSizeTypesStandardMSixFours, + "standard_nc12": VirtualMachineSizeTypesStandardNCOneTwo, + "standard_nc12s_v3": VirtualMachineSizeTypesStandardNCOneTwosVThree, + "standard_nc12s_v2": VirtualMachineSizeTypesStandardNCOneTwosVTwo, + "standard_nc6": VirtualMachineSizeTypesStandardNCSix, + "standard_nc6s_v3": VirtualMachineSizeTypesStandardNCSixsVThree, + "standard_nc6s_v2": VirtualMachineSizeTypesStandardNCSixsVTwo, + "standard_nc24": VirtualMachineSizeTypesStandardNCTwoFour, + "standard_nc24r": VirtualMachineSizeTypesStandardNCTwoFourr, + "standard_nc24rs_v3": VirtualMachineSizeTypesStandardNCTwoFourrsVThree, + "standard_nc24rs_v2": VirtualMachineSizeTypesStandardNCTwoFourrsVTwo, + "standard_nc24s_v3": VirtualMachineSizeTypesStandardNCTwoFoursVThree, + "standard_nc24s_v2": VirtualMachineSizeTypesStandardNCTwoFoursVTwo, + "standard_nd12s": VirtualMachineSizeTypesStandardNDOneTwos, + "standard_nd6s": VirtualMachineSizeTypesStandardNDSixs, + "standard_nd24rs": VirtualMachineSizeTypesStandardNDTwoFourrs, + "standard_nd24s": VirtualMachineSizeTypesStandardNDTwoFours, + "standard_nv12": VirtualMachineSizeTypesStandardNVOneTwo, + "standard_nv6": VirtualMachineSizeTypesStandardNVSix, + "standard_nv24": VirtualMachineSizeTypesStandardNVTwoFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineSizeTypes(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} + +type ZonePlacementPolicyType string + +const ( + ZonePlacementPolicyTypeAny ZonePlacementPolicyType = "Any" + ZonePlacementPolicyTypeAuto ZonePlacementPolicyType = "Auto" +) + +func PossibleValuesForZonePlacementPolicyType() []string { + return []string{ + string(ZonePlacementPolicyTypeAny), + string(ZonePlacementPolicyTypeAuto), + } +} + +func (s *ZonePlacementPolicyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseZonePlacementPolicyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseZonePlacementPolicyType(input string) (*ZonePlacementPolicyType, error) { + vals := map[string]ZonePlacementPolicyType{ + "any": ZonePlacementPolicyTypeAny, + "auto": ZonePlacementPolicyTypeAuto, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZonePlacementPolicyType(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/id_virtualmachine.go b/resource-manager/compute/2025-04-01/virtualmachines/id_virtualmachine.go new file mode 100644 index 00000000000..69a7bb18c41 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/id_virtualmachine.go @@ -0,0 +1,130 @@ +package virtualmachines + +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(&VirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineId{} + +// VirtualMachineId is a struct representing the Resource ID for a Virtual Machine +type VirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string +} + +// NewVirtualMachineID returns a new VirtualMachineId struct +func NewVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineName string) VirtualMachineId { + return VirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + } +} + +// ParseVirtualMachineID parses 'input' into a VirtualMachineId +func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + return nil +} + +// ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID +func ValidateVirtualMachineID(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 := ParseVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine ID +func (id VirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine ID +func (id VirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + } +} + +// String returns a human-readable description of this Virtual Machine ID +func (id VirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + } + return fmt.Sprintf("Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/id_virtualmachine_test.go b/resource-manager/compute/2025-04-01/virtualmachines/id_virtualmachine_test.go new file mode 100644 index 00000000000..c2266a5c640 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/id_virtualmachine_test.go @@ -0,0 +1,282 @@ +package virtualmachines + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineId{} + +func TestNewVirtualMachineID(t *testing.T) { + id := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } +} + +func TestFormatVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestParseVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestSegmentsForVirtualMachineId(t *testing.T) { + segments := VirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_assesspatches.go b/resource-manager/compute/2025-04-01/virtualmachines/method_assesspatches.go new file mode 100644 index 00000000000..8afe543212e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_assesspatches.go @@ -0,0 +1,71 @@ +package virtualmachines + +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 AssessPatchesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineAssessPatchesResult +} + +// AssessPatches ... +func (c VirtualMachinesClient) AssessPatches(ctx context.Context, id VirtualMachineId) (result AssessPatchesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/assessPatches", 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 +} + +// AssessPatchesThenPoll performs AssessPatches then polls until it's completed +func (c VirtualMachinesClient) AssessPatchesThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.AssessPatches(ctx, id) + if err != nil { + return fmt.Errorf("performing AssessPatches: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AssessPatches: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_attachdetachdatadisks.go b/resource-manager/compute/2025-04-01/virtualmachines/method_attachdetachdatadisks.go new file mode 100644 index 00000000000..214b62f377c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_attachdetachdatadisks.go @@ -0,0 +1,75 @@ +package virtualmachines + +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 AttachDetachDataDisksOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *StorageProfile +} + +// AttachDetachDataDisks ... +func (c VirtualMachinesClient) AttachDetachDataDisks(ctx context.Context, id VirtualMachineId, input AttachDetachDataDisksRequest) (result AttachDetachDataDisksOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/attachDetachDataDisks", 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 +} + +// AttachDetachDataDisksThenPoll performs AttachDetachDataDisks then polls until it's completed +func (c VirtualMachinesClient) AttachDetachDataDisksThenPoll(ctx context.Context, id VirtualMachineId, input AttachDetachDataDisksRequest) error { + result, err := c.AttachDetachDataDisks(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AttachDetachDataDisks: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AttachDetachDataDisks: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_capture.go b/resource-manager/compute/2025-04-01/virtualmachines/method_capture.go new file mode 100644 index 00000000000..a5e6496cb66 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_capture.go @@ -0,0 +1,75 @@ +package virtualmachines + +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 CaptureOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineCaptureResult +} + +// Capture ... +func (c VirtualMachinesClient) Capture(ctx context.Context, id VirtualMachineId, input VirtualMachineCaptureParameters) (result CaptureOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/capture", 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 +} + +// CaptureThenPoll performs Capture then polls until it's completed +func (c VirtualMachinesClient) CaptureThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachineCaptureParameters) error { + result, err := c.Capture(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Capture: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Capture: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_converttomanageddisks.go b/resource-manager/compute/2025-04-01/virtualmachines/method_converttomanageddisks.go new file mode 100644 index 00000000000..8c81abc13ac --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_converttomanageddisks.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 ConvertToManagedDisksOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ConvertToManagedDisks ... +func (c VirtualMachinesClient) ConvertToManagedDisks(ctx context.Context, id VirtualMachineId) (result ConvertToManagedDisksOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/convertToManagedDisks", 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 +} + +// ConvertToManagedDisksThenPoll performs ConvertToManagedDisks then polls until it's completed +func (c VirtualMachinesClient) ConvertToManagedDisksThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.ConvertToManagedDisks(ctx, id) + if err != nil { + return fmt.Errorf("performing ConvertToManagedDisks: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConvertToManagedDisks: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_createorupdate.go b/resource-manager/compute/2025-04-01/virtualmachines/method_createorupdate.go new file mode 100644 index 00000000000..cce467977a6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_createorupdate.go @@ -0,0 +1,108 @@ +package virtualmachines + +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 *VirtualMachine +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c VirtualMachinesClient) CreateOrUpdate(ctx context.Context, id VirtualMachineId, input VirtualMachine, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + OptionsObject: options, + 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 VirtualMachinesClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachine, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/resource-manager/compute/2025-04-01/virtualmachines/method_deallocate.go b/resource-manager/compute/2025-04-01/virtualmachines/method_deallocate.go new file mode 100644 index 00000000000..c962480de36 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_deallocate.go @@ -0,0 +1,99 @@ +package virtualmachines + +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 DeallocateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type DeallocateOperationOptions struct { + Hibernate *bool +} + +func DefaultDeallocateOperationOptions() DeallocateOperationOptions { + return DeallocateOperationOptions{} +} + +func (o DeallocateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeallocateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeallocateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Hibernate != nil { + out.Append("hibernate", fmt.Sprintf("%v", *o.Hibernate)) + } + return &out +} + +// Deallocate ... +func (c VirtualMachinesClient) Deallocate(ctx context.Context, id VirtualMachineId, options DeallocateOperationOptions) (result DeallocateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/deallocate", 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 +} + +// DeallocateThenPoll performs Deallocate then polls until it's completed +func (c VirtualMachinesClient) DeallocateThenPoll(ctx context.Context, id VirtualMachineId, options DeallocateOperationOptions) error { + result, err := c.Deallocate(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Deallocate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Deallocate: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_delete.go b/resource-manager/compute/2025-04-01/virtualmachines/method_delete.go new file mode 100644 index 00000000000..e2d145391fa --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_delete.go @@ -0,0 +1,100 @@ +package virtualmachines + +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 +} + +type DeleteOperationOptions struct { + ForceDeletion *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ForceDeletion != nil { + out.Append("forceDeletion", fmt.Sprintf("%v", *o.ForceDeletion)) + } + return &out +} + +// Delete ... +func (c VirtualMachinesClient) Delete(ctx context.Context, id VirtualMachineId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + OptionsObject: options, + 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 VirtualMachinesClient) DeleteThenPoll(ctx context.Context, id VirtualMachineId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/resource-manager/compute/2025-04-01/virtualmachines/method_generalize.go b/resource-manager/compute/2025-04-01/virtualmachines/method_generalize.go new file mode 100644 index 00000000000..358c6e17577 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_generalize.go @@ -0,0 +1,47 @@ +package virtualmachines + +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 GeneralizeOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Generalize ... +func (c VirtualMachinesClient) Generalize(ctx context.Context, id VirtualMachineId) (result GeneralizeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generalize", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_get.go b/resource-manager/compute/2025-04-01/virtualmachines/method_get.go new file mode 100644 index 00000000000..610b8728f94 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_get.go @@ -0,0 +1,83 @@ +package virtualmachines + +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 *VirtualMachine +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachinesClient) Get(ctx context.Context, id VirtualMachineId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 VirtualMachine + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_installpatches.go b/resource-manager/compute/2025-04-01/virtualmachines/method_installpatches.go new file mode 100644 index 00000000000..aae8d0fa685 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_installpatches.go @@ -0,0 +1,75 @@ +package virtualmachines + +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 InstallPatchesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineInstallPatchesResult +} + +// InstallPatches ... +func (c VirtualMachinesClient) InstallPatches(ctx context.Context, id VirtualMachineId, input VirtualMachineInstallPatchesParameters) (result InstallPatchesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/installPatches", 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 +} + +// InstallPatchesThenPoll performs InstallPatches then polls until it's completed +func (c VirtualMachinesClient) InstallPatchesThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachineInstallPatchesParameters) error { + result, err := c.InstallPatches(ctx, id, input) + if err != nil { + return fmt.Errorf("performing InstallPatches: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after InstallPatches: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_instanceview.go b/resource-manager/compute/2025-04-01/virtualmachines/method_instanceview.go new file mode 100644 index 00000000000..735f254f665 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_instanceview.go @@ -0,0 +1,54 @@ +package virtualmachines + +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 InstanceViewOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineInstanceView +} + +// InstanceView ... +func (c VirtualMachinesClient) InstanceView(ctx context.Context, id VirtualMachineId) (result InstanceViewOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/instanceView", 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 VirtualMachineInstanceView + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_list.go b/resource-manager/compute/2025-04-01/virtualmachines/method_list.go new file mode 100644 index 00000000000..64092df3b3a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_list.go @@ -0,0 +1,139 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachine +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachine +} + +type ListOperationOptions struct { + Expand *ExpandTypeForListVMs + Filter *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + return &out +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachinesClient) List(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/virtualMachines", 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 *[]VirtualMachine `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c VirtualMachinesClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, VirtualMachineOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachinesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions, predicate VirtualMachineOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachine, 0) + + resp, err := c.List(ctx, id, options) + 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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_listall.go b/resource-manager/compute/2025-04-01/virtualmachines/method_listall.go new file mode 100644 index 00000000000..c5abe6abb74 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_listall.go @@ -0,0 +1,143 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAllOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachine +} + +type ListAllCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachine +} + +type ListAllOperationOptions struct { + Expand *ExpandTypesForListVMs + Filter *string + StatusOnly *string +} + +func DefaultListAllOperationOptions() ListAllOperationOptions { + return ListAllOperationOptions{} +} + +func (o ListAllOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListAllOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListAllOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.StatusOnly != nil { + out.Append("statusOnly", fmt.Sprintf("%v", *o.StatusOnly)) + } + return &out +} + +type ListAllCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListAllCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListAll ... +func (c VirtualMachinesClient) ListAll(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions) (result ListAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListAllCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/virtualMachines", 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 *[]VirtualMachine `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAllComplete retrieves all the results into a single object +func (c VirtualMachinesClient) ListAllComplete(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions) (ListAllCompleteResult, error) { + return c.ListAllCompleteMatchingPredicate(ctx, id, options, VirtualMachineOperationPredicate{}) +} + +// ListAllCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachinesClient) ListAllCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions, predicate VirtualMachineOperationPredicate) (result ListAllCompleteResult, err error) { + items := make([]VirtualMachine, 0) + + resp, err := c.ListAll(ctx, id, options) + 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 = ListAllCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_listavailablesizes.go b/resource-manager/compute/2025-04-01/virtualmachines/method_listavailablesizes.go new file mode 100644 index 00000000000..d8493c6390e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_listavailablesizes.go @@ -0,0 +1,105 @@ +package virtualmachines + +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 ListAvailableSizesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineSize +} + +type ListAvailableSizesCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineSize +} + +type ListAvailableSizesCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListAvailableSizesCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListAvailableSizes ... +func (c VirtualMachinesClient) ListAvailableSizes(ctx context.Context, id VirtualMachineId) (result ListAvailableSizesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListAvailableSizesCustomPager{}, + Path: fmt.Sprintf("%s/vmSizes", 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 *[]VirtualMachineSize `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAvailableSizesComplete retrieves all the results into a single object +func (c VirtualMachinesClient) ListAvailableSizesComplete(ctx context.Context, id VirtualMachineId) (ListAvailableSizesCompleteResult, error) { + return c.ListAvailableSizesCompleteMatchingPredicate(ctx, id, VirtualMachineSizeOperationPredicate{}) +} + +// ListAvailableSizesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachinesClient) ListAvailableSizesCompleteMatchingPredicate(ctx context.Context, id VirtualMachineId, predicate VirtualMachineSizeOperationPredicate) (result ListAvailableSizesCompleteResult, err error) { + items := make([]VirtualMachineSize, 0) + + resp, err := c.ListAvailableSizes(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 = ListAvailableSizesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_migratetovmscaleset.go b/resource-manager/compute/2025-04-01/virtualmachines/method_migratetovmscaleset.go new file mode 100644 index 00000000000..eaed7ed5751 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_migratetovmscaleset.go @@ -0,0 +1,73 @@ +package virtualmachines + +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 MigrateToVMScaleSetOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// MigrateToVMScaleSet ... +func (c VirtualMachinesClient) MigrateToVMScaleSet(ctx context.Context, id VirtualMachineId, input MigrateVMToVirtualMachineScaleSetInput) (result MigrateToVMScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/migrateToVirtualMachineScaleSet", 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 +} + +// MigrateToVMScaleSetThenPoll performs MigrateToVMScaleSet then polls until it's completed +func (c VirtualMachinesClient) MigrateToVMScaleSetThenPoll(ctx context.Context, id VirtualMachineId, input MigrateVMToVirtualMachineScaleSetInput) error { + result, err := c.MigrateToVMScaleSet(ctx, id, input) + if err != nil { + return fmt.Errorf("performing MigrateToVMScaleSet: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after MigrateToVMScaleSet: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_performmaintenance.go b/resource-manager/compute/2025-04-01/virtualmachines/method_performmaintenance.go new file mode 100644 index 00000000000..bc7aac1c9fd --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_performmaintenance.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 PerformMaintenanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PerformMaintenance ... +func (c VirtualMachinesClient) PerformMaintenance(ctx context.Context, id VirtualMachineId) (result PerformMaintenanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/performMaintenance", 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 +} + +// PerformMaintenanceThenPoll performs PerformMaintenance then polls until it's completed +func (c VirtualMachinesClient) PerformMaintenanceThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.PerformMaintenance(ctx, id) + if err != nil { + return fmt.Errorf("performing PerformMaintenance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PerformMaintenance: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_poweroff.go b/resource-manager/compute/2025-04-01/virtualmachines/method_poweroff.go new file mode 100644 index 00000000000..f5c1b75d289 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_poweroff.go @@ -0,0 +1,99 @@ +package virtualmachines + +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 PowerOffOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type PowerOffOperationOptions struct { + SkipShutdown *bool +} + +func DefaultPowerOffOperationOptions() PowerOffOperationOptions { + return PowerOffOperationOptions{} +} + +func (o PowerOffOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o PowerOffOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o PowerOffOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SkipShutdown != nil { + out.Append("skipShutdown", fmt.Sprintf("%v", *o.SkipShutdown)) + } + return &out +} + +// PowerOff ... +func (c VirtualMachinesClient) PowerOff(ctx context.Context, id VirtualMachineId, options PowerOffOperationOptions) (result PowerOffOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/powerOff", 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 +} + +// PowerOffThenPoll performs PowerOff then polls until it's completed +func (c VirtualMachinesClient) PowerOffThenPoll(ctx context.Context, id VirtualMachineId, options PowerOffOperationOptions) error { + result, err := c.PowerOff(ctx, id, options) + if err != nil { + return fmt.Errorf("performing PowerOff: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PowerOff: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_reapply.go b/resource-manager/compute/2025-04-01/virtualmachines/method_reapply.go new file mode 100644 index 00000000000..1ffcd0d835d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_reapply.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 ReapplyOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reapply ... +func (c VirtualMachinesClient) Reapply(ctx context.Context, id VirtualMachineId) (result ReapplyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reapply", 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 +} + +// ReapplyThenPoll performs Reapply then polls until it's completed +func (c VirtualMachinesClient) ReapplyThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Reapply(ctx, id) + if err != nil { + return fmt.Errorf("performing Reapply: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reapply: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_redeploy.go b/resource-manager/compute/2025-04-01/virtualmachines/method_redeploy.go new file mode 100644 index 00000000000..78ed180cc3a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_redeploy.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 RedeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Redeploy ... +func (c VirtualMachinesClient) Redeploy(ctx context.Context, id VirtualMachineId) (result RedeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/redeploy", 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 +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c VirtualMachinesClient) RedeployThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Redeploy(ctx, id) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_reimage.go b/resource-manager/compute/2025-04-01/virtualmachines/method_reimage.go new file mode 100644 index 00000000000..993467b3f1d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_reimage.go @@ -0,0 +1,74 @@ +package virtualmachines + +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 ReimageOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reimage ... +func (c VirtualMachinesClient) Reimage(ctx context.Context, id VirtualMachineId, input VirtualMachineReimageParameters) (result ReimageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimage", 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 +} + +// ReimageThenPoll performs Reimage then polls until it's completed +func (c VirtualMachinesClient) ReimageThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachineReimageParameters) error { + result, err := c.Reimage(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Reimage: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reimage: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_restart.go b/resource-manager/compute/2025-04-01/virtualmachines/method_restart.go new file mode 100644 index 00000000000..72a964e8b70 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_restart.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c VirtualMachinesClient) Restart(ctx context.Context, id VirtualMachineId) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c VirtualMachinesClient) RestartThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Restart(ctx, id) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_retrievebootdiagnosticsdata.go b/resource-manager/compute/2025-04-01/virtualmachines/method_retrievebootdiagnosticsdata.go new file mode 100644 index 00000000000..cf8035af464 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_retrievebootdiagnosticsdata.go @@ -0,0 +1,83 @@ +package virtualmachines + +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 RetrieveBootDiagnosticsDataOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RetrieveBootDiagnosticsDataResult +} + +type RetrieveBootDiagnosticsDataOperationOptions struct { + SasUriExpirationTimeInMinutes *int64 +} + +func DefaultRetrieveBootDiagnosticsDataOperationOptions() RetrieveBootDiagnosticsDataOperationOptions { + return RetrieveBootDiagnosticsDataOperationOptions{} +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SasUriExpirationTimeInMinutes != nil { + out.Append("sasUriExpirationTimeInMinutes", fmt.Sprintf("%v", *o.SasUriExpirationTimeInMinutes)) + } + return &out +} + +// RetrieveBootDiagnosticsData ... +func (c VirtualMachinesClient) RetrieveBootDiagnosticsData(ctx context.Context, id VirtualMachineId, options RetrieveBootDiagnosticsDataOperationOptions) (result RetrieveBootDiagnosticsDataOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/retrieveBootDiagnosticsData", 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 RetrieveBootDiagnosticsDataResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_runcommand.go b/resource-manager/compute/2025-04-01/virtualmachines/method_runcommand.go new file mode 100644 index 00000000000..6724593464a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_runcommand.go @@ -0,0 +1,75 @@ +package virtualmachines + +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 RunCommandOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// RunCommand ... +func (c VirtualMachinesClient) RunCommand(ctx context.Context, id VirtualMachineId, input RunCommandInput) (result RunCommandOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/runCommand", 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 +} + +// RunCommandThenPoll performs RunCommand then polls until it's completed +func (c VirtualMachinesClient) RunCommandThenPoll(ctx context.Context, id VirtualMachineId, input RunCommandInput) error { + result, err := c.RunCommand(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RunCommand: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RunCommand: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_simulateeviction.go b/resource-manager/compute/2025-04-01/virtualmachines/method_simulateeviction.go new file mode 100644 index 00000000000..8363eb86067 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_simulateeviction.go @@ -0,0 +1,47 @@ +package virtualmachines + +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 SimulateEvictionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// SimulateEviction ... +func (c VirtualMachinesClient) SimulateEviction(ctx context.Context, id VirtualMachineId) (result SimulateEvictionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/simulateEviction", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_start.go b/resource-manager/compute/2025-04-01/virtualmachines/method_start.go new file mode 100644 index 00000000000..09a076e9892 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_start.go @@ -0,0 +1,70 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c VirtualMachinesClient) Start(ctx context.Context, id VirtualMachineId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StartThenPoll performs Start then polls until it's completed +func (c VirtualMachinesClient) StartThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/method_update.go b/resource-manager/compute/2025-04-01/virtualmachines/method_update.go new file mode 100644 index 00000000000..96f8c0490ea --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/method_update.go @@ -0,0 +1,107 @@ +package virtualmachines + +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 *VirtualMachine +} + +type UpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c VirtualMachinesClient) Update(ctx context.Context, id VirtualMachineId, input VirtualMachineUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + OptionsObject: options, + 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 VirtualMachinesClient) UpdateThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachineUpdate, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/resource-manager/compute/2025-04-01/virtualmachines/model_additionalcapabilities.go b/resource-manager/compute/2025-04-01/virtualmachines/model_additionalcapabilities.go new file mode 100644 index 00000000000..837128305a6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_additionalcapabilities.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalCapabilities struct { + EnableFips1403Encryption *bool `json:"enableFips1403Encryption,omitempty"` + HibernationEnabled *bool `json:"hibernationEnabled,omitempty"` + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_additionalunattendcontent.go b/resource-manager/compute/2025-04-01/virtualmachines/model_additionalunattendcontent.go new file mode 100644 index 00000000000..a507caf1366 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentName `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassName `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_allinstancesdown.go b/resource-manager/compute/2025-04-01/virtualmachines/model_allinstancesdown.go new file mode 100644 index 00000000000..0f3cd64657d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_allinstancesdown.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AllInstancesDown struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_apientityreference.go b/resource-manager/compute/2025-04-01/virtualmachines/model_apientityreference.go new file mode 100644 index 00000000000..8d25189f97d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_apientityreference.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_apierror.go b/resource-manager/compute/2025-04-01/virtualmachines/model_apierror.go new file mode 100644 index 00000000000..eb45b58287c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_apierror.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiError struct { + Code *string `json:"code,omitempty"` + Details *[]ApiErrorBase `json:"details,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_apierrorbase.go b/resource-manager/compute/2025-04-01/virtualmachines/model_apierrorbase.go new file mode 100644 index 00000000000..d065d8c0829 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_apierrorbase.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiErrorBase struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_applicationprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_applicationprofile.go new file mode 100644 index 00000000000..f40a5d2be92 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_applicationprofile.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProfile struct { + GalleryApplications *[]VMGalleryApplication `json:"galleryApplications,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_attachdetachdatadisksrequest.go b/resource-manager/compute/2025-04-01/virtualmachines/model_attachdetachdatadisksrequest.go new file mode 100644 index 00000000000..44e542e573a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_attachdetachdatadisksrequest.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachDetachDataDisksRequest struct { + DataDisksToAttach *[]DataDisksToAttach `json:"dataDisksToAttach,omitempty"` + DataDisksToDetach *[]DataDisksToDetach `json:"dataDisksToDetach,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_availablepatchsummary.go b/resource-manager/compute/2025-04-01/virtualmachines/model_availablepatchsummary.go new file mode 100644 index 00000000000..da7f29507df --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_availablepatchsummary.go @@ -0,0 +1,45 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailablePatchSummary struct { + AssessmentActivityId *string `json:"assessmentActivityId,omitempty"` + CriticalAndSecurityPatchCount *int64 `json:"criticalAndSecurityPatchCount,omitempty"` + Error *ApiError `json:"error,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + OtherPatchCount *int64 `json:"otherPatchCount,omitempty"` + RebootPending *bool `json:"rebootPending,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *AvailablePatchSummary) GetLastModifiedTimeAsTime() (*time.Time, error) { + if o.LastModifiedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AvailablePatchSummary) SetLastModifiedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedTime = &formatted +} + +func (o *AvailablePatchSummary) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AvailablePatchSummary) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_billingprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_billingprofile.go new file mode 100644 index 00000000000..430748093f8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_billingprofile.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BillingProfile struct { + MaxPrice *float64 `json:"maxPrice,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_bootdiagnostics.go b/resource-manager/compute/2025-04-01/virtualmachines/model_bootdiagnostics.go new file mode 100644 index 00000000000..973026ef552 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_bootdiagnosticsinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachines/model_bootdiagnosticsinstanceview.go new file mode 100644 index 00000000000..22f9de0401e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_bootdiagnosticsinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnosticsInstanceView struct { + ConsoleScreenshotBlobUri *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobUri *string `json:"serialConsoleLogBlobUri,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_capacityreservationprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_capacityreservationprofile.go new file mode 100644 index 00000000000..24f03ca3737 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_capacityreservationprofile.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationProfile struct { + CapacityReservationGroup *SubResource `json:"capacityReservationGroup,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_datadisk.go b/resource-manager/compute/2025-04-01/virtualmachines/model_datadisk.go new file mode 100644 index 00000000000..9862ec82440 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_datadisk.go @@ -0,0 +1,22 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + SourceResource *ApiEntityReference `json:"sourceResource,omitempty"` + ToBeDetached *bool `json:"toBeDetached,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_datadiskstoattach.go b/resource-manager/compute/2025-04-01/virtualmachines/model_datadiskstoattach.go new file mode 100644 index 00000000000..8673860f112 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_datadiskstoattach.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisksToAttach struct { + Caching *CachingTypes `json:"caching,omitempty"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + DiskId string `json:"diskId"` + Lun *int64 `json:"lun,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_datadiskstodetach.go b/resource-manager/compute/2025-04-01/virtualmachines/model_datadiskstodetach.go new file mode 100644 index 00000000000..0f69610548f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_datadiskstodetach.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisksToDetach struct { + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + DiskId string `json:"diskId"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_diagnosticsprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_diagnosticsprofile.go new file mode 100644 index 00000000000..03ff4c6f82a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_diffdisksettings.go b/resource-manager/compute/2025-04-01/virtualmachines/model_diffdisksettings.go new file mode 100644 index 00000000000..cf3958588b8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_diffdisksettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiffDiskSettings struct { + Option *DiffDiskOptions `json:"option,omitempty"` + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_diskencryptionsettings.go b/resource-manager/compute/2025-04-01/virtualmachines/model_diskencryptionsettings.go new file mode 100644 index 00000000000..f043b50178b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_diskencryptionsettings.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_diskinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachines/model_diskinstanceview.go new file mode 100644 index 00000000000..df99a282006 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_diskinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskInstanceView struct { + EncryptionSettings *[]DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_encryptionidentity.go b/resource-manager/compute/2025-04-01/virtualmachines/model_encryptionidentity.go new file mode 100644 index 00000000000..a301d4caf32 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionIdentity struct { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_eventgridandresourcegraph.go b/resource-manager/compute/2025-04-01/virtualmachines/model_eventgridandresourcegraph.go new file mode 100644 index 00000000000..528959b6e82 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_eventgridandresourcegraph.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventGridAndResourceGraph struct { + Enable *bool `json:"enable,omitempty"` + ScheduledEventsApiVersion *string `json:"scheduledEventsApiVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_hardwareprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_hardwareprofile.go new file mode 100644 index 00000000000..202eb9b34f9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_hardwareprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_hostendpointsettings.go b/resource-manager/compute/2025-04-01/virtualmachines/model_hostendpointsettings.go new file mode 100644 index 00000000000..67bf389c2d2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_imagereference.go b/resource-manager/compute/2025-04-01/virtualmachines/model_imagereference.go new file mode 100644 index 00000000000..64a1fc045b5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_imagereference.go @@ -0,0 +1,15 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + CommunityGalleryImageId *string `json:"communityGalleryImageId,omitempty"` + ExactVersion *string `json:"exactVersion,omitempty"` + Id *string `json:"id,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + SharedGalleryImageId *string `json:"sharedGalleryImageId,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_innererror.go b/resource-manager/compute/2025-04-01/virtualmachines/model_innererror.go new file mode 100644 index 00000000000..1b0445d0ac8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_innererror.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InnerError struct { + Errordetail *string `json:"errordetail,omitempty"` + Exceptiontype *string `json:"exceptiontype,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/virtualmachines/model_instanceviewstatus.go new file mode 100644 index 00000000000..9c5cb3e75d8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_keyvaultkeyreference.go b/resource-manager/compute/2025-04-01/virtualmachines/model_keyvaultkeyreference.go new file mode 100644 index 00000000000..c50244524ea --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_keyvaultkeyreference.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyURL string `json:"keyUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_keyvaultsecretreference.go b/resource-manager/compute/2025-04-01/virtualmachines/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..b739f603f31 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_lastpatchinstallationsummary.go b/resource-manager/compute/2025-04-01/virtualmachines/model_lastpatchinstallationsummary.go new file mode 100644 index 00000000000..987c11896cf --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_lastpatchinstallationsummary.go @@ -0,0 +1,48 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LastPatchInstallationSummary struct { + Error *ApiError `json:"error,omitempty"` + ExcludedPatchCount *int64 `json:"excludedPatchCount,omitempty"` + FailedPatchCount *int64 `json:"failedPatchCount,omitempty"` + InstallationActivityId *string `json:"installationActivityId,omitempty"` + InstalledPatchCount *int64 `json:"installedPatchCount,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + MaintenanceWindowExceeded *bool `json:"maintenanceWindowExceeded,omitempty"` + NotSelectedPatchCount *int64 `json:"notSelectedPatchCount,omitempty"` + PendingPatchCount *int64 `json:"pendingPatchCount,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *LastPatchInstallationSummary) GetLastModifiedTimeAsTime() (*time.Time, error) { + if o.LastModifiedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LastPatchInstallationSummary) SetLastModifiedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedTime = &formatted +} + +func (o *LastPatchInstallationSummary) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LastPatchInstallationSummary) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_linuxconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachines/model_linuxconfiguration.go new file mode 100644 index 00000000000..9cf230b3b45 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_linuxparameters.go b/resource-manager/compute/2025-04-01/virtualmachines/model_linuxparameters.go new file mode 100644 index 00000000000..0a4cb464f03 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_linuxparameters.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxParameters struct { + ClassificationsToInclude *[]VMGuestPatchClassificationLinux `json:"classificationsToInclude,omitempty"` + MaintenanceRunId *string `json:"maintenanceRunId,omitempty"` + PackageNameMasksToExclude *[]string `json:"packageNameMasksToExclude,omitempty"` + PackageNameMasksToInclude *[]string `json:"packageNameMasksToInclude,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_linuxpatchsettings.go b/resource-manager/compute/2025-04-01/virtualmachines/model_linuxpatchsettings.go new file mode 100644 index 00000000000..6cab7bb4d77 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/virtualmachines/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..d01cfc95836 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_maintenanceredeploystatus.go b/resource-manager/compute/2025-04-01/virtualmachines/model_maintenanceredeploystatus.go new file mode 100644 index 00000000000..daebcaa340c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_maintenanceredeploystatus.go @@ -0,0 +1,68 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceRedeployStatus struct { + IsCustomerInitiatedMaintenanceAllowed *bool `json:"isCustomerInitiatedMaintenanceAllowed,omitempty"` + LastOperationMessage *string `json:"lastOperationMessage,omitempty"` + LastOperationResultCode *MaintenanceOperationResultCodeTypes `json:"lastOperationResultCode,omitempty"` + MaintenanceWindowEndTime *string `json:"maintenanceWindowEndTime,omitempty"` + MaintenanceWindowStartTime *string `json:"maintenanceWindowStartTime,omitempty"` + PreMaintenanceWindowEndTime *string `json:"preMaintenanceWindowEndTime,omitempty"` + PreMaintenanceWindowStartTime *string `json:"preMaintenanceWindowStartTime,omitempty"` +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowStartTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowStartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_manageddiskparameters.go b/resource-manager/compute/2025-04-01/virtualmachines/model_manageddiskparameters.go new file mode 100644 index 00000000000..e405c361b60 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_manageddiskparameters.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Id *string `json:"id,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_migratevmtovirtualmachinescalesetinput.go b/resource-manager/compute/2025-04-01/virtualmachines/model_migratevmtovirtualmachinescalesetinput.go new file mode 100644 index 00000000000..3f9a0378f88 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_migratevmtovirtualmachinescalesetinput.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrateVMToVirtualMachineScaleSetInput struct { + TargetFaultDomain *int64 `json:"targetFaultDomain,omitempty"` + TargetVMSize *string `json:"targetVMSize,omitempty"` + TargetZone *string `json:"targetZone,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_networkinterfacereference.go b/resource-manager/compute/2025-04-01/virtualmachines/model_networkinterfacereference.go new file mode 100644 index 00000000000..a2111db0c57 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_networkinterfacereference.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReference struct { + Id *string `json:"id,omitempty"` + Properties *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_networkinterfacereferenceproperties.go b/resource-manager/compute/2025-04-01/virtualmachines/model_networkinterfacereferenceproperties.go new file mode 100644 index 00000000000..67a2785687f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_networkinterfacereferenceproperties.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReferenceProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_networkprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_networkprofile.go new file mode 100644 index 00000000000..0a5744ae56d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_networkprofile.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineNetworkInterfaceConfiguration `json:"networkInterfaceConfigurations,omitempty"` + NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_osdisk.go b/resource-manager/compute/2025-04-01/virtualmachines/model_osdisk.go new file mode 100644 index 00000000000..dc4a229b622 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_osdisk.go @@ -0,0 +1,19 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemTypes `json:"osType,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_osimagenotificationprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_osimagenotificationprofile.go new file mode 100644 index 00000000000..ddbc2dd6c5a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_osimagenotificationprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSImageNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_osprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_osprofile.go new file mode 100644 index 00000000000..513bcc59472 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_osprofile.go @@ -0,0 +1,16 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_osprofileprovisioningdata.go b/resource-manager/compute/2025-04-01/virtualmachines/model_osprofileprovisioningdata.go new file mode 100644 index 00000000000..fa3bf13c1a7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_osprofileprovisioningdata.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfileProvisioningData struct { + AdminPassword *string `json:"adminPassword,omitempty"` + CustomData *string `json:"customData,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_patchinstallationdetail.go b/resource-manager/compute/2025-04-01/virtualmachines/model_patchinstallationdetail.go new file mode 100644 index 00000000000..b17aa46e9f1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_patchinstallationdetail.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchInstallationDetail struct { + Classifications *[]string `json:"classifications,omitempty"` + InstallationState *PatchInstallationState `json:"installationState,omitempty"` + KbId *string `json:"kbId,omitempty"` + Name *string `json:"name,omitempty"` + PatchId *string `json:"patchId,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_patchsettings.go b/resource-manager/compute/2025-04-01/virtualmachines/model_patchsettings.go new file mode 100644 index 00000000000..fa62f8db7d2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_patchsettings.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_placement.go b/resource-manager/compute/2025-04-01/virtualmachines/model_placement.go new file mode 100644 index 00000000000..92895903ef9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_placement.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Placement struct { + ExcludeZones *[]string `json:"excludeZones,omitempty"` + IncludeZones *[]string `json:"includeZones,omitempty"` + ZonePlacementPolicy *ZonePlacementPolicyType `json:"zonePlacementPolicy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_plan.go b/resource-manager/compute/2025-04-01/virtualmachines/model_plan.go new file mode 100644 index 00000000000..d99f0a00ba4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_plan.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher *string `json:"publisher,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_proxyagentsettings.go b/resource-manager/compute/2025-04-01/virtualmachines/model_proxyagentsettings.go new file mode 100644 index 00000000000..7e4c364734e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_proxyagentsettings.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + AddProxyAgentExtension *bool `json:"addProxyAgentExtension,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_publicipaddresssku.go b/resource-manager/compute/2025-04-01/virtualmachines/model_publicipaddresssku.go new file mode 100644 index 00000000000..4783908fdd2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_publicipaddresssku.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicIPAddressSku struct { + Name *PublicIPAddressSkuName `json:"name,omitempty"` + Tier *PublicIPAddressSkuTier `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_retrievebootdiagnosticsdataresult.go b/resource-manager/compute/2025-04-01/virtualmachines/model_retrievebootdiagnosticsdataresult.go new file mode 100644 index 00000000000..936c3eb1c64 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_retrievebootdiagnosticsdataresult.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetrieveBootDiagnosticsDataResult struct { + ConsoleScreenshotBlobUri *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobUri *string `json:"serialConsoleLogBlobUri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_runcommandinput.go b/resource-manager/compute/2025-04-01/virtualmachines/model_runcommandinput.go new file mode 100644 index 00000000000..de283a9604a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_runcommandinput.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInput struct { + CommandId string `json:"commandId"` + Parameters *[]RunCommandInputParameter `json:"parameters,omitempty"` + Script *[]string `json:"script,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_runcommandinputparameter.go b/resource-manager/compute/2025-04-01/virtualmachines/model_runcommandinputparameter.go new file mode 100644 index 00000000000..647469c97b3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_runcommandinputparameter.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInputParameter struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_runcommandresult.go b/resource-manager/compute/2025-04-01/virtualmachines/model_runcommandresult.go new file mode 100644 index 00000000000..deeeb12253f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_runcommandresult.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandResult struct { + Value *[]InstanceViewStatus `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_scheduledeventsadditionalpublishingtargets.go b/resource-manager/compute/2025-04-01/virtualmachines/model_scheduledeventsadditionalpublishingtargets.go new file mode 100644 index 00000000000..90d123f4dc2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_scheduledeventsadditionalpublishingtargets.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsAdditionalPublishingTargets struct { + EventGridAndResourceGraph *EventGridAndResourceGraph `json:"eventGridAndResourceGraph,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_scheduledeventspolicy.go b/resource-manager/compute/2025-04-01/virtualmachines/model_scheduledeventspolicy.go new file mode 100644 index 00000000000..f480e2c849e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_scheduledeventspolicy.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsPolicy struct { + AllInstancesDown *AllInstancesDown `json:"allInstancesDown,omitempty"` + ScheduledEventsAdditionalPublishingTargets *ScheduledEventsAdditionalPublishingTargets `json:"scheduledEventsAdditionalPublishingTargets,omitempty"` + UserInitiatedReboot *UserInitiatedReboot `json:"userInitiatedReboot,omitempty"` + UserInitiatedRedeploy *UserInitiatedRedeploy `json:"userInitiatedRedeploy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_scheduledeventsprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_scheduledeventsprofile.go new file mode 100644 index 00000000000..c4d619e1f44 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_scheduledeventsprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsProfile struct { + OsImageNotificationProfile *OSImageNotificationProfile `json:"osImageNotificationProfile,omitempty"` + TerminateNotificationProfile *TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_securityprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_securityprofile.go new file mode 100644 index 00000000000..21dff4e227a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_securityprofile.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_sshconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachines/model_sshconfiguration.go new file mode 100644 index 00000000000..415a68d1131 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_sshpublickey.go b/resource-manager/compute/2025-04-01/virtualmachines/model_sshpublickey.go new file mode 100644 index 00000000000..7b37d0ed998 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_sshpublickey.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_storageprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_storageprofile.go new file mode 100644 index 00000000000..359a18196c6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_storageprofile.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + AlignRegionalDisksToVMZone *bool `json:"alignRegionalDisksToVMZone,omitempty"` + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *OSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_subresource.go b/resource-manager/compute/2025-04-01/virtualmachines/model_subresource.go new file mode 100644 index 00000000000..d63b96f27e3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_terminatenotificationprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_terminatenotificationprofile.go new file mode 100644 index 00000000000..ff62463069c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_terminatenotificationprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TerminateNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_uefisettings.go b/resource-manager/compute/2025-04-01/virtualmachines/model_uefisettings.go new file mode 100644 index 00000000000..dad471d9f35 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_uefisettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_userinitiatedreboot.go b/resource-manager/compute/2025-04-01/virtualmachines/model_userinitiatedreboot.go new file mode 100644 index 00000000000..61e5b12a9e6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_userinitiatedreboot.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedReboot struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_userinitiatedredeploy.go b/resource-manager/compute/2025-04-01/virtualmachines/model_userinitiatedredeploy.go new file mode 100644 index 00000000000..9b68b1337fa --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_userinitiatedredeploy.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedRedeploy struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_vaultcertificate.go b/resource-manager/compute/2025-04-01/virtualmachines/model_vaultcertificate.go new file mode 100644 index 00000000000..73f8924cdde --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_vaultsecretgroup.go b/resource-manager/compute/2025-04-01/virtualmachines/model_vaultsecretgroup.go new file mode 100644 index 00000000000..f7c88cb420c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualharddisk.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualharddisk.go new file mode 100644 index 00000000000..c8d3cd52669 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualharddisk.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualHardDisk struct { + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachine.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachine.go new file mode 100644 index 00000000000..777133e2e50 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachine.go @@ -0,0 +1,29 @@ +package virtualmachines + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachine struct { + Etag *string `json:"etag,omitempty"` + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Placement *Placement `json:"placement,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineProperties `json:"properties,omitempty"` + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineagentinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineagentinstanceview.go new file mode 100644 index 00000000000..7dbc1430c8f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineagentinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineAgentInstanceView struct { + ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgentVersion *string `json:"vmAgentVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineassesspatchesresult.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineassesspatchesresult.go new file mode 100644 index 00000000000..aac8e0a30db --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineassesspatchesresult.go @@ -0,0 +1,33 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineAssessPatchesResult struct { + AssessmentActivityId *string `json:"assessmentActivityId,omitempty"` + AvailablePatches *[]VirtualMachineSoftwarePatchProperties `json:"availablePatches,omitempty"` + CriticalAndSecurityPatchCount *int64 `json:"criticalAndSecurityPatchCount,omitempty"` + Error *ApiError `json:"error,omitempty"` + OtherPatchCount *int64 `json:"otherPatchCount,omitempty"` + RebootPending *bool `json:"rebootPending,omitempty"` + StartDateTime *string `json:"startDateTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *VirtualMachineAssessPatchesResult) GetStartDateTimeAsTime() (*time.Time, error) { + if o.StartDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineAssessPatchesResult) SetStartDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartDateTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinecaptureparameters.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinecaptureparameters.go new file mode 100644 index 00000000000..078286c327c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinecaptureparameters.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineCaptureParameters struct { + DestinationContainerName string `json:"destinationContainerName"` + OverwriteVhds bool `json:"overwriteVhds"` + VhdPrefix string `json:"vhdPrefix"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinecaptureresult.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinecaptureresult.go new file mode 100644 index 00000000000..daaf5617a33 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinecaptureresult.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineCaptureResult struct { + ContentVersion *string `json:"contentVersion,omitempty"` + Id *string `json:"id,omitempty"` + Parameters *interface{} `json:"parameters,omitempty"` + Resources *[]interface{} `json:"resources,omitempty"` + Schema *string `json:"$schema,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextension.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextension.go new file mode 100644 index 00000000000..8cb29cb26a0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextension.go @@ -0,0 +1,18 @@ +package virtualmachines + +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 VirtualMachineExtension struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextensionhandlerinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextensionhandlerinstanceview.go new file mode 100644 index 00000000000..6895f8092d0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextensionhandlerinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionHandlerInstanceView struct { + Status *InstanceViewStatus `json:"status,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextensioninstanceview.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextensioninstanceview.go new file mode 100644 index 00000000000..1f474e8bed2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextensioninstanceview.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextensionproperties.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextensionproperties.go new file mode 100644 index 00000000000..58201efcab3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineextensionproperties.go @@ -0,0 +1,20 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinehealthstatus.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinehealthstatus.go new file mode 100644 index 00000000000..021c0337a8b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinehealthstatus.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineHealthStatus struct { + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineinstallpatchesparameters.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineinstallpatchesparameters.go new file mode 100644 index 00000000000..b1810258e64 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineinstallpatchesparameters.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstallPatchesParameters struct { + LinuxParameters *LinuxParameters `json:"linuxParameters,omitempty"` + MaximumDuration *string `json:"maximumDuration,omitempty"` + RebootSetting VMGuestPatchRebootSetting `json:"rebootSetting"` + WindowsParameters *WindowsParameters `json:"windowsParameters,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineinstallpatchesresult.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineinstallpatchesresult.go new file mode 100644 index 00000000000..52e875ae035 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineinstallpatchesresult.go @@ -0,0 +1,37 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstallPatchesResult struct { + Error *ApiError `json:"error,omitempty"` + ExcludedPatchCount *int64 `json:"excludedPatchCount,omitempty"` + FailedPatchCount *int64 `json:"failedPatchCount,omitempty"` + InstallationActivityId *string `json:"installationActivityId,omitempty"` + InstalledPatchCount *int64 `json:"installedPatchCount,omitempty"` + MaintenanceWindowExceeded *bool `json:"maintenanceWindowExceeded,omitempty"` + NotSelectedPatchCount *int64 `json:"notSelectedPatchCount,omitempty"` + Patches *[]PatchInstallationDetail `json:"patches,omitempty"` + PendingPatchCount *int64 `json:"pendingPatchCount,omitempty"` + RebootStatus *VMGuestPatchRebootStatus `json:"rebootStatus,omitempty"` + StartDateTime *string `json:"startDateTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *VirtualMachineInstallPatchesResult) GetStartDateTimeAsTime() (*time.Time, error) { + if o.StartDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineInstallPatchesResult) SetStartDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartDateTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineinstanceview.go new file mode 100644 index 00000000000..8115a5b3cff --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineinstanceview.go @@ -0,0 +1,24 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceView struct { + AssignedHost *string `json:"assignedHost,omitempty"` + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + Disks *[]DiskInstanceView `json:"disks,omitempty"` + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + HyperVGeneration *HyperVGenerationType `json:"hyperVGeneration,omitempty"` + IsVMInStandbyPool *bool `json:"isVMInStandbyPool,omitempty"` + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + OsName *string `json:"osName,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + PatchStatus *VirtualMachinePatchStatus `json:"patchStatus,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + PlatformUpdateDomain *int64 `json:"platformUpdateDomain,omitempty"` + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineiptag.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineiptag.go new file mode 100644 index 00000000000..9b7778110d2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineiptag.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceconfiguration.go new file mode 100644 index 00000000000..54760ab7b08 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceConfigurationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceconfigurationproperties.go new file mode 100644 index 00000000000..4a93a335955 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceconfigurationproperties.go @@ -0,0 +1,19 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineNetworkInterfaceDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineNetworkInterfaceIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfacednssettingsconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfacednssettingsconfiguration.go new file mode 100644 index 00000000000..d0610637be3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfacednssettingsconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceDnsSettingsConfiguration struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfiguration.go new file mode 100644 index 00000000000..d84aa7ee7c9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfigurationproperties.go new file mode 100644 index 00000000000..ac1a9f67ae9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfigurationproperties.go @@ -0,0 +1,14 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersions `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachinePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *SubResource `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepatchstatus.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepatchstatus.go new file mode 100644 index 00000000000..563ee2e6237 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepatchstatus.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePatchStatus struct { + AvailablePatchSummary *AvailablePatchSummary `json:"availablePatchSummary,omitempty"` + ConfigurationStatuses *[]InstanceViewStatus `json:"configurationStatuses,omitempty"` + LastPatchInstallationSummary *LastPatchInstallationSummary `json:"lastPatchInstallationSummary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineproperties.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineproperties.go new file mode 100644 index 00000000000..2de07158c5e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineproperties.go @@ -0,0 +1,52 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + EvictionPolicy *VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + Host *SubResource `json:"host,omitempty"` + HostGroup *SubResource `json:"hostGroup,omitempty"` + InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + Priority *VirtualMachinePriorityTypes `json:"priority,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ScheduledEventsPolicy *ScheduledEventsPolicy `json:"scheduledEventsPolicy,omitempty"` + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UserData *string `json:"userData,omitempty"` + VMId *string `json:"vmId,omitempty"` + VirtualMachineScaleSet *SubResource `json:"virtualMachineScaleSet,omitempty"` +} + +func (o *VirtualMachineProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepublicipaddressconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepublicipaddressconfiguration.go new file mode 100644 index 00000000000..df530504bda --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepublicipaddressconfiguration.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachinePublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepublicipaddressconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..6352be21b5c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepublicipaddressconfigurationproperties.go @@ -0,0 +1,14 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachinePublicIPAddressDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersions `json:"publicIPAddressVersion,omitempty"` + PublicIPAllocationMethod *PublicIPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepublicipaddressdnssettingsconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepublicipaddressdnssettingsconfiguration.go new file mode 100644 index 00000000000..8159711227a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinepublicipaddressdnssettingsconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressDnsSettingsConfiguration struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinereimageparameters.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinereimageparameters.go new file mode 100644 index 00000000000..8dcea267ddd --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinereimageparameters.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineReimageParameters struct { + ExactVersion *string `json:"exactVersion,omitempty"` + OsProfile *OSProfileProvisioningData `json:"osProfile,omitempty"` + TempDisk *bool `json:"tempDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinesize.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinesize.go new file mode 100644 index 00000000000..5de05c343a9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinesize.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSize struct { + MaxDataDiskCount *int64 `json:"maxDataDiskCount,omitempty"` + MemoryInMB *int64 `json:"memoryInMB,omitempty"` + Name *string `json:"name,omitempty"` + NumberOfCores *int64 `json:"numberOfCores,omitempty"` + OsDiskSizeInMB *int64 `json:"osDiskSizeInMB,omitempty"` + ResourceDiskSizeInMB *int64 `json:"resourceDiskSizeInMB,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinesoftwarepatchproperties.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinesoftwarepatchproperties.go new file mode 100644 index 00000000000..8d12f134ef1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachinesoftwarepatchproperties.go @@ -0,0 +1,47 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSoftwarePatchProperties struct { + ActivityId *string `json:"activityId,omitempty"` + AssessmentState *PatchAssessmentState `json:"assessmentState,omitempty"` + Classifications *[]string `json:"classifications,omitempty"` + KbId *string `json:"kbId,omitempty"` + LastModifiedDateTime *string `json:"lastModifiedDateTime,omitempty"` + Name *string `json:"name,omitempty"` + PatchId *string `json:"patchId,omitempty"` + PublishedDate *string `json:"publishedDate,omitempty"` + RebootBehavior *VMGuestPatchRebootBehavior `json:"rebootBehavior,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (o *VirtualMachineSoftwarePatchProperties) GetLastModifiedDateTimeAsTime() (*time.Time, error) { + if o.LastModifiedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineSoftwarePatchProperties) SetLastModifiedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedDateTime = &formatted +} + +func (o *VirtualMachineSoftwarePatchProperties) GetPublishedDateAsTime() (*time.Time, error) { + if o.PublishedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PublishedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineSoftwarePatchProperties) SetPublishedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PublishedDate = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineupdate.go b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineupdate.go new file mode 100644 index 00000000000..360d625ebac --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_virtualmachineupdate.go @@ -0,0 +1,17 @@ +package virtualmachines + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineUpdate struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_vmdisksecurityprofile.go b/resource-manager/compute/2025-04-01/virtualmachines/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..ad81ec1c12c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_vmgalleryapplication.go b/resource-manager/compute/2025-04-01/virtualmachines/model_vmgalleryapplication.go new file mode 100644 index 00000000000..90b989063e5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_vmgalleryapplication.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMGalleryApplication struct { + ConfigurationReference *string `json:"configurationReference,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + Order *int64 `json:"order,omitempty"` + PackageReferenceId string `json:"packageReferenceId"` + Tags *string `json:"tags,omitempty"` + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_vmsizeproperties.go b/resource-manager/compute/2025-04-01/virtualmachines/model_vmsizeproperties.go new file mode 100644 index 00000000000..f4e57fddd1b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_windowsconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachines/model_windowsconfiguration.go new file mode 100644 index 00000000000..45060fd6cec --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_windowsparameters.go b/resource-manager/compute/2025-04-01/virtualmachines/model_windowsparameters.go new file mode 100644 index 00000000000..02c72ba8843 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_windowsparameters.go @@ -0,0 +1,32 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsParameters struct { + ClassificationsToInclude *[]VMGuestPatchClassificationWindows `json:"classificationsToInclude,omitempty"` + ExcludeKbsRequiringReboot *bool `json:"excludeKbsRequiringReboot,omitempty"` + KbNumbersToExclude *[]string `json:"kbNumbersToExclude,omitempty"` + KbNumbersToInclude *[]string `json:"kbNumbersToInclude,omitempty"` + MaxPatchPublishDate *string `json:"maxPatchPublishDate,omitempty"` + PatchNameMasksToExclude *[]string `json:"patchNameMasksToExclude,omitempty"` + PatchNameMasksToInclude *[]string `json:"patchNameMasksToInclude,omitempty"` +} + +func (o *WindowsParameters) GetMaxPatchPublishDateAsTime() (*time.Time, error) { + if o.MaxPatchPublishDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaxPatchPublishDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *WindowsParameters) SetMaxPatchPublishDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaxPatchPublishDate = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/virtualmachines/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..21886cadbc0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_winrmconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachines/model_winrmconfiguration.go new file mode 100644 index 00000000000..2afec23e6ff --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/model_winrmlistener.go b/resource-manager/compute/2025-04-01/virtualmachines/model_winrmlistener.go new file mode 100644 index 00000000000..30b38d846e4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/model_winrmlistener.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/predicates.go b/resource-manager/compute/2025-04-01/virtualmachines/predicates.go new file mode 100644 index 00000000000..f3f3440d6d0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/predicates.go @@ -0,0 +1,80 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineOperationPredicate struct { + Etag *string + Id *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p VirtualMachineOperationPredicate) Matches(input VirtualMachine) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil || *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type VirtualMachineSizeOperationPredicate struct { + MaxDataDiskCount *int64 + MemoryInMB *int64 + Name *string + NumberOfCores *int64 + OsDiskSizeInMB *int64 + ResourceDiskSizeInMB *int64 +} + +func (p VirtualMachineSizeOperationPredicate) Matches(input VirtualMachineSize) bool { + + if p.MaxDataDiskCount != nil && (input.MaxDataDiskCount == nil || *p.MaxDataDiskCount != *input.MaxDataDiskCount) { + return false + } + + if p.MemoryInMB != nil && (input.MemoryInMB == nil || *p.MemoryInMB != *input.MemoryInMB) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.NumberOfCores != nil && (input.NumberOfCores == nil || *p.NumberOfCores != *input.NumberOfCores) { + return false + } + + if p.OsDiskSizeInMB != nil && (input.OsDiskSizeInMB == nil || *p.OsDiskSizeInMB != *input.OsDiskSizeInMB) { + return false + } + + if p.ResourceDiskSizeInMB != nil && (input.ResourceDiskSizeInMB == nil || *p.ResourceDiskSizeInMB != *input.ResourceDiskSizeInMB) { + return false + } + + return true +} diff --git a/resource-manager/compute/2025-04-01/virtualmachines/version.go b/resource-manager/compute/2025-04-01/virtualmachines/version.go new file mode 100644 index 00000000000..7bd42d0ed93 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachines/version.go @@ -0,0 +1,10 @@ +package virtualmachines + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachines/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/README.md b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/README.md new file mode 100644 index 00000000000..1fed06a3eeb --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions` Documentation + +The `virtualmachinescalesetextensions` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/virtualmachinescalesetextensions" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetExtensionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + +payload := virtualmachinescalesetextensions.VirtualMachineScaleSetExtension{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetExtensionsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetExtensionsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + +read, err := client.Get(ctx, id, virtualmachinescalesetextensions.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetExtensionsClient.List` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetExtensionsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + +payload := virtualmachinescalesetextensions.VirtualMachineScaleSetExtensionUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/client.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/client.go new file mode 100644 index 00000000000..8b2f0aa3f61 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesetextensions + +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 VirtualMachineScaleSetExtensionsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetExtensionsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetExtensionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesetextensions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetExtensionsClient: %+v", err) + } + + return &VirtualMachineScaleSetExtensionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go new file mode 100644 index 00000000000..d9ab06b3c90 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go @@ -0,0 +1,130 @@ +package virtualmachinescalesetextensions + +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(&VirtualMachineScaleSetId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +// VirtualMachineScaleSetId is a struct representing the Resource ID for a Virtual Machine Scale Set +type VirtualMachineScaleSetId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string +} + +// NewVirtualMachineScaleSetID returns a new VirtualMachineScaleSetId struct +func NewVirtualMachineScaleSetID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string) VirtualMachineScaleSetId { + return VirtualMachineScaleSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + } +} + +// ParseVirtualMachineScaleSetID parses 'input' into a VirtualMachineScaleSetId +func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID +func ValidateVirtualMachineScaleSetID(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 := ParseVirtualMachineScaleSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + } + return fmt.Sprintf("Virtual Machine Scale Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescaleset_test.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescaleset_test.go new file mode 100644 index 00000000000..d361d893e30 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescaleset_test.go @@ -0,0 +1,282 @@ +package virtualmachinescalesetextensions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +func TestNewVirtualMachineScaleSetID(t *testing.T) { + id := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } +} + +func TestFormatVirtualMachineScaleSetID(t *testing.T) { + actual := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestParseVirtualMachineScaleSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetId(t *testing.T) { + segments := VirtualMachineScaleSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go new file mode 100644 index 00000000000..371728a2982 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go @@ -0,0 +1,139 @@ +package virtualmachinescalesetextensions + +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(&VirtualMachineScaleSetExtensionId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetExtensionId{} + +// VirtualMachineScaleSetExtensionId is a struct representing the Resource ID for a Virtual Machine Scale Set Extension +type VirtualMachineScaleSetExtensionId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + ExtensionName string +} + +// NewVirtualMachineScaleSetExtensionID returns a new VirtualMachineScaleSetExtensionId struct +func NewVirtualMachineScaleSetExtensionID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, extensionName string) VirtualMachineScaleSetExtensionId { + return VirtualMachineScaleSetExtensionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + ExtensionName: extensionName, + } +} + +// ParseVirtualMachineScaleSetExtensionID parses 'input' into a VirtualMachineScaleSetExtensionId +func ParseVirtualMachineScaleSetExtensionID(input string) (*VirtualMachineScaleSetExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetExtensionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetExtensionIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetExtensionId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetExtensionIDInsensitively(input string) (*VirtualMachineScaleSetExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetExtensionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetExtensionId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetExtensionID checks that 'input' can be parsed as a Virtual Machine Scale Set Extension ID +func ValidateVirtualMachineScaleSetExtensionID(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 := ParseVirtualMachineScaleSetExtensionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Extension ID +func (id VirtualMachineScaleSetExtensionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/extensions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.ExtensionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Extension ID +func (id VirtualMachineScaleSetExtensionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticExtensions", "extensions", "extensions"), + resourceids.UserSpecifiedSegment("extensionName", "extensionName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Extension ID +func (id VirtualMachineScaleSetExtensionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Extension Name: %q", id.ExtensionName), + } + return fmt.Sprintf("Virtual Machine Scale Set Extension (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension_test.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension_test.go new file mode 100644 index 00000000000..41e7a35c801 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension_test.go @@ -0,0 +1,327 @@ +package virtualmachinescalesetextensions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineScaleSetExtensionId{} + +func TestNewVirtualMachineScaleSetExtensionID(t *testing.T) { + id := NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.ExtensionName != "extensionName" { + t.Fatalf("Expected %q but got %q for Segment 'ExtensionName'", id.ExtensionName, "extensionName") + } +} + +func TestFormatVirtualMachineScaleSetExtensionID(t *testing.T) { + actual := NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetExtensionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetExtensionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName", + Expected: &VirtualMachineScaleSetExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetExtensionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestParseVirtualMachineScaleSetExtensionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetExtensionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/eXtEnSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName", + Expected: &VirtualMachineScaleSetExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/eXtEnSiOnS/eXtEnSiOnNaMe", + Expected: &VirtualMachineScaleSetExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + ExtensionName: "eXtEnSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/eXtEnSiOnS/eXtEnSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetExtensionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetExtensionId(t *testing.T) { + segments := VirtualMachineScaleSetExtensionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetExtensionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_createorupdate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_createorupdate.go new file mode 100644 index 00000000000..a771df1fd11 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetextensions + +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 *VirtualMachineScaleSetExtension +} + +// CreateOrUpdate ... +func (c VirtualMachineScaleSetExtensionsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineScaleSetExtensionId, input VirtualMachineScaleSetExtension) (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 VirtualMachineScaleSetExtensionsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetExtensionId, input VirtualMachineScaleSetExtension) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_delete.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_delete.go new file mode 100644 index 00000000000..ce222a555c3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachinescalesetextensions + +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 VirtualMachineScaleSetExtensionsClient) Delete(ctx context.Context, id VirtualMachineScaleSetExtensionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachineScaleSetExtensionsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineScaleSetExtensionId) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_get.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_get.go new file mode 100644 index 00000000000..58bd9a83728 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetextensions + +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 *VirtualMachineScaleSetExtension +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, id VirtualMachineScaleSetExtensionId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 VirtualMachineScaleSetExtension + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_list.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_list.go new file mode 100644 index 00000000000..56536db416c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_list.go @@ -0,0 +1,105 @@ +package virtualmachinescalesetextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSetExtension +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSetExtension +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachineScaleSetExtensionsClient) List(ctx context.Context, id VirtualMachineScaleSetId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/extensions", 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 *[]VirtualMachineScaleSetExtension `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetExtensionsClient) ListComplete(ctx context.Context, id VirtualMachineScaleSetId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetExtensionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetExtensionsClient) ListCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetId, predicate VirtualMachineScaleSetExtensionOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineScaleSetExtension, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_update.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_update.go new file mode 100644 index 00000000000..31f7662a5e0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/method_update.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetextensions + +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 *VirtualMachineScaleSetExtension +} + +// Update ... +func (c VirtualMachineScaleSetExtensionsClient) Update(ctx context.Context, id VirtualMachineScaleSetExtensionId, input VirtualMachineScaleSetExtensionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + 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 VirtualMachineScaleSetExtensionsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetExtensionId, input VirtualMachineScaleSetExtensionUpdate) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_keyvaultsecretreference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..31af12dcf1e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_subresource.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_subresource.go new file mode 100644 index 00000000000..05f9cf02dc4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextension.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextension.go new file mode 100644 index 00000000000..f7c5e18f53c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextension.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtension struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionproperties.go new file mode 100644 index 00000000000..6e65cbdd7d1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionproperties.go @@ -0,0 +1,19 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionupdate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionupdate.go new file mode 100644 index 00000000000..9e8382ae98c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionupdate.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionUpdate struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/predicates.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/predicates.go new file mode 100644 index 00000000000..a03d9f7aa2b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/predicates.go @@ -0,0 +1,27 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VirtualMachineScaleSetExtensionOperationPredicate) Matches(input VirtualMachineScaleSetExtension) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/version.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/version.go new file mode 100644 index 00000000000..3c8d230873f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetextensions/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetextensions + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesetextensions/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/README.md b/resource-manager/compute/2025-04-01/virtualmachinescalesets/README.md new file mode 100644 index 00000000000..f54a7e3c4a5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/README.md @@ -0,0 +1,473 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesets` Documentation + +The `virtualmachinescalesets` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/virtualmachinescalesets" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesets.NewVirtualMachineScaleSetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ApproveRollingUpgrade` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.ApproveRollingUpgradeThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VMScaleSetConvertToSinglePlacementGroupInput{ + // ... +} + + +read, err := client.ConvertToSinglePlacementGroup(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSet{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Deallocate` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.DeallocateThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultDeallocateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.DeleteThenPoll(ctx, id, virtualmachinescalesets.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.DeleteInstances` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceRequiredIDs{ + // ... +} + + +if err := client.DeleteInstancesThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultDeleteInstancesOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +read, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, id, virtualmachinescalesets.DefaultForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +read, err := client.Get(ctx, id, virtualmachinescalesets.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.GetInstanceView` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +read, err := client.GetInstanceView(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.GetOSUpgradeHistory` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +// alternatively `client.GetOSUpgradeHistory(ctx, id)` can be used to do batched pagination +items, err := client.GetOSUpgradeHistoryComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.List` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ListAll` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListAll(ctx, id)` can be used to do batched pagination +items, err := client.ListAllComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ListSkus` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +// alternatively `client.ListSkus(ctx, id)` can be used to do batched pagination +items, err := client.ListSkusComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.PerformMaintenance` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.PerformMaintenanceThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.PowerOff` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.PowerOffThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultPowerOffOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Reapply` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.ReapplyThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Redeploy` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.RedeployThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Reimage` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetReimageParameters{ + // ... +} + + +if err := client.ReimageThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ReimageAll` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.ReimageAllThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Restart` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.RestartThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ScaleOut` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VMScaleSetScaleOutInput{ + // ... +} + + +if err := client.ScaleOutThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.SetOrchestrationServiceState` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.OrchestrationServiceStateInput{ + // ... +} + + +if err := client.SetOrchestrationServiceStateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Start` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.StartThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.UpdateInstances` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceRequiredIDs{ + // ... +} + + +if err := client.UpdateInstancesThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.VirtualMachineScaleSetRollingUpgradesCancel` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.VirtualMachineScaleSetRollingUpgradesCancelThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.VirtualMachineScaleSetRollingUpgradesStartExtensionUpgrade` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.VirtualMachineScaleSetRollingUpgradesStartOSUpgrade` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/client.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/client.go new file mode 100644 index 00000000000..0548a7aec67 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesets + +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 VirtualMachineScaleSetsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetsClient: %+v", err) + } + + return &VirtualMachineScaleSetsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/constants.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/constants.go new file mode 100644 index 00000000000..d3a2d43f25a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/constants.go @@ -0,0 +1,2182 @@ +package virtualmachinescalesets + +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 AllocationStrategy string + +const ( + AllocationStrategyCapacityOptimized AllocationStrategy = "CapacityOptimized" + AllocationStrategyLowestPrice AllocationStrategy = "LowestPrice" + AllocationStrategyPrioritized AllocationStrategy = "Prioritized" +) + +func PossibleValuesForAllocationStrategy() []string { + return []string{ + string(AllocationStrategyCapacityOptimized), + string(AllocationStrategyLowestPrice), + string(AllocationStrategyPrioritized), + } +} + +func (s *AllocationStrategy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAllocationStrategy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAllocationStrategy(input string) (*AllocationStrategy, error) { + vals := map[string]AllocationStrategy{ + "capacityoptimized": AllocationStrategyCapacityOptimized, + "lowestprice": AllocationStrategyLowestPrice, + "prioritized": AllocationStrategyPrioritized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllocationStrategy(input) + return &out, nil +} + +type CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentName string + +const ( + ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentName = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentName() []string { + return []string{ + string(ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentName(input string) (*ComponentName, error) { + vals := map[string]ComponentName{ + "microsoft-windows-shell-setup": ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentName(input) + return &out, nil +} + +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +func PossibleValuesForDeleteOptions() []string { + return []string{ + string(DeleteOptionsDelete), + string(DeleteOptionsDetach), + } +} + +func (s *DeleteOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeleteOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeleteOptions(input string) (*DeleteOptions, error) { + vals := map[string]DeleteOptions{ + "delete": DeleteOptionsDelete, + "detach": DeleteOptionsDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeleteOptions(input) + return &out, nil +} + +type DiffDiskOptions string + +const ( + DiffDiskOptionsLocal DiffDiskOptions = "Local" +) + +func PossibleValuesForDiffDiskOptions() []string { + return []string{ + string(DiffDiskOptionsLocal), + } +} + +func (s *DiffDiskOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskOptions(input string) (*DiffDiskOptions, error) { + vals := map[string]DiffDiskOptions{ + "local": DiffDiskOptionsLocal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskOptions(input) + return &out, nil +} + +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" + DiffDiskPlacementNVMeDisk DiffDiskPlacement = "NvmeDisk" + DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" +) + +func PossibleValuesForDiffDiskPlacement() []string { + return []string{ + string(DiffDiskPlacementCacheDisk), + string(DiffDiskPlacementNVMeDisk), + string(DiffDiskPlacementResourceDisk), + } +} + +func (s *DiffDiskPlacement) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskPlacement(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) { + vals := map[string]DiffDiskPlacement{ + "cachedisk": DiffDiskPlacementCacheDisk, + "nvmedisk": DiffDiskPlacementNVMeDisk, + "resourcedisk": DiffDiskPlacementResourceDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskPlacement(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + DiskCreateOptionTypesCopy DiskCreateOptionTypes = "Copy" + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" + DiskCreateOptionTypesRestore DiskCreateOptionTypes = "Restore" +) + +func PossibleValuesForDiskCreateOptionTypes() []string { + return []string{ + string(DiskCreateOptionTypesAttach), + string(DiskCreateOptionTypesCopy), + string(DiskCreateOptionTypesEmpty), + string(DiskCreateOptionTypesFromImage), + string(DiskCreateOptionTypesRestore), + } +} + +func (s *DiskCreateOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskCreateOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskCreateOptionTypes(input string) (*DiskCreateOptionTypes, error) { + vals := map[string]DiskCreateOptionTypes{ + "attach": DiskCreateOptionTypesAttach, + "copy": DiskCreateOptionTypesCopy, + "empty": DiskCreateOptionTypesEmpty, + "fromimage": DiskCreateOptionTypesFromImage, + "restore": DiskCreateOptionTypesRestore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskCreateOptionTypes(input) + return &out, nil +} + +type DiskDeleteOptionTypes string + +const ( + DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete" + DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach" +) + +func PossibleValuesForDiskDeleteOptionTypes() []string { + return []string{ + string(DiskDeleteOptionTypesDelete), + string(DiskDeleteOptionTypesDetach), + } +} + +func (s *DiskDeleteOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDeleteOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDeleteOptionTypes(input string) (*DiskDeleteOptionTypes, error) { + vals := map[string]DiskDeleteOptionTypes{ + "delete": DiskDeleteOptionTypesDelete, + "detach": DiskDeleteOptionTypesDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDeleteOptionTypes(input) + return &out, nil +} + +type DomainNameLabelScopeTypes string + +const ( + DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse" + DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse" + DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse" + DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse" +) + +func PossibleValuesForDomainNameLabelScopeTypes() []string { + return []string{ + string(DomainNameLabelScopeTypesNoReuse), + string(DomainNameLabelScopeTypesResourceGroupReuse), + string(DomainNameLabelScopeTypesSubscriptionReuse), + string(DomainNameLabelScopeTypesTenantReuse), + } +} + +func (s *DomainNameLabelScopeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDomainNameLabelScopeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDomainNameLabelScopeTypes(input string) (*DomainNameLabelScopeTypes, error) { + vals := map[string]DomainNameLabelScopeTypes{ + "noreuse": DomainNameLabelScopeTypesNoReuse, + "resourcegroupreuse": DomainNameLabelScopeTypesResourceGroupReuse, + "subscriptionreuse": DomainNameLabelScopeTypesSubscriptionReuse, + "tenantreuse": DomainNameLabelScopeTypesTenantReuse, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DomainNameLabelScopeTypes(input) + return &out, nil +} + +type ExpandTypesForGetVMScaleSets string + +const ( + ExpandTypesForGetVMScaleSetsUserData ExpandTypesForGetVMScaleSets = "userData" +) + +func PossibleValuesForExpandTypesForGetVMScaleSets() []string { + return []string{ + string(ExpandTypesForGetVMScaleSetsUserData), + } +} + +func (s *ExpandTypesForGetVMScaleSets) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpandTypesForGetVMScaleSets(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExpandTypesForGetVMScaleSets(input string) (*ExpandTypesForGetVMScaleSets, error) { + vals := map[string]ExpandTypesForGetVMScaleSets{ + "userdata": ExpandTypesForGetVMScaleSetsUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpandTypesForGetVMScaleSets(input) + return &out, nil +} + +type HighSpeedInterconnectPlacement string + +const ( + HighSpeedInterconnectPlacementNone HighSpeedInterconnectPlacement = "None" + HighSpeedInterconnectPlacementTrunk HighSpeedInterconnectPlacement = "Trunk" +) + +func PossibleValuesForHighSpeedInterconnectPlacement() []string { + return []string{ + string(HighSpeedInterconnectPlacementNone), + string(HighSpeedInterconnectPlacementTrunk), + } +} + +func (s *HighSpeedInterconnectPlacement) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHighSpeedInterconnectPlacement(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHighSpeedInterconnectPlacement(input string) (*HighSpeedInterconnectPlacement, error) { + vals := map[string]HighSpeedInterconnectPlacement{ + "none": HighSpeedInterconnectPlacementNone, + "trunk": HighSpeedInterconnectPlacementTrunk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HighSpeedInterconnectPlacement(input) + return &out, nil +} + +type IPVersion string + +const ( + IPVersionIPvFour IPVersion = "IPv4" + IPVersionIPvSix IPVersion = "IPv6" +) + +func PossibleValuesForIPVersion() []string { + return []string{ + string(IPVersionIPvFour), + string(IPVersionIPvSix), + } +} + +func (s *IPVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersion(input string) (*IPVersion, error) { + vals := map[string]IPVersion{ + "ipv4": IPVersionIPvFour, + "ipv6": IPVersionIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersion(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type NetworkApiVersion string + +const ( + NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne NetworkApiVersion = "2022-11-01" + NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne NetworkApiVersion = "2020-11-01" +) + +func PossibleValuesForNetworkApiVersion() []string { + return []string{ + string(NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne), + string(NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne), + } +} + +func (s *NetworkApiVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkApiVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkApiVersion(input string) (*NetworkApiVersion, error) { + vals := map[string]NetworkApiVersion{ + "2022-11-01": NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne, + "2020-11-01": NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkApiVersion(input) + return &out, nil +} + +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliaryMode() []string { + return []string{ + string(NetworkInterfaceAuxiliaryModeAcceleratedConnections), + string(NetworkInterfaceAuxiliaryModeFloating), + string(NetworkInterfaceAuxiliaryModeNone), + } +} + +func (s *NetworkInterfaceAuxiliaryMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliaryMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliaryMode(input string) (*NetworkInterfaceAuxiliaryMode, error) { + vals := map[string]NetworkInterfaceAuxiliaryMode{ + "acceleratedconnections": NetworkInterfaceAuxiliaryModeAcceleratedConnections, + "floating": NetworkInterfaceAuxiliaryModeFloating, + "none": NetworkInterfaceAuxiliaryModeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliaryMode(input) + return &out, nil +} + +type NetworkInterfaceAuxiliarySku string + +const ( + NetworkInterfaceAuxiliarySkuAEight NetworkInterfaceAuxiliarySku = "A8" + NetworkInterfaceAuxiliarySkuAFour NetworkInterfaceAuxiliarySku = "A4" + NetworkInterfaceAuxiliarySkuAOne NetworkInterfaceAuxiliarySku = "A1" + NetworkInterfaceAuxiliarySkuATwo NetworkInterfaceAuxiliarySku = "A2" + NetworkInterfaceAuxiliarySkuNone NetworkInterfaceAuxiliarySku = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliarySku() []string { + return []string{ + string(NetworkInterfaceAuxiliarySkuAEight), + string(NetworkInterfaceAuxiliarySkuAFour), + string(NetworkInterfaceAuxiliarySkuAOne), + string(NetworkInterfaceAuxiliarySkuATwo), + string(NetworkInterfaceAuxiliarySkuNone), + } +} + +func (s *NetworkInterfaceAuxiliarySku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliarySku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliarySku(input string) (*NetworkInterfaceAuxiliarySku, error) { + vals := map[string]NetworkInterfaceAuxiliarySku{ + "a8": NetworkInterfaceAuxiliarySkuAEight, + "a4": NetworkInterfaceAuxiliarySkuAFour, + "a1": NetworkInterfaceAuxiliarySkuAOne, + "a2": NetworkInterfaceAuxiliarySkuATwo, + "none": NetworkInterfaceAuxiliarySkuNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliarySku(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type OrchestrationMode string + +const ( + OrchestrationModeFlexible OrchestrationMode = "Flexible" + OrchestrationModeUniform OrchestrationMode = "Uniform" +) + +func PossibleValuesForOrchestrationMode() []string { + return []string{ + string(OrchestrationModeFlexible), + string(OrchestrationModeUniform), + } +} + +func (s *OrchestrationMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationMode(input string) (*OrchestrationMode, error) { + vals := map[string]OrchestrationMode{ + "flexible": OrchestrationModeFlexible, + "uniform": OrchestrationModeUniform, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationMode(input) + return &out, nil +} + +type OrchestrationServiceNames string + +const ( + OrchestrationServiceNamesAutomaticRepairs OrchestrationServiceNames = "AutomaticRepairs" + OrchestrationServiceNamesAutomaticZoneRebalancing OrchestrationServiceNames = "AutomaticZoneRebalancing" +) + +func PossibleValuesForOrchestrationServiceNames() []string { + return []string{ + string(OrchestrationServiceNamesAutomaticRepairs), + string(OrchestrationServiceNamesAutomaticZoneRebalancing), + } +} + +func (s *OrchestrationServiceNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationServiceNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationServiceNames(input string) (*OrchestrationServiceNames, error) { + vals := map[string]OrchestrationServiceNames{ + "automaticrepairs": OrchestrationServiceNamesAutomaticRepairs, + "automaticzonerebalancing": OrchestrationServiceNamesAutomaticZoneRebalancing, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationServiceNames(input) + return &out, nil +} + +type OrchestrationServiceOperationStatus string + +const ( + OrchestrationServiceOperationStatusCompleted OrchestrationServiceOperationStatus = "Completed" + OrchestrationServiceOperationStatusInProgress OrchestrationServiceOperationStatus = "InProgress" +) + +func PossibleValuesForOrchestrationServiceOperationStatus() []string { + return []string{ + string(OrchestrationServiceOperationStatusCompleted), + string(OrchestrationServiceOperationStatusInProgress), + } +} + +func (s *OrchestrationServiceOperationStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationServiceOperationStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationServiceOperationStatus(input string) (*OrchestrationServiceOperationStatus, error) { + vals := map[string]OrchestrationServiceOperationStatus{ + "completed": OrchestrationServiceOperationStatusCompleted, + "inprogress": OrchestrationServiceOperationStatusInProgress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationServiceOperationStatus(input) + return &out, nil +} + +type OrchestrationServiceState string + +const ( + OrchestrationServiceStateNotRunning OrchestrationServiceState = "NotRunning" + OrchestrationServiceStateRunning OrchestrationServiceState = "Running" + OrchestrationServiceStateSuspended OrchestrationServiceState = "Suspended" +) + +func PossibleValuesForOrchestrationServiceState() []string { + return []string{ + string(OrchestrationServiceStateNotRunning), + string(OrchestrationServiceStateRunning), + string(OrchestrationServiceStateSuspended), + } +} + +func (s *OrchestrationServiceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationServiceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationServiceState(input string) (*OrchestrationServiceState, error) { + vals := map[string]OrchestrationServiceState{ + "notrunning": OrchestrationServiceStateNotRunning, + "running": OrchestrationServiceStateRunning, + "suspended": OrchestrationServiceStateSuspended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationServiceState(input) + return &out, nil +} + +type OrchestrationServiceStateAction string + +const ( + OrchestrationServiceStateActionResume OrchestrationServiceStateAction = "Resume" + OrchestrationServiceStateActionSuspend OrchestrationServiceStateAction = "Suspend" +) + +func PossibleValuesForOrchestrationServiceStateAction() []string { + return []string{ + string(OrchestrationServiceStateActionResume), + string(OrchestrationServiceStateActionSuspend), + } +} + +func (s *OrchestrationServiceStateAction) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationServiceStateAction(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationServiceStateAction(input string) (*OrchestrationServiceStateAction, error) { + vals := map[string]OrchestrationServiceStateAction{ + "resume": OrchestrationServiceStateActionResume, + "suspend": OrchestrationServiceStateActionSuspend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationServiceStateAction(input) + return &out, nil +} + +type PassName string + +const ( + PassNameOobeSystem PassName = "OobeSystem" +) + +func PossibleValuesForPassName() []string { + return []string{ + string(PassNameOobeSystem), + } +} + +func (s *PassName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassName(input string) (*PassName, error) { + vals := map[string]PassName{ + "oobesystem": PassNameOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassName(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type PublicIPAddressSkuName string + +const ( + PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" + PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" +) + +func PossibleValuesForPublicIPAddressSkuName() []string { + return []string{ + string(PublicIPAddressSkuNameBasic), + string(PublicIPAddressSkuNameStandard), + } +} + +func (s *PublicIPAddressSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuName(input string) (*PublicIPAddressSkuName, error) { + vals := map[string]PublicIPAddressSkuName{ + "basic": PublicIPAddressSkuNameBasic, + "standard": PublicIPAddressSkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuName(input) + return &out, nil +} + +type PublicIPAddressSkuTier string + +const ( + PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" + PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" +) + +func PossibleValuesForPublicIPAddressSkuTier() []string { + return []string{ + string(PublicIPAddressSkuTierGlobal), + string(PublicIPAddressSkuTierRegional), + } +} + +func (s *PublicIPAddressSkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuTier(input string) (*PublicIPAddressSkuTier, error) { + vals := map[string]PublicIPAddressSkuTier{ + "global": PublicIPAddressSkuTierGlobal, + "regional": PublicIPAddressSkuTierRegional, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuTier(input) + return &out, nil +} + +type RebalanceBehavior string + +const ( + RebalanceBehaviorCreateBeforeDelete RebalanceBehavior = "CreateBeforeDelete" +) + +func PossibleValuesForRebalanceBehavior() []string { + return []string{ + string(RebalanceBehaviorCreateBeforeDelete), + } +} + +func (s *RebalanceBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRebalanceBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRebalanceBehavior(input string) (*RebalanceBehavior, error) { + vals := map[string]RebalanceBehavior{ + "createbeforedelete": RebalanceBehaviorCreateBeforeDelete, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RebalanceBehavior(input) + return &out, nil +} + +type RebalanceStrategy string + +const ( + RebalanceStrategyRecreate RebalanceStrategy = "Recreate" +) + +func PossibleValuesForRebalanceStrategy() []string { + return []string{ + string(RebalanceStrategyRecreate), + } +} + +func (s *RebalanceStrategy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRebalanceStrategy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRebalanceStrategy(input string) (*RebalanceStrategy, error) { + vals := map[string]RebalanceStrategy{ + "recreate": RebalanceStrategyRecreate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RebalanceStrategy(input) + return &out, nil +} + +type RepairAction string + +const ( + RepairActionReimage RepairAction = "Reimage" + RepairActionReplace RepairAction = "Replace" + RepairActionRestart RepairAction = "Restart" +) + +func PossibleValuesForRepairAction() []string { + return []string{ + string(RepairActionReimage), + string(RepairActionReplace), + string(RepairActionRestart), + } +} + +func (s *RepairAction) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRepairAction(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRepairAction(input string) (*RepairAction, error) { + vals := map[string]RepairAction{ + "reimage": RepairActionReimage, + "replace": RepairActionReplace, + "restart": RepairActionRestart, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RepairAction(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type UpgradeMode string + +const ( + UpgradeModeAutomatic UpgradeMode = "Automatic" + UpgradeModeManual UpgradeMode = "Manual" + UpgradeModeRolling UpgradeMode = "Rolling" +) + +func PossibleValuesForUpgradeMode() []string { + return []string{ + string(UpgradeModeAutomatic), + string(UpgradeModeManual), + string(UpgradeModeRolling), + } +} + +func (s *UpgradeMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUpgradeMode(input string) (*UpgradeMode, error) { + vals := map[string]UpgradeMode{ + "automatic": UpgradeModeAutomatic, + "manual": UpgradeModeManual, + "rolling": UpgradeModeRolling, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpgradeMode(input) + return &out, nil +} + +type UpgradeOperationInvoker string + +const ( + UpgradeOperationInvokerPlatform UpgradeOperationInvoker = "Platform" + UpgradeOperationInvokerUnknown UpgradeOperationInvoker = "Unknown" + UpgradeOperationInvokerUser UpgradeOperationInvoker = "User" +) + +func PossibleValuesForUpgradeOperationInvoker() []string { + return []string{ + string(UpgradeOperationInvokerPlatform), + string(UpgradeOperationInvokerUnknown), + string(UpgradeOperationInvokerUser), + } +} + +func (s *UpgradeOperationInvoker) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeOperationInvoker(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUpgradeOperationInvoker(input string) (*UpgradeOperationInvoker, error) { + vals := map[string]UpgradeOperationInvoker{ + "platform": UpgradeOperationInvokerPlatform, + "unknown": UpgradeOperationInvokerUnknown, + "user": UpgradeOperationInvokerUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpgradeOperationInvoker(input) + return &out, nil +} + +type UpgradeState string + +const ( + UpgradeStateCancelled UpgradeState = "Cancelled" + UpgradeStateCompleted UpgradeState = "Completed" + UpgradeStateFaulted UpgradeState = "Faulted" + UpgradeStateRollingForward UpgradeState = "RollingForward" +) + +func PossibleValuesForUpgradeState() []string { + return []string{ + string(UpgradeStateCancelled), + string(UpgradeStateCompleted), + string(UpgradeStateFaulted), + string(UpgradeStateRollingForward), + } +} + +func (s *UpgradeState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUpgradeState(input string) (*UpgradeState, error) { + vals := map[string]UpgradeState{ + "cancelled": UpgradeStateCancelled, + "completed": UpgradeStateCompleted, + "faulted": UpgradeStateFaulted, + "rollingforward": UpgradeStateRollingForward, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpgradeState(input) + return &out, nil +} + +type VirtualMachineEvictionPolicyTypes string + +const ( + VirtualMachineEvictionPolicyTypesDeallocate VirtualMachineEvictionPolicyTypes = "Deallocate" + VirtualMachineEvictionPolicyTypesDelete VirtualMachineEvictionPolicyTypes = "Delete" +) + +func PossibleValuesForVirtualMachineEvictionPolicyTypes() []string { + return []string{ + string(VirtualMachineEvictionPolicyTypesDeallocate), + string(VirtualMachineEvictionPolicyTypesDelete), + } +} + +func (s *VirtualMachineEvictionPolicyTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineEvictionPolicyTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineEvictionPolicyTypes(input string) (*VirtualMachineEvictionPolicyTypes, error) { + vals := map[string]VirtualMachineEvictionPolicyTypes{ + "deallocate": VirtualMachineEvictionPolicyTypesDeallocate, + "delete": VirtualMachineEvictionPolicyTypesDelete, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineEvictionPolicyTypes(input) + return &out, nil +} + +type VirtualMachinePriorityTypes string + +const ( + VirtualMachinePriorityTypesLow VirtualMachinePriorityTypes = "Low" + VirtualMachinePriorityTypesRegular VirtualMachinePriorityTypes = "Regular" + VirtualMachinePriorityTypesSpot VirtualMachinePriorityTypes = "Spot" +) + +func PossibleValuesForVirtualMachinePriorityTypes() []string { + return []string{ + string(VirtualMachinePriorityTypesLow), + string(VirtualMachinePriorityTypesRegular), + string(VirtualMachinePriorityTypesSpot), + } +} + +func (s *VirtualMachinePriorityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachinePriorityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachinePriorityTypes(input string) (*VirtualMachinePriorityTypes, error) { + vals := map[string]VirtualMachinePriorityTypes{ + "low": VirtualMachinePriorityTypesLow, + "regular": VirtualMachinePriorityTypesRegular, + "spot": VirtualMachinePriorityTypesSpot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachinePriorityTypes(input) + return &out, nil +} + +type VirtualMachineScaleSetScaleInRules string + +const ( + VirtualMachineScaleSetScaleInRulesDefault VirtualMachineScaleSetScaleInRules = "Default" + VirtualMachineScaleSetScaleInRulesNewestVM VirtualMachineScaleSetScaleInRules = "NewestVM" + VirtualMachineScaleSetScaleInRulesOldestVM VirtualMachineScaleSetScaleInRules = "OldestVM" +) + +func PossibleValuesForVirtualMachineScaleSetScaleInRules() []string { + return []string{ + string(VirtualMachineScaleSetScaleInRulesDefault), + string(VirtualMachineScaleSetScaleInRulesNewestVM), + string(VirtualMachineScaleSetScaleInRulesOldestVM), + } +} + +func (s *VirtualMachineScaleSetScaleInRules) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineScaleSetScaleInRules(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineScaleSetScaleInRules(input string) (*VirtualMachineScaleSetScaleInRules, error) { + vals := map[string]VirtualMachineScaleSetScaleInRules{ + "default": VirtualMachineScaleSetScaleInRulesDefault, + "newestvm": VirtualMachineScaleSetScaleInRulesNewestVM, + "oldestvm": VirtualMachineScaleSetScaleInRulesOldestVM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineScaleSetScaleInRules(input) + return &out, nil +} + +type VirtualMachineScaleSetSkuScaleType string + +const ( + VirtualMachineScaleSetSkuScaleTypeAutomatic VirtualMachineScaleSetSkuScaleType = "Automatic" + VirtualMachineScaleSetSkuScaleTypeNone VirtualMachineScaleSetSkuScaleType = "None" +) + +func PossibleValuesForVirtualMachineScaleSetSkuScaleType() []string { + return []string{ + string(VirtualMachineScaleSetSkuScaleTypeAutomatic), + string(VirtualMachineScaleSetSkuScaleTypeNone), + } +} + +func (s *VirtualMachineScaleSetSkuScaleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineScaleSetSkuScaleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineScaleSetSkuScaleType(input string) (*VirtualMachineScaleSetSkuScaleType, error) { + vals := map[string]VirtualMachineScaleSetSkuScaleType{ + "automatic": VirtualMachineScaleSetSkuScaleTypeAutomatic, + "none": VirtualMachineScaleSetSkuScaleTypeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineScaleSetSkuScaleType(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} + +type ZonalPlatformFaultDomainAlignMode string + +const ( + ZonalPlatformFaultDomainAlignModeAligned ZonalPlatformFaultDomainAlignMode = "Aligned" + ZonalPlatformFaultDomainAlignModeUnaligned ZonalPlatformFaultDomainAlignMode = "Unaligned" +) + +func PossibleValuesForZonalPlatformFaultDomainAlignMode() []string { + return []string{ + string(ZonalPlatformFaultDomainAlignModeAligned), + string(ZonalPlatformFaultDomainAlignModeUnaligned), + } +} + +func (s *ZonalPlatformFaultDomainAlignMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseZonalPlatformFaultDomainAlignMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseZonalPlatformFaultDomainAlignMode(input string) (*ZonalPlatformFaultDomainAlignMode, error) { + vals := map[string]ZonalPlatformFaultDomainAlignMode{ + "aligned": ZonalPlatformFaultDomainAlignModeAligned, + "unaligned": ZonalPlatformFaultDomainAlignModeUnaligned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZonalPlatformFaultDomainAlignMode(input) + return &out, nil +} + +type ZonePlacementPolicyType string + +const ( + ZonePlacementPolicyTypeAny ZonePlacementPolicyType = "Any" + ZonePlacementPolicyTypeAuto ZonePlacementPolicyType = "Auto" +) + +func PossibleValuesForZonePlacementPolicyType() []string { + return []string{ + string(ZonePlacementPolicyTypeAny), + string(ZonePlacementPolicyTypeAuto), + } +} + +func (s *ZonePlacementPolicyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseZonePlacementPolicyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseZonePlacementPolicyType(input string) (*ZonePlacementPolicyType, error) { + vals := map[string]ZonePlacementPolicyType{ + "any": ZonePlacementPolicyTypeAny, + "auto": ZonePlacementPolicyTypeAuto, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZonePlacementPolicyType(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/id_virtualmachinescaleset.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/id_virtualmachinescaleset.go new file mode 100644 index 00000000000..fe53f8c0e32 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/id_virtualmachinescaleset.go @@ -0,0 +1,130 @@ +package virtualmachinescalesets + +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(&VirtualMachineScaleSetId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +// VirtualMachineScaleSetId is a struct representing the Resource ID for a Virtual Machine Scale Set +type VirtualMachineScaleSetId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string +} + +// NewVirtualMachineScaleSetID returns a new VirtualMachineScaleSetId struct +func NewVirtualMachineScaleSetID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string) VirtualMachineScaleSetId { + return VirtualMachineScaleSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + } +} + +// ParseVirtualMachineScaleSetID parses 'input' into a VirtualMachineScaleSetId +func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID +func ValidateVirtualMachineScaleSetID(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 := ParseVirtualMachineScaleSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + } + return fmt.Sprintf("Virtual Machine Scale Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/id_virtualmachinescaleset_test.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/id_virtualmachinescaleset_test.go new file mode 100644 index 00000000000..c3cbe18c5f3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/id_virtualmachinescaleset_test.go @@ -0,0 +1,282 @@ +package virtualmachinescalesets + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +func TestNewVirtualMachineScaleSetID(t *testing.T) { + id := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } +} + +func TestFormatVirtualMachineScaleSetID(t *testing.T) { + actual := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestParseVirtualMachineScaleSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetId(t *testing.T) { + segments := VirtualMachineScaleSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_approverollingupgrade.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_approverollingupgrade.go new file mode 100644 index 00000000000..3964624681f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_approverollingupgrade.go @@ -0,0 +1,73 @@ +package virtualmachinescalesets + +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 ApproveRollingUpgradeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApproveRollingUpgrade ... +func (c VirtualMachineScaleSetsClient) ApproveRollingUpgrade(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result ApproveRollingUpgradeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/approveRollingUpgrade", 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 +} + +// ApproveRollingUpgradeThenPoll performs ApproveRollingUpgrade then polls until it's completed +func (c VirtualMachineScaleSetsClient) ApproveRollingUpgradeThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.ApproveRollingUpgrade(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApproveRollingUpgrade: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApproveRollingUpgrade: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_converttosingleplacementgroup.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_converttosingleplacementgroup.go new file mode 100644 index 00000000000..e219b9b56a1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_converttosingleplacementgroup.go @@ -0,0 +1,51 @@ +package virtualmachinescalesets + +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 ConvertToSinglePlacementGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// ConvertToSinglePlacementGroup ... +func (c VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroup(ctx context.Context, id VirtualMachineScaleSetId, input VMScaleSetConvertToSinglePlacementGroupInput) (result ConvertToSinglePlacementGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/convertToSinglePlacementGroup", 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 + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_createorupdate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_createorupdate.go new file mode 100644 index 00000000000..ce61579304c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_createorupdate.go @@ -0,0 +1,108 @@ +package virtualmachinescalesets + +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 *VirtualMachineScaleSet +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c VirtualMachineScaleSetsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + OptionsObject: options, + 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 VirtualMachineScaleSetsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSet, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_deallocate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_deallocate.go new file mode 100644 index 00000000000..1965e606c51 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_deallocate.go @@ -0,0 +1,103 @@ +package virtualmachinescalesets + +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 DeallocateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type DeallocateOperationOptions struct { + Hibernate *bool +} + +func DefaultDeallocateOperationOptions() DeallocateOperationOptions { + return DeallocateOperationOptions{} +} + +func (o DeallocateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeallocateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeallocateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Hibernate != nil { + out.Append("hibernate", fmt.Sprintf("%v", *o.Hibernate)) + } + return &out +} + +// Deallocate ... +func (c VirtualMachineScaleSetsClient) Deallocate(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs, options DeallocateOperationOptions) (result DeallocateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/deallocate", 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 +} + +// DeallocateThenPoll performs Deallocate then polls until it's completed +func (c VirtualMachineScaleSetsClient) DeallocateThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs, options DeallocateOperationOptions) error { + result, err := c.Deallocate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Deallocate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Deallocate: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_delete.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_delete.go new file mode 100644 index 00000000000..40c53c88532 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_delete.go @@ -0,0 +1,100 @@ +package virtualmachinescalesets + +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 +} + +type DeleteOperationOptions struct { + ForceDeletion *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ForceDeletion != nil { + out.Append("forceDeletion", fmt.Sprintf("%v", *o.ForceDeletion)) + } + return &out +} + +// Delete ... +func (c VirtualMachineScaleSetsClient) Delete(ctx context.Context, id VirtualMachineScaleSetId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + OptionsObject: options, + 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 VirtualMachineScaleSetsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineScaleSetId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_deleteinstances.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_deleteinstances.go new file mode 100644 index 00000000000..ae1057f79fa --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_deleteinstances.go @@ -0,0 +1,103 @@ +package virtualmachinescalesets + +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 DeleteInstancesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteInstancesOperationOptions struct { + ForceDeletion *bool +} + +func DefaultDeleteInstancesOperationOptions() DeleteInstancesOperationOptions { + return DeleteInstancesOperationOptions{} +} + +func (o DeleteInstancesOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteInstancesOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeleteInstancesOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ForceDeletion != nil { + out.Append("forceDeletion", fmt.Sprintf("%v", *o.ForceDeletion)) + } + return &out +} + +// DeleteInstances ... +func (c VirtualMachineScaleSetsClient) DeleteInstances(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceRequiredIDs, options DeleteInstancesOperationOptions) (result DeleteInstancesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/delete", 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 +} + +// DeleteInstancesThenPoll performs DeleteInstances then polls until it's completed +func (c VirtualMachineScaleSetsClient) DeleteInstancesThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceRequiredIDs, options DeleteInstancesOperationOptions) error { + result, err := c.DeleteInstances(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing DeleteInstances: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeleteInstances: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_forcerecoveryservicefabricplatformupdatedomainwalk.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_forcerecoveryservicefabricplatformupdatedomainwalk.go new file mode 100644 index 00000000000..a49b926c058 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_forcerecoveryservicefabricplatformupdatedomainwalk.go @@ -0,0 +1,91 @@ +package virtualmachinescalesets + +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 ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecoveryWalkResponse +} + +type ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions struct { + PlacementGroupId *string + PlatformUpdateDomain *int64 + Zone *string +} + +func DefaultForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions() ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions { + return ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions{} +} + +func (o ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.PlacementGroupId != nil { + out.Append("placementGroupId", fmt.Sprintf("%v", *o.PlacementGroupId)) + } + if o.PlatformUpdateDomain != nil { + out.Append("platformUpdateDomain", fmt.Sprintf("%v", *o.PlatformUpdateDomain)) + } + if o.Zone != nil { + out.Append("zone", fmt.Sprintf("%v", *o.Zone)) + } + return &out +} + +// ForceRecoveryServiceFabricPlatformUpdateDomainWalk ... +func (c VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx context.Context, id VirtualMachineScaleSetId, options ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions) (result ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/forceRecoveryServiceFabricPlatformUpdateDomainWalk", 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 RecoveryWalkResponse + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_get.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_get.go new file mode 100644 index 00000000000..4ade8c757e1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesets + +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 *VirtualMachineScaleSet +} + +type GetOperationOptions struct { + Expand *ExpandTypesForGetVMScaleSets +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetsClient) Get(ctx context.Context, id VirtualMachineScaleSetId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 VirtualMachineScaleSet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_getinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_getinstanceview.go new file mode 100644 index 00000000000..4e409bb9b3b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_getinstanceview.go @@ -0,0 +1,54 @@ +package virtualmachinescalesets + +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 GetInstanceViewOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetInstanceView +} + +// GetInstanceView ... +func (c VirtualMachineScaleSetsClient) GetInstanceView(ctx context.Context, id VirtualMachineScaleSetId) (result GetInstanceViewOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/instanceView", 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 VirtualMachineScaleSetInstanceView + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_getosupgradehistory.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_getosupgradehistory.go new file mode 100644 index 00000000000..1702f705887 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_getosupgradehistory.go @@ -0,0 +1,105 @@ +package virtualmachinescalesets + +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 GetOSUpgradeHistoryOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UpgradeOperationHistoricalStatusInfo +} + +type GetOSUpgradeHistoryCompleteResult struct { + LatestHttpResponse *http.Response + Items []UpgradeOperationHistoricalStatusInfo +} + +type GetOSUpgradeHistoryCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *GetOSUpgradeHistoryCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// GetOSUpgradeHistory ... +func (c VirtualMachineScaleSetsClient) GetOSUpgradeHistory(ctx context.Context, id VirtualMachineScaleSetId) (result GetOSUpgradeHistoryOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &GetOSUpgradeHistoryCustomPager{}, + Path: fmt.Sprintf("%s/osUpgradeHistory", 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 *[]UpgradeOperationHistoricalStatusInfo `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// GetOSUpgradeHistoryComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetsClient) GetOSUpgradeHistoryComplete(ctx context.Context, id VirtualMachineScaleSetId) (GetOSUpgradeHistoryCompleteResult, error) { + return c.GetOSUpgradeHistoryCompleteMatchingPredicate(ctx, id, UpgradeOperationHistoricalStatusInfoOperationPredicate{}) +} + +// GetOSUpgradeHistoryCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetsClient) GetOSUpgradeHistoryCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetId, predicate UpgradeOperationHistoricalStatusInfoOperationPredicate) (result GetOSUpgradeHistoryCompleteResult, err error) { + items := make([]UpgradeOperationHistoricalStatusInfo, 0) + + resp, err := c.GetOSUpgradeHistory(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 = GetOSUpgradeHistoryCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_list.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_list.go new file mode 100644 index 00000000000..1eaed1d1e4c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_list.go @@ -0,0 +1,106 @@ +package virtualmachinescalesets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSet +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSet +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachineScaleSetsClient) List(ctx context.Context, id commonids.ResourceGroupId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/virtualMachineScaleSets", 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 *[]VirtualMachineScaleSet `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VirtualMachineScaleSetOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineScaleSet, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_listall.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_listall.go new file mode 100644 index 00000000000..4dc2af1c444 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_listall.go @@ -0,0 +1,106 @@ +package virtualmachinescalesets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAllOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSet +} + +type ListAllCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSet +} + +type ListAllCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListAllCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListAll ... +func (c VirtualMachineScaleSetsClient) ListAll(ctx context.Context, id commonids.SubscriptionId) (result ListAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListAllCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/virtualMachineScaleSets", 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 *[]VirtualMachineScaleSet `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAllComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetsClient) ListAllComplete(ctx context.Context, id commonids.SubscriptionId) (ListAllCompleteResult, error) { + return c.ListAllCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetOperationPredicate{}) +} + +// ListAllCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetsClient) ListAllCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VirtualMachineScaleSetOperationPredicate) (result ListAllCompleteResult, err error) { + items := make([]VirtualMachineScaleSet, 0) + + resp, err := c.ListAll(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 = ListAllCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_listskus.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_listskus.go new file mode 100644 index 00000000000..fbedf5765e1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_listskus.go @@ -0,0 +1,105 @@ +package virtualmachinescalesets + +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 ListSkusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSetSku +} + +type ListSkusCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSetSku +} + +type ListSkusCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListSkusCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListSkus ... +func (c VirtualMachineScaleSetsClient) ListSkus(ctx context.Context, id VirtualMachineScaleSetId) (result ListSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListSkusCustomPager{}, + Path: fmt.Sprintf("%s/skus", 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 *[]VirtualMachineScaleSetSku `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListSkusComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetsClient) ListSkusComplete(ctx context.Context, id VirtualMachineScaleSetId) (ListSkusCompleteResult, error) { + return c.ListSkusCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetSkuOperationPredicate{}) +} + +// ListSkusCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetsClient) ListSkusCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetId, predicate VirtualMachineScaleSetSkuOperationPredicate) (result ListSkusCompleteResult, err error) { + items := make([]VirtualMachineScaleSetSku, 0) + + resp, err := c.ListSkus(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 = ListSkusCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_performmaintenance.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_performmaintenance.go new file mode 100644 index 00000000000..63ec3aa83c8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_performmaintenance.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 PerformMaintenanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PerformMaintenance ... +func (c VirtualMachineScaleSetsClient) PerformMaintenance(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result PerformMaintenanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/performMaintenance", 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 +} + +// PerformMaintenanceThenPoll performs PerformMaintenance then polls until it's completed +func (c VirtualMachineScaleSetsClient) PerformMaintenanceThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.PerformMaintenance(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PerformMaintenance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PerformMaintenance: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_poweroff.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_poweroff.go new file mode 100644 index 00000000000..0b805fc3b55 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_poweroff.go @@ -0,0 +1,103 @@ +package virtualmachinescalesets + +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 PowerOffOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type PowerOffOperationOptions struct { + SkipShutdown *bool +} + +func DefaultPowerOffOperationOptions() PowerOffOperationOptions { + return PowerOffOperationOptions{} +} + +func (o PowerOffOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o PowerOffOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o PowerOffOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SkipShutdown != nil { + out.Append("skipShutdown", fmt.Sprintf("%v", *o.SkipShutdown)) + } + return &out +} + +// PowerOff ... +func (c VirtualMachineScaleSetsClient) PowerOff(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs, options PowerOffOperationOptions) (result PowerOffOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/poweroff", 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 +} + +// PowerOffThenPoll performs PowerOff then polls until it's completed +func (c VirtualMachineScaleSetsClient) PowerOffThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs, options PowerOffOperationOptions) error { + result, err := c.PowerOff(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing PowerOff: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PowerOff: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_reapply.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_reapply.go new file mode 100644 index 00000000000..a3ac6524d5a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_reapply.go @@ -0,0 +1,70 @@ +package virtualmachinescalesets + +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 ReapplyOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reapply ... +func (c VirtualMachineScaleSetsClient) Reapply(ctx context.Context, id VirtualMachineScaleSetId) (result ReapplyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reapply", 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 +} + +// ReapplyThenPoll performs Reapply then polls until it's completed +func (c VirtualMachineScaleSetsClient) ReapplyThenPoll(ctx context.Context, id VirtualMachineScaleSetId) error { + result, err := c.Reapply(ctx, id) + if err != nil { + return fmt.Errorf("performing Reapply: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reapply: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_redeploy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_redeploy.go new file mode 100644 index 00000000000..14be3e0cbdf --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_redeploy.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 RedeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Redeploy ... +func (c VirtualMachineScaleSetsClient) Redeploy(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result RedeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/redeploy", 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 +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c VirtualMachineScaleSetsClient) RedeployThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.Redeploy(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_reimage.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_reimage.go new file mode 100644 index 00000000000..7ef500c4503 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_reimage.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 ReimageOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reimage ... +func (c VirtualMachineScaleSetsClient) Reimage(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetReimageParameters) (result ReimageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimage", 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 +} + +// ReimageThenPoll performs Reimage then polls until it's completed +func (c VirtualMachineScaleSetsClient) ReimageThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetReimageParameters) error { + result, err := c.Reimage(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Reimage: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reimage: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_reimageall.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_reimageall.go new file mode 100644 index 00000000000..40f9f362dc5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_reimageall.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 ReimageAllOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ReimageAll ... +func (c VirtualMachineScaleSetsClient) ReimageAll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result ReimageAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimageall", 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 +} + +// ReimageAllThenPoll performs ReimageAll then polls until it's completed +func (c VirtualMachineScaleSetsClient) ReimageAllThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.ReimageAll(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ReimageAll: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ReimageAll: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_restart.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_restart.go new file mode 100644 index 00000000000..a39798d810f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_restart.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c VirtualMachineScaleSetsClient) Restart(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c VirtualMachineScaleSetsClient) RestartThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.Restart(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_scaleout.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_scaleout.go new file mode 100644 index 00000000000..9097684de6e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_scaleout.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 ScaleOutOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ScaleOut ... +func (c VirtualMachineScaleSetsClient) ScaleOut(ctx context.Context, id VirtualMachineScaleSetId, input VMScaleSetScaleOutInput) (result ScaleOutOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/scaleOut", 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 +} + +// ScaleOutThenPoll performs ScaleOut then polls until it's completed +func (c VirtualMachineScaleSetsClient) ScaleOutThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VMScaleSetScaleOutInput) error { + result, err := c.ScaleOut(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ScaleOut: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ScaleOut: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_setorchestrationservicestate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_setorchestrationservicestate.go new file mode 100644 index 00000000000..b6ffed9505d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_setorchestrationservicestate.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 SetOrchestrationServiceStateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// SetOrchestrationServiceState ... +func (c VirtualMachineScaleSetsClient) SetOrchestrationServiceState(ctx context.Context, id VirtualMachineScaleSetId, input OrchestrationServiceStateInput) (result SetOrchestrationServiceStateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/setOrchestrationServiceState", 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 +} + +// SetOrchestrationServiceStateThenPoll performs SetOrchestrationServiceState then polls until it's completed +func (c VirtualMachineScaleSetsClient) SetOrchestrationServiceStateThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input OrchestrationServiceStateInput) error { + result, err := c.SetOrchestrationServiceState(ctx, id, input) + if err != nil { + return fmt.Errorf("performing SetOrchestrationServiceState: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after SetOrchestrationServiceState: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_start.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_start.go new file mode 100644 index 00000000000..687684b56c7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_start.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c VirtualMachineScaleSetsClient) Start(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", 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 +} + +// StartThenPoll performs Start then polls until it's completed +func (c VirtualMachineScaleSetsClient) StartThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.Start(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_update.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_update.go new file mode 100644 index 00000000000..f508f4deebf --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_update.go @@ -0,0 +1,107 @@ +package virtualmachinescalesets + +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 *VirtualMachineScaleSet +} + +type UpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c VirtualMachineScaleSetsClient) Update(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + OptionsObject: options, + 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 VirtualMachineScaleSetsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetUpdate, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_updateinstances.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_updateinstances.go new file mode 100644 index 00000000000..9dc47df34a6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_updateinstances.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 UpdateInstancesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// UpdateInstances ... +func (c VirtualMachineScaleSetsClient) UpdateInstances(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceRequiredIDs) (result UpdateInstancesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/manualupgrade", 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 +} + +// UpdateInstancesThenPoll performs UpdateInstances then polls until it's completed +func (c VirtualMachineScaleSetsClient) UpdateInstancesThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceRequiredIDs) error { + result, err := c.UpdateInstances(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UpdateInstances: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpdateInstances: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_virtualmachinescalesetrollingupgradescancel.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_virtualmachinescalesetrollingupgradescancel.go new file mode 100644 index 00000000000..02941878d93 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_virtualmachinescalesetrollingupgradescancel.go @@ -0,0 +1,70 @@ +package virtualmachinescalesets + +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 VirtualMachineScaleSetRollingUpgradesCancelOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// VirtualMachineScaleSetRollingUpgradesCancel ... +func (c VirtualMachineScaleSetsClient) VirtualMachineScaleSetRollingUpgradesCancel(ctx context.Context, id VirtualMachineScaleSetId) (result VirtualMachineScaleSetRollingUpgradesCancelOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/rollingUpgrades/cancel", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// VirtualMachineScaleSetRollingUpgradesCancelThenPoll performs VirtualMachineScaleSetRollingUpgradesCancel then polls until it's completed +func (c VirtualMachineScaleSetsClient) VirtualMachineScaleSetRollingUpgradesCancelThenPoll(ctx context.Context, id VirtualMachineScaleSetId) error { + result, err := c.VirtualMachineScaleSetRollingUpgradesCancel(ctx, id) + if err != nil { + return fmt.Errorf("performing VirtualMachineScaleSetRollingUpgradesCancel: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after VirtualMachineScaleSetRollingUpgradesCancel: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_virtualmachinescalesetrollingupgradesstartextensionupgrade.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_virtualmachinescalesetrollingupgradesstartextensionupgrade.go new file mode 100644 index 00000000000..838c8945c9c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_virtualmachinescalesetrollingupgradesstartextensionupgrade.go @@ -0,0 +1,70 @@ +package virtualmachinescalesets + +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 VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// VirtualMachineScaleSetRollingUpgradesStartExtensionUpgrade ... +func (c VirtualMachineScaleSetsClient) VirtualMachineScaleSetRollingUpgradesStartExtensionUpgrade(ctx context.Context, id VirtualMachineScaleSetId) (result VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/extensionRollingUpgrade", 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 +} + +// VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeThenPoll performs VirtualMachineScaleSetRollingUpgradesStartExtensionUpgrade then polls until it's completed +func (c VirtualMachineScaleSetsClient) VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeThenPoll(ctx context.Context, id VirtualMachineScaleSetId) error { + result, err := c.VirtualMachineScaleSetRollingUpgradesStartExtensionUpgrade(ctx, id) + if err != nil { + return fmt.Errorf("performing VirtualMachineScaleSetRollingUpgradesStartExtensionUpgrade: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after VirtualMachineScaleSetRollingUpgradesStartExtensionUpgrade: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_virtualmachinescalesetrollingupgradesstartosupgrade.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_virtualmachinescalesetrollingupgradesstartosupgrade.go new file mode 100644 index 00000000000..29a63253449 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/method_virtualmachinescalesetrollingupgradesstartosupgrade.go @@ -0,0 +1,70 @@ +package virtualmachinescalesets + +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 VirtualMachineScaleSetRollingUpgradesStartOSUpgradeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// VirtualMachineScaleSetRollingUpgradesStartOSUpgrade ... +func (c VirtualMachineScaleSetsClient) VirtualMachineScaleSetRollingUpgradesStartOSUpgrade(ctx context.Context, id VirtualMachineScaleSetId) (result VirtualMachineScaleSetRollingUpgradesStartOSUpgradeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/osRollingUpgrade", 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 +} + +// VirtualMachineScaleSetRollingUpgradesStartOSUpgradeThenPoll performs VirtualMachineScaleSetRollingUpgradesStartOSUpgrade then polls until it's completed +func (c VirtualMachineScaleSetsClient) VirtualMachineScaleSetRollingUpgradesStartOSUpgradeThenPoll(ctx context.Context, id VirtualMachineScaleSetId) error { + result, err := c.VirtualMachineScaleSetRollingUpgradesStartOSUpgrade(ctx, id) + if err != nil { + return fmt.Errorf("performing VirtualMachineScaleSetRollingUpgradesStartOSUpgrade: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after VirtualMachineScaleSetRollingUpgradesStartOSUpgrade: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_additionalcapabilities.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_additionalcapabilities.go new file mode 100644 index 00000000000..b33eb7f520b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_additionalcapabilities.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalCapabilities struct { + EnableFips1403Encryption *bool `json:"enableFips1403Encryption,omitempty"` + HibernationEnabled *bool `json:"hibernationEnabled,omitempty"` + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_additionalunattendcontent.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_additionalunattendcontent.go new file mode 100644 index 00000000000..9fbd8efe581 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentName `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassName `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_allinstancesdown.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_allinstancesdown.go new file mode 100644 index 00000000000..6c1ce5e15ba --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_allinstancesdown.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AllInstancesDown struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_apientityreference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_apientityreference.go new file mode 100644 index 00000000000..b8430d55990 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_apientityreference.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_apierror.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_apierror.go new file mode 100644 index 00000000000..c4e82b6e5b3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_apierror.go @@ -0,0 +1,12 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiError struct { + Code *string `json:"code,omitempty"` + Details *[]ApiErrorBase `json:"details,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_apierrorbase.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_apierrorbase.go new file mode 100644 index 00000000000..c1b7a79f5df --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_apierrorbase.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiErrorBase struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_applicationprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_applicationprofile.go new file mode 100644 index 00000000000..4979d5eb29f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_applicationprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProfile struct { + GalleryApplications *[]VMGalleryApplication `json:"galleryApplications,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_automaticosupgradepolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_automaticosupgradepolicy.go new file mode 100644 index 00000000000..26fae1f0888 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_automaticosupgradepolicy.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticOSUpgradePolicy struct { + DisableAutomaticRollback *bool `json:"disableAutomaticRollback,omitempty"` + EnableAutomaticOSUpgrade *bool `json:"enableAutomaticOSUpgrade,omitempty"` + OsRollingUpgradeDeferral *bool `json:"osRollingUpgradeDeferral,omitempty"` + UseRollingUpgradePolicy *bool `json:"useRollingUpgradePolicy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_automaticrepairspolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_automaticrepairspolicy.go new file mode 100644 index 00000000000..dd68e2cc826 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_automaticrepairspolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticRepairsPolicy struct { + Enabled *bool `json:"enabled,omitempty"` + GracePeriod *string `json:"gracePeriod,omitempty"` + RepairAction *RepairAction `json:"repairAction,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_automaticzonerebalancingpolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_automaticzonerebalancingpolicy.go new file mode 100644 index 00000000000..e1f421268e8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_automaticzonerebalancingpolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticZoneRebalancingPolicy struct { + Enabled *bool `json:"enabled,omitempty"` + RebalanceBehavior *RebalanceBehavior `json:"rebalanceBehavior,omitempty"` + RebalanceStrategy *RebalanceStrategy `json:"rebalanceStrategy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_billingprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_billingprofile.go new file mode 100644 index 00000000000..b69f9f26b52 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_billingprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BillingProfile struct { + MaxPrice *float64 `json:"maxPrice,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_bootdiagnostics.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_bootdiagnostics.go new file mode 100644 index 00000000000..2b5a0dcb5b0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_capacityreservationprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_capacityreservationprofile.go new file mode 100644 index 00000000000..ed6e492511b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_capacityreservationprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationProfile struct { + CapacityReservationGroup *SubResource `json:"capacityReservationGroup,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_diagnosticsprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_diagnosticsprofile.go new file mode 100644 index 00000000000..8423d9217b3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_diffdisksettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_diffdisksettings.go new file mode 100644 index 00000000000..9f3f1651366 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_diffdisksettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiffDiskSettings struct { + Option *DiffDiskOptions `json:"option,omitempty"` + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_encryptionidentity.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_encryptionidentity.go new file mode 100644 index 00000000000..d295df7bb90 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionIdentity struct { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_eventgridandresourcegraph.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_eventgridandresourcegraph.go new file mode 100644 index 00000000000..db8a3b32988 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_eventgridandresourcegraph.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventGridAndResourceGraph struct { + Enable *bool `json:"enable,omitempty"` + ScheduledEventsApiVersion *string `json:"scheduledEventsApiVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_hostendpointsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_hostendpointsettings.go new file mode 100644 index 00000000000..6b1eaad7e92 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_imagereference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_imagereference.go new file mode 100644 index 00000000000..718ead8d889 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_imagereference.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + CommunityGalleryImageId *string `json:"communityGalleryImageId,omitempty"` + ExactVersion *string `json:"exactVersion,omitempty"` + Id *string `json:"id,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + SharedGalleryImageId *string `json:"sharedGalleryImageId,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_innererror.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_innererror.go new file mode 100644 index 00000000000..0700072f546 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_innererror.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InnerError struct { + Errordetail *string `json:"errordetail,omitempty"` + Exceptiontype *string `json:"exceptiontype,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_instanceviewstatus.go new file mode 100644 index 00000000000..a29cb5e5bb2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachinescalesets + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_keyvaultsecretreference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..c27479d1430 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_linuxconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_linuxconfiguration.go new file mode 100644 index 00000000000..f86ad715bac --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_linuxpatchsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_linuxpatchsettings.go new file mode 100644 index 00000000000..0f31a50ca68 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..8d6cb04a3d3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_maxinstancepercentperzonepolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_maxinstancepercentperzonepolicy.go new file mode 100644 index 00000000000..c14d174af1f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_maxinstancepercentperzonepolicy.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaxInstancePercentPerZonePolicy struct { + Enabled *bool `json:"enabled,omitempty"` + Value *int64 `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_orchestrationservicestateinput.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_orchestrationservicestateinput.go new file mode 100644 index 00000000000..7e31615784b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_orchestrationservicestateinput.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OrchestrationServiceStateInput struct { + Action OrchestrationServiceStateAction `json:"action"` + ServiceName OrchestrationServiceNames `json:"serviceName"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_orchestrationservicesummary.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_orchestrationservicesummary.go new file mode 100644 index 00000000000..6fe93aadb28 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_orchestrationservicesummary.go @@ -0,0 +1,29 @@ +package virtualmachinescalesets + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OrchestrationServiceSummary struct { + LastStatusChangeTime *string `json:"lastStatusChangeTime,omitempty"` + LatestOperationStatus *OrchestrationServiceOperationStatus `json:"latestOperationStatus,omitempty"` + ServiceName *OrchestrationServiceNames `json:"serviceName,omitempty"` + ServiceState *OrchestrationServiceState `json:"serviceState,omitempty"` +} + +func (o *OrchestrationServiceSummary) GetLastStatusChangeTimeAsTime() (*time.Time, error) { + if o.LastStatusChangeTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastStatusChangeTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OrchestrationServiceSummary) SetLastStatusChangeTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastStatusChangeTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_osimagenotificationprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_osimagenotificationprofile.go new file mode 100644 index 00000000000..01f7a77997c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_osimagenotificationprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSImageNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_osprofileprovisioningdata.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_osprofileprovisioningdata.go new file mode 100644 index 00000000000..cd887deb66f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_osprofileprovisioningdata.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfileProvisioningData struct { + AdminPassword *string `json:"adminPassword,omitempty"` + CustomData *string `json:"customData,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_patchsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_patchsettings.go new file mode 100644 index 00000000000..23c367ad95b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_patchsettings.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_placement.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_placement.go new file mode 100644 index 00000000000..cd84eaeafad --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_placement.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Placement struct { + ExcludeZones *[]string `json:"excludeZones,omitempty"` + IncludeZones *[]string `json:"includeZones,omitempty"` + ZonePlacementPolicy *ZonePlacementPolicyType `json:"zonePlacementPolicy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_plan.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_plan.go new file mode 100644 index 00000000000..9d6837d0ec3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_plan.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher *string `json:"publisher,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_prioritymixpolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_prioritymixpolicy.go new file mode 100644 index 00000000000..e287abb09db --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_prioritymixpolicy.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PriorityMixPolicy struct { + BaseRegularPriorityCount *int64 `json:"baseRegularPriorityCount,omitempty"` + RegularPriorityPercentageAboveBase *int64 `json:"regularPriorityPercentageAboveBase,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_proxyagentsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_proxyagentsettings.go new file mode 100644 index 00000000000..f7bf649a161 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_proxyagentsettings.go @@ -0,0 +1,13 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + AddProxyAgentExtension *bool `json:"addProxyAgentExtension,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_publicipaddresssku.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_publicipaddresssku.go new file mode 100644 index 00000000000..25af0eadebb --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_publicipaddresssku.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicIPAddressSku struct { + Name *PublicIPAddressSkuName `json:"name,omitempty"` + Tier *PublicIPAddressSkuTier `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_recoverywalkresponse.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_recoverywalkresponse.go new file mode 100644 index 00000000000..1aacd4b4dde --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_recoverywalkresponse.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecoveryWalkResponse struct { + NextPlatformUpdateDomain *int64 `json:"nextPlatformUpdateDomain,omitempty"` + WalkPerformed *bool `json:"walkPerformed,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_resiliencypolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_resiliencypolicy.go new file mode 100644 index 00000000000..1d5c1854b67 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_resiliencypolicy.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResiliencyPolicy struct { + AutomaticZoneRebalancingPolicy *AutomaticZoneRebalancingPolicy `json:"automaticZoneRebalancingPolicy,omitempty"` + ResilientVMCreationPolicy *ResilientVMCreationPolicy `json:"resilientVMCreationPolicy,omitempty"` + ResilientVMDeletionPolicy *ResilientVMDeletionPolicy `json:"resilientVMDeletionPolicy,omitempty"` + ZoneAllocationPolicy *ZoneAllocationPolicy `json:"zoneAllocationPolicy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_resilientvmcreationpolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_resilientvmcreationpolicy.go new file mode 100644 index 00000000000..e2c35ecafc3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_resilientvmcreationpolicy.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResilientVMCreationPolicy struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_resilientvmdeletionpolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_resilientvmdeletionpolicy.go new file mode 100644 index 00000000000..feff4983eb2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_resilientvmdeletionpolicy.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResilientVMDeletionPolicy struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_rollbackstatusinfo.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_rollbackstatusinfo.go new file mode 100644 index 00000000000..ecabe4651da --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_rollbackstatusinfo.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollbackStatusInfo struct { + FailedRolledbackInstanceCount *int64 `json:"failedRolledbackInstanceCount,omitempty"` + RollbackError *ApiError `json:"rollbackError,omitempty"` + SuccessfullyRolledbackInstanceCount *int64 `json:"successfullyRolledbackInstanceCount,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_rollingupgradepolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_rollingupgradepolicy.go new file mode 100644 index 00000000000..f8df6452f30 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_rollingupgradepolicy.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradePolicy struct { + EnableCrossZoneUpgrade *bool `json:"enableCrossZoneUpgrade,omitempty"` + MaxBatchInstancePercent *int64 `json:"maxBatchInstancePercent,omitempty"` + MaxSurge *bool `json:"maxSurge,omitempty"` + MaxUnhealthyInstancePercent *int64 `json:"maxUnhealthyInstancePercent,omitempty"` + MaxUnhealthyUpgradedInstancePercent *int64 `json:"maxUnhealthyUpgradedInstancePercent,omitempty"` + PauseTimeBetweenBatches *string `json:"pauseTimeBetweenBatches,omitempty"` + PrioritizeUnhealthyInstances *bool `json:"prioritizeUnhealthyInstances,omitempty"` + RollbackFailedInstancesOnPolicyBreach *bool `json:"rollbackFailedInstancesOnPolicyBreach,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_rollingupgradeprogressinfo.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_rollingupgradeprogressinfo.go new file mode 100644 index 00000000000..3852391f39c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_rollingupgradeprogressinfo.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradeProgressInfo struct { + FailedInstanceCount *int64 `json:"failedInstanceCount,omitempty"` + InProgressInstanceCount *int64 `json:"inProgressInstanceCount,omitempty"` + PendingInstanceCount *int64 `json:"pendingInstanceCount,omitempty"` + SuccessfulInstanceCount *int64 `json:"successfulInstanceCount,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scaleinpolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scaleinpolicy.go new file mode 100644 index 00000000000..5684a6b4cb3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scaleinpolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleInPolicy struct { + ForceDeletion *bool `json:"forceDeletion,omitempty"` + PrioritizeUnhealthyVMs *bool `json:"prioritizeUnhealthyVMs,omitempty"` + Rules *[]VirtualMachineScaleSetScaleInRules `json:"rules,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scheduledeventsadditionalpublishingtargets.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scheduledeventsadditionalpublishingtargets.go new file mode 100644 index 00000000000..bc383cb9b33 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scheduledeventsadditionalpublishingtargets.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsAdditionalPublishingTargets struct { + EventGridAndResourceGraph *EventGridAndResourceGraph `json:"eventGridAndResourceGraph,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scheduledeventspolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scheduledeventspolicy.go new file mode 100644 index 00000000000..20ca113b663 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scheduledeventspolicy.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsPolicy struct { + AllInstancesDown *AllInstancesDown `json:"allInstancesDown,omitempty"` + ScheduledEventsAdditionalPublishingTargets *ScheduledEventsAdditionalPublishingTargets `json:"scheduledEventsAdditionalPublishingTargets,omitempty"` + UserInitiatedReboot *UserInitiatedReboot `json:"userInitiatedReboot,omitempty"` + UserInitiatedRedeploy *UserInitiatedRedeploy `json:"userInitiatedRedeploy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scheduledeventsprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scheduledeventsprofile.go new file mode 100644 index 00000000000..25e3a7ffd6d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_scheduledeventsprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsProfile struct { + OsImageNotificationProfile *OSImageNotificationProfile `json:"osImageNotificationProfile,omitempty"` + TerminateNotificationProfile *TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_securityposturereference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_securityposturereference.go new file mode 100644 index 00000000000..21be9e6cdbd --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_securityposturereference.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPostureReference struct { + ExcludeExtensions *[]string `json:"excludeExtensions,omitempty"` + Id string `json:"id"` + IsOverridable *bool `json:"isOverridable,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_securityposturereferenceupdate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_securityposturereferenceupdate.go new file mode 100644 index 00000000000..e39c521ee58 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_securityposturereferenceupdate.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPostureReferenceUpdate struct { + ExcludeExtensions *[]string `json:"excludeExtensions,omitempty"` + Id *string `json:"id,omitempty"` + IsOverridable *bool `json:"isOverridable,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_securityprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_securityprofile.go new file mode 100644 index 00000000000..cb9223bca85 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_securityprofile.go @@ -0,0 +1,12 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_serviceartifactreference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_serviceartifactreference.go new file mode 100644 index 00000000000..551c4ae1049 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_serviceartifactreference.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceArtifactReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_sku.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_sku.go new file mode 100644 index 00000000000..15a2fdc0616 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_sku.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_skuprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_skuprofile.go new file mode 100644 index 00000000000..4036ce3128a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_skuprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuProfile struct { + AllocationStrategy *AllocationStrategy `json:"allocationStrategy,omitempty"` + VMSizes *[]SkuProfileVMSize `json:"vmSizes,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_skuprofilevmsize.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_skuprofilevmsize.go new file mode 100644 index 00000000000..afbbc66942e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_skuprofilevmsize.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuProfileVMSize struct { + Name *string `json:"name,omitempty"` + Rank *int64 `json:"rank,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_spotrestorepolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_spotrestorepolicy.go new file mode 100644 index 00000000000..7ee643d9bc1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_spotrestorepolicy.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpotRestorePolicy struct { + Enabled *bool `json:"enabled,omitempty"` + RestoreTimeout *string `json:"restoreTimeout,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_sshconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_sshconfiguration.go new file mode 100644 index 00000000000..f753251b5f7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_sshpublickey.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_sshpublickey.go new file mode 100644 index 00000000000..489608153b4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_sshpublickey.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_subresource.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_subresource.go new file mode 100644 index 00000000000..a7ddcb87058 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_terminatenotificationprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_terminatenotificationprofile.go new file mode 100644 index 00000000000..8152ca787d0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_terminatenotificationprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TerminateNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_uefisettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_uefisettings.go new file mode 100644 index 00000000000..0f9f555ac1c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_uefisettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfo.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfo.go new file mode 100644 index 00000000000..18769cefc72 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfo.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeOperationHistoricalStatusInfo struct { + Location *string `json:"location,omitempty"` + Properties *UpgradeOperationHistoricalStatusInfoProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfoproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfoproperties.go new file mode 100644 index 00000000000..9a195b52b4d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfoproperties.go @@ -0,0 +1,13 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeOperationHistoricalStatusInfoProperties struct { + Error *ApiError `json:"error,omitempty"` + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty"` + RollbackInfo *RollbackStatusInfo `json:"rollbackInfo,omitempty"` + RunningStatus *UpgradeOperationHistoryStatus `json:"runningStatus,omitempty"` + StartedBy *UpgradeOperationInvoker `json:"startedBy,omitempty"` + TargetImageReference *ImageReference `json:"targetImageReference,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradeoperationhistorystatus.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradeoperationhistorystatus.go new file mode 100644 index 00000000000..9b295dd5586 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradeoperationhistorystatus.go @@ -0,0 +1,40 @@ +package virtualmachinescalesets + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeOperationHistoryStatus struct { + Code *UpgradeState `json:"code,omitempty"` + EndTime *string `json:"endTime,omitempty"` + StartTime *string `json:"startTime,omitempty"` +} + +func (o *UpgradeOperationHistoryStatus) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeOperationHistoryStatus) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *UpgradeOperationHistoryStatus) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeOperationHistoryStatus) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradepolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradepolicy.go new file mode 100644 index 00000000000..274f574700a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_upgradepolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradePolicy struct { + AutomaticOSUpgradePolicy *AutomaticOSUpgradePolicy `json:"automaticOSUpgradePolicy,omitempty"` + Mode *UpgradeMode `json:"mode,omitempty"` + RollingUpgradePolicy *RollingUpgradePolicy `json:"rollingUpgradePolicy,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_userinitiatedreboot.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_userinitiatedreboot.go new file mode 100644 index 00000000000..2a40c2ce0a0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_userinitiatedreboot.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedReboot struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_userinitiatedredeploy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_userinitiatedredeploy.go new file mode 100644 index 00000000000..56fb85e872b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_userinitiatedredeploy.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedRedeploy struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vaultcertificate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vaultcertificate.go new file mode 100644 index 00000000000..4e9173b39e6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vaultsecretgroup.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vaultsecretgroup.go new file mode 100644 index 00000000000..4e737daf929 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualharddisk.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualharddisk.go new file mode 100644 index 00000000000..da6fa628059 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualharddisk.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualHardDisk struct { + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescaleset.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescaleset.go new file mode 100644 index 00000000000..91793100cf4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescaleset.go @@ -0,0 +1,28 @@ +package virtualmachinescalesets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSet struct { + Etag *string `json:"etag,omitempty"` + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Placement *Placement `json:"placement,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineScaleSetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetdatadisk.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetdatadisk.go new file mode 100644 index 00000000000..99a4db2cd26 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetdatadisk.go @@ -0,0 +1,17 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetDataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetextension.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetextension.go new file mode 100644 index 00000000000..d28ca76627f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetextension.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtension struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetextensionprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetextensionprofile.go new file mode 100644 index 00000000000..c16c1e62d7b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetextensionprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionProfile struct { + Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"` + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetextensionproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetextensionproperties.go new file mode 100644 index 00000000000..ab08726d81e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetextensionproperties.go @@ -0,0 +1,19 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesethardwareprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesethardwareprofile.go new file mode 100644 index 00000000000..844a041b715 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesethardwareprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetHardwareProfile struct { + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceview.go new file mode 100644 index 00000000000..f7f4c1d937d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceview.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetInstanceView struct { + Extensions *[]VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty"` + OrchestrationServices *[]OrchestrationServiceSummary `json:"orchestrationServices,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceviewstatusessummary.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceviewstatusessummary.go new file mode 100644 index 00000000000..da9756a65e8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceviewstatusessummary.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetInstanceViewStatusesSummary struct { + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetipconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetipconfiguration.go new file mode 100644 index 00000000000..a474d72203b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetipconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetipconfigurationproperties.go new file mode 100644 index 00000000000..60ed5574205 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetipconfigurationproperties.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *ApiEntityReference `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetiptag.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetiptag.go new file mode 100644 index 00000000000..d5041eaa002 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetiptag.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetmanageddiskparameters.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetmanageddiskparameters.go new file mode 100644 index 00000000000..62742dc4763 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetmanageddiskparameters.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfiguration.go new file mode 100644 index 00000000000..1a2beb2e9f1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go new file mode 100644 index 00000000000..b3b28195210 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationDnsSettings struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationproperties.go new file mode 100644 index 00000000000..2a346c19dce --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationproperties.go @@ -0,0 +1,18 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings `json:"dnsSettings,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkprofile.go new file mode 100644 index 00000000000..e15f8580162 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkprofile.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkProfile struct { + HealthProbe *ApiEntityReference `json:"healthProbe,omitempty"` + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetosdisk.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetosdisk.go new file mode 100644 index 00000000000..0cc179b304b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetosdisk.go @@ -0,0 +1,18 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetOSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemTypes `json:"osType,omitempty"` + VhdContainers *[]string `json:"vhdContainers,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetosprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetosprofile.go new file mode 100644 index 00000000000..b1bbc5e5dd4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetosprofile.go @@ -0,0 +1,16 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetOSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetproperties.go new file mode 100644 index 00000000000..24ad0669bfb --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetproperties.go @@ -0,0 +1,49 @@ +package virtualmachinescalesets + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + AutomaticRepairsPolicy *AutomaticRepairsPolicy `json:"automaticRepairsPolicy,omitempty"` + ConstrainedMaximumCapacity *bool `json:"constrainedMaximumCapacity,omitempty"` + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + HighSpeedInterconnectPlacement *HighSpeedInterconnectPlacement `json:"highSpeedInterconnectPlacement,omitempty"` + HostGroup *SubResource `json:"hostGroup,omitempty"` + OrchestrationMode *OrchestrationMode `json:"orchestrationMode,omitempty"` + Overprovision *bool `json:"overprovision,omitempty"` + PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"` + PriorityMixPolicy *PriorityMixPolicy `json:"priorityMixPolicy,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ResiliencyPolicy *ResiliencyPolicy `json:"resiliencyPolicy,omitempty"` + ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` + ScheduledEventsPolicy *ScheduledEventsPolicy `json:"scheduledEventsPolicy,omitempty"` + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + SkuProfile *SkuProfile `json:"skuProfile,omitempty"` + SpotRestorePolicy *SpotRestorePolicy `json:"spotRestorePolicy,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UniqueId *string `json:"uniqueId,omitempty"` + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` + ZonalPlatformFaultDomainAlignMode *ZonalPlatformFaultDomainAlignMode `json:"zonalPlatformFaultDomainAlignMode,omitempty"` + ZoneBalance *bool `json:"zoneBalance,omitempty"` +} + +func (o *VirtualMachineScaleSetProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineScaleSetProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfiguration.go new file mode 100644 index 00000000000..d6aba6c5c3f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfiguration.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetPublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go new file mode 100644 index 00000000000..f35d4c26550 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..eb4ea50962b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go @@ -0,0 +1,13 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineScaleSetIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetreimageparameters.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetreimageparameters.go new file mode 100644 index 00000000000..e14bf36b233 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetreimageparameters.go @@ -0,0 +1,12 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetReimageParameters struct { + ExactVersion *string `json:"exactVersion,omitempty"` + ForceUpdateOSDiskForEphemeral *bool `json:"forceUpdateOSDiskForEphemeral,omitempty"` + InstanceIds *[]string `json:"instanceIds,omitempty"` + OsProfile *OSProfileProvisioningData `json:"osProfile,omitempty"` + TempDisk *bool `json:"tempDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetsku.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetsku.go new file mode 100644 index 00000000000..dda5b916c20 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetsku.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetSku struct { + Capacity *VirtualMachineScaleSetSkuCapacity `json:"capacity,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetskucapacity.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetskucapacity.go new file mode 100644 index 00000000000..8ed0fd37617 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetskucapacity.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetSkuCapacity struct { + DefaultCapacity *int64 `json:"defaultCapacity,omitempty"` + Maximum *int64 `json:"maximum,omitempty"` + Minimum *int64 `json:"minimum,omitempty"` + ScaleType *VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetstorageprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetstorageprofile.go new file mode 100644 index 00000000000..18349760780 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetstorageprofile.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetStorageProfile struct { + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdate.go new file mode 100644 index 00000000000..9be4349f801 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdate.go @@ -0,0 +1,18 @@ +package virtualmachinescalesets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdate struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineScaleSetUpdateProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfiguration.go new file mode 100644 index 00000000000..702a011b11f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateIPConfiguration struct { + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetUpdateIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfigurationproperties.go new file mode 100644 index 00000000000..f8bf924d92f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfigurationproperties.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachineScaleSetUpdatePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *ApiEntityReference `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfiguration.go new file mode 100644 index 00000000000..ed6eacef1eb --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateNetworkConfiguration struct { + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetUpdateNetworkConfigurationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfigurationproperties.go new file mode 100644 index 00000000000..8b2cf14e02b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfigurationproperties.go @@ -0,0 +1,18 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateNetworkConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings `json:"dnsSettings,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations *[]VirtualMachineScaleSetUpdateIPConfiguration `json:"ipConfigurations,omitempty"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkprofile.go new file mode 100644 index 00000000000..1de04625646 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkprofile.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateNetworkProfile struct { + HealthProbe *ApiEntityReference `json:"healthProbe,omitempty"` + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetUpdateNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosdisk.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosdisk.go new file mode 100644 index 00000000000..42564d5c007 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosdisk.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateOSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + VhdContainers *[]string `json:"vhdContainers,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosprofile.go new file mode 100644 index 00000000000..a08ca7e2c73 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosprofile.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateOSProfile struct { + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateproperties.go new file mode 100644 index 00000000000..192a5d7b54f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdateproperties.go @@ -0,0 +1,21 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + AutomaticRepairsPolicy *AutomaticRepairsPolicy `json:"automaticRepairsPolicy,omitempty"` + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + Overprovision *bool `json:"overprovision,omitempty"` + PriorityMixPolicy *PriorityMixPolicy `json:"priorityMixPolicy,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ResiliencyPolicy *ResiliencyPolicy `json:"resiliencyPolicy,omitempty"` + ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + SkuProfile *SkuProfile `json:"skuProfile,omitempty"` + SpotRestorePolicy *SpotRestorePolicy `json:"spotRestorePolicy,omitempty"` + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + VirtualMachineProfile *VirtualMachineScaleSetUpdateVMProfile `json:"virtualMachineProfile,omitempty"` + ZonalPlatformFaultDomainAlignMode *ZonalPlatformFaultDomainAlignMode `json:"zonalPlatformFaultDomainAlignMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfiguration.go new file mode 100644 index 00000000000..f706874b71a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdatePublicIPAddressConfiguration struct { + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..1103592c3b7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfigurationproperties.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings `json:"dnsSettings,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatestorageprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatestorageprofile.go new file mode 100644 index 00000000000..20880da1053 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatestorageprofile.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateStorageProfile struct { + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *VirtualMachineScaleSetUpdateOSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatevmprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatevmprofile.go new file mode 100644 index 00000000000..ae6a7c875ef --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetupdatevmprofile.go @@ -0,0 +1,19 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateVMProfile struct { + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + HardwareProfile *VirtualMachineScaleSetHardwareProfile `json:"hardwareProfile,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + NetworkProfile *VirtualMachineScaleSetUpdateNetworkProfile `json:"networkProfile,omitempty"` + OsProfile *VirtualMachineScaleSetUpdateOSProfile `json:"osProfile,omitempty"` + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + SecurityPostureReference *SecurityPostureReferenceUpdate `json:"securityPostureReference,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *VirtualMachineScaleSetUpdateStorageProfile `json:"storageProfile,omitempty"` + UserData *string `json:"userData,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvmextensionssummary.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvmextensionssummary.go new file mode 100644 index 00000000000..17129893f61 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvmextensionssummary.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMExtensionsSummary struct { + Name *string `json:"name,omitempty"` + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvminstanceids.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvminstanceids.go new file mode 100644 index 00000000000..aaad4fdde84 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvminstanceids.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMInstanceIDs struct { + InstanceIds *[]string `json:"instanceIds,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvminstancerequiredids.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvminstancerequiredids.go new file mode 100644 index 00000000000..c062f66e5f3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvminstancerequiredids.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMInstanceRequiredIDs struct { + InstanceIds []string `json:"instanceIds"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvmprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvmprofile.go new file mode 100644 index 00000000000..27fd00259fc --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinescalesetvmprofile.go @@ -0,0 +1,43 @@ +package virtualmachinescalesets + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMProfile struct { + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + EvictionPolicy *VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + HardwareProfile *VirtualMachineScaleSetHardwareProfile `json:"hardwareProfile,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` + OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` + Priority *VirtualMachinePriorityTypes `json:"priority,omitempty"` + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + SecurityPostureReference *SecurityPostureReference `json:"securityPostureReference,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + ServiceArtifactReference *ServiceArtifactReference `json:"serviceArtifactReference,omitempty"` + StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UserData *string `json:"userData,omitempty"` +} + +func (o *VirtualMachineScaleSetVMProfile) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineScaleSetVMProfile) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinestatuscodecount.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinestatuscodecount.go new file mode 100644 index 00000000000..3a836612f78 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_virtualmachinestatuscodecount.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineStatusCodeCount struct { + Code *string `json:"code,omitempty"` + Count *int64 `json:"count,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmdisksecurityprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..9f089766d67 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmgalleryapplication.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmgalleryapplication.go new file mode 100644 index 00000000000..6bfd25f6a47 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmgalleryapplication.go @@ -0,0 +1,13 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMGalleryApplication struct { + ConfigurationReference *string `json:"configurationReference,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + Order *int64 `json:"order,omitempty"` + PackageReferenceId string `json:"packageReferenceId"` + Tags *string `json:"tags,omitempty"` + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmscalesetconverttosingleplacementgroupinput.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmscalesetconverttosingleplacementgroupinput.go new file mode 100644 index 00000000000..7ef0c90ecf1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmscalesetconverttosingleplacementgroupinput.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMScaleSetConvertToSinglePlacementGroupInput struct { + ActivePlacementGroupId *string `json:"activePlacementGroupId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmscalesetscaleoutinput.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmscalesetscaleoutinput.go new file mode 100644 index 00000000000..c42092a7040 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmscalesetscaleoutinput.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMScaleSetScaleOutInput struct { + Capacity int64 `json:"capacity"` + Properties *VMScaleSetScaleOutInputProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmscalesetscaleoutinputproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmscalesetscaleoutinputproperties.go new file mode 100644 index 00000000000..0bec3fe2ea6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmscalesetscaleoutinputproperties.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMScaleSetScaleOutInputProperties struct { + Zone *string `json:"zone,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmsizeproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmsizeproperties.go new file mode 100644 index 00000000000..07f2433ca4a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_windowsconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_windowsconfiguration.go new file mode 100644 index 00000000000..ff1f44929f5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..3a2358f7cb4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_winrmconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_winrmconfiguration.go new file mode 100644 index 00000000000..de3ef359e0f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_winrmlistener.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_winrmlistener.go new file mode 100644 index 00000000000..fbaee700c4e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_winrmlistener.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_zoneallocationpolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_zoneallocationpolicy.go new file mode 100644 index 00000000000..b45d91788db --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/model_zoneallocationpolicy.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZoneAllocationPolicy struct { + MaxInstancePercentPerZonePolicy *MaxInstancePercentPerZonePolicy `json:"maxInstancePercentPerZonePolicy,omitempty"` + MaxZoneCount *int64 `json:"maxZoneCount,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/predicates.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/predicates.go new file mode 100644 index 00000000000..3936b21e239 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/predicates.go @@ -0,0 +1,68 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeOperationHistoricalStatusInfoOperationPredicate struct { + Location *string + Type *string +} + +func (p UpgradeOperationHistoricalStatusInfoOperationPredicate) Matches(input UpgradeOperationHistoricalStatusInfo) bool { + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type VirtualMachineScaleSetOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineScaleSetOperationPredicate) Matches(input VirtualMachineScaleSet) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type VirtualMachineScaleSetSkuOperationPredicate struct { + ResourceType *string +} + +func (p VirtualMachineScaleSetSkuOperationPredicate) Matches(input VirtualMachineScaleSetSku) bool { + + if p.ResourceType != nil && (input.ResourceType == nil || *p.ResourceType != *input.ResourceType) { + return false + } + + return true +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesets/version.go b/resource-manager/compute/2025-04-01/virtualmachinescalesets/version.go new file mode 100644 index 00000000000..d65201d9337 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesets/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesets/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/README.md b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/README.md new file mode 100644 index 00000000000..9dcb2b9a9dc --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/README.md @@ -0,0 +1,98 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions` Documentation + +The `virtualmachinescalesetvmextensions` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/virtualmachinescalesetvmextensions" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesetvmextensions.NewVirtualMachineScaleSetVMExtensionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + +payload := virtualmachinescalesetvmextensions.VirtualMachineScaleSetVMExtension{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + +read, err := client.Get(ctx, id, virtualmachinescalesetvmextensions.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.List` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.List(ctx, id, virtualmachinescalesetvmextensions.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + +payload := virtualmachinescalesetvmextensions.VirtualMachineScaleSetVMExtensionUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/client.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/client.go new file mode 100644 index 00000000000..384674618ef --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesetvmextensions + +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 VirtualMachineScaleSetVMExtensionsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetVMExtensionsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetVMExtensionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesetvmextensions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetVMExtensionsClient: %+v", err) + } + + return &VirtualMachineScaleSetVMExtensionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/constants.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/constants.go new file mode 100644 index 00000000000..3a564dc878a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/constants.go @@ -0,0 +1,54 @@ +package virtualmachinescalesetvmextensions + +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 StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go new file mode 100644 index 00000000000..52f7976168f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go @@ -0,0 +1,148 @@ +package virtualmachinescalesetvmextensions + +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(&VirtualMachineExtensionId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineExtensionId{} + +// VirtualMachineExtensionId is a struct representing the Resource ID for a Virtual Machine Extension +type VirtualMachineExtensionId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string + ExtensionName string +} + +// NewVirtualMachineExtensionID returns a new VirtualMachineExtensionId struct +func NewVirtualMachineExtensionID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string, extensionName string) VirtualMachineExtensionId { + return VirtualMachineExtensionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + ExtensionName: extensionName, + } +} + +// ParseVirtualMachineExtensionID parses 'input' into a VirtualMachineExtensionId +func ParseVirtualMachineExtensionID(input string) (*VirtualMachineExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineExtensionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineExtensionIDInsensitively parses 'input' case-insensitively into a VirtualMachineExtensionId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineExtensionIDInsensitively(input string) (*VirtualMachineExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineExtensionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineExtensionId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) + } + + return nil +} + +// ValidateVirtualMachineExtensionID checks that 'input' can be parsed as a Virtual Machine Extension ID +func ValidateVirtualMachineExtensionID(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 := ParseVirtualMachineExtensionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Extension ID +func (id VirtualMachineExtensionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s/extensions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId, id.ExtensionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Extension ID +func (id VirtualMachineExtensionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + resourceids.StaticSegment("staticExtensions", "extensions", "extensions"), + resourceids.UserSpecifiedSegment("extensionName", "extensionName"), + } +} + +// String returns a human-readable description of this Virtual Machine Extension ID +func (id VirtualMachineExtensionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + fmt.Sprintf("Extension Name: %q", id.ExtensionName), + } + return fmt.Sprintf("Virtual Machine Extension (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachineextension_test.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachineextension_test.go new file mode 100644 index 00000000000..fb282110d45 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachineextension_test.go @@ -0,0 +1,372 @@ +package virtualmachinescalesetvmextensions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineExtensionId{} + +func TestNewVirtualMachineExtensionID(t *testing.T) { + id := NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } + + if id.ExtensionName != "extensionName" { + t.Fatalf("Expected %q but got %q for Segment 'ExtensionName'", id.ExtensionName, "extensionName") + } +} + +func TestFormatVirtualMachineExtensionID(t *testing.T) { + actual := NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineExtensionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineExtensionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName", + Expected: &VirtualMachineExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineExtensionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestParseVirtualMachineExtensionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineExtensionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/eXtEnSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName", + Expected: &VirtualMachineExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/eXtEnSiOnS/eXtEnSiOnNaMe", + Expected: &VirtualMachineExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + ExtensionName: "eXtEnSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/eXtEnSiOnS/eXtEnSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineExtensionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestSegmentsForVirtualMachineExtensionId(t *testing.T) { + segments := VirtualMachineExtensionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineExtensionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go new file mode 100644 index 00000000000..4cc5c767617 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go @@ -0,0 +1,139 @@ +package virtualmachinescalesetvmextensions + +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(&VirtualMachineScaleSetVirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineId{} + +// VirtualMachineScaleSetVirtualMachineId is a struct representing the Resource ID for a Virtual Machine Scale Set Virtual Machine +type VirtualMachineScaleSetVirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string +} + +// NewVirtualMachineScaleSetVirtualMachineID returns a new VirtualMachineScaleSetVirtualMachineId struct +func NewVirtualMachineScaleSetVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string) VirtualMachineScaleSetVirtualMachineId { + return VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + } +} + +// ParseVirtualMachineScaleSetVirtualMachineID parses 'input' into a VirtualMachineScaleSetVirtualMachineId +func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetVirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID +func ValidateVirtualMachineScaleSetVirtualMachineID(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 := ParseVirtualMachineScaleSetVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + } + return fmt.Sprintf("Virtual Machine Scale Set Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine_test.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine_test.go new file mode 100644 index 00000000000..ef02f2a5f61 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine_test.go @@ -0,0 +1,327 @@ +package virtualmachinescalesetvmextensions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineId{} + +func TestNewVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + id := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } +} + +func TestFormatVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetVirtualMachineId(t *testing.T) { + segments := VirtualMachineScaleSetVirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetVirtualMachineId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_createorupdate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_createorupdate.go new file mode 100644 index 00000000000..46ef08d1f08 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetvmextensions + +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 *VirtualMachineScaleSetVMExtension +} + +// CreateOrUpdate ... +func (c VirtualMachineScaleSetVMExtensionsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineExtensionId, input VirtualMachineScaleSetVMExtension) (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 VirtualMachineScaleSetVMExtensionsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineExtensionId, input VirtualMachineScaleSetVMExtension) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_delete.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_delete.go new file mode 100644 index 00000000000..5d5bc88108a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachinescalesetvmextensions + +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 VirtualMachineScaleSetVMExtensionsClient) Delete(ctx context.Context, id VirtualMachineExtensionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachineScaleSetVMExtensionsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineExtensionId) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_get.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_get.go new file mode 100644 index 00000000000..03923b1ef4d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvmextensions + +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 *VirtualMachineScaleSetVMExtension +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetVMExtensionsClient) Get(ctx context.Context, id VirtualMachineExtensionId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 VirtualMachineScaleSetVMExtension + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_list.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_list.go new file mode 100644 index 00000000000..300d802904c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_list.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvmextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetVMExtensionsListResult +} + +type ListOperationOptions struct { + Expand *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// List ... +func (c VirtualMachineScaleSetVMExtensionsClient) List(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/extensions", 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 VirtualMachineScaleSetVMExtensionsListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_update.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_update.go new file mode 100644 index 00000000000..a0bf00c1157 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/method_update.go @@ -0,0 +1,74 @@ +package virtualmachinescalesetvmextensions + +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 *VirtualMachineScaleSetVMExtension +} + +// Update ... +func (c VirtualMachineScaleSetVMExtensionsClient) Update(ctx context.Context, id VirtualMachineExtensionId, input VirtualMachineScaleSetVMExtensionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VirtualMachineScaleSetVMExtensionsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineExtensionId, input VirtualMachineScaleSetVMExtensionUpdate) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_instanceviewstatus.go new file mode 100644 index 00000000000..888a36f4514 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachinescalesetvmextensions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_keyvaultsecretreference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..b94a17b7d3d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_subresource.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_subresource.go new file mode 100644 index 00000000000..29f079f3bdb --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachineextensioninstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachineextensioninstanceview.go new file mode 100644 index 00000000000..951deccdde8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachineextensioninstanceview.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionproperties.go new file mode 100644 index 00000000000..fcea791e563 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionproperties.go @@ -0,0 +1,20 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionupdateproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionupdateproperties.go new file mode 100644 index 00000000000..e367a5a9095 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionupdateproperties.go @@ -0,0 +1,17 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionUpdateProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextension.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextension.go new file mode 100644 index 00000000000..d8eb6bedf08 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextension.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMExtension struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionslistresult.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionslistresult.go new file mode 100644 index 00000000000..207a4ce0a1c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionslistresult.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMExtensionsListResult struct { + Value *[]VirtualMachineScaleSetVMExtension `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionupdate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionupdate.go new file mode 100644 index 00000000000..01cf7321b21 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionupdate.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMExtensionUpdate struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/version.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/version.go new file mode 100644 index 00000000000..9eae2e2a2e2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmextensions/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvmextensions + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesetvmextensions/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/README.md b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/README.md new file mode 100644 index 00000000000..40b67e0f0b6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands` Documentation + +The `virtualmachinescalesetvmruncommands` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/virtualmachinescalesetvmruncommands" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVMRunCommandsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + +payload := virtualmachinescalesetvmruncommands.VirtualMachineRunCommand{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + +read, err := client.Get(ctx, id, virtualmachinescalesetvmruncommands.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.List` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +// alternatively `client.List(ctx, id, virtualmachinescalesetvmruncommands.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, virtualmachinescalesetvmruncommands.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + +payload := virtualmachinescalesetvmruncommands.VirtualMachineRunCommandUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/client.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/client.go new file mode 100644 index 00000000000..fb8224b7dda --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesetvmruncommands + +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 VirtualMachineScaleSetVMRunCommandsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetVMRunCommandsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetVMRunCommandsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesetvmruncommands", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetVMRunCommandsClient: %+v", err) + } + + return &VirtualMachineScaleSetVMRunCommandsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/constants.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/constants.go new file mode 100644 index 00000000000..6c873fa29bd --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/constants.go @@ -0,0 +1,151 @@ +package virtualmachinescalesetvmruncommands + +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 ExecutionState string + +const ( + ExecutionStateCanceled ExecutionState = "Canceled" + ExecutionStateFailed ExecutionState = "Failed" + ExecutionStatePending ExecutionState = "Pending" + ExecutionStateRunning ExecutionState = "Running" + ExecutionStateSucceeded ExecutionState = "Succeeded" + ExecutionStateTimedOut ExecutionState = "TimedOut" + ExecutionStateUnknown ExecutionState = "Unknown" +) + +func PossibleValuesForExecutionState() []string { + return []string{ + string(ExecutionStateCanceled), + string(ExecutionStateFailed), + string(ExecutionStatePending), + string(ExecutionStateRunning), + string(ExecutionStateSucceeded), + string(ExecutionStateTimedOut), + string(ExecutionStateUnknown), + } +} + +func (s *ExecutionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExecutionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExecutionState(input string) (*ExecutionState, error) { + vals := map[string]ExecutionState{ + "canceled": ExecutionStateCanceled, + "failed": ExecutionStateFailed, + "pending": ExecutionStatePending, + "running": ExecutionStateRunning, + "succeeded": ExecutionStateSucceeded, + "timedout": ExecutionStateTimedOut, + "unknown": ExecutionStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExecutionState(input) + return &out, nil +} + +type ScriptShellTypes string + +const ( + ScriptShellTypesDefault ScriptShellTypes = "Default" + ScriptShellTypesPowershellSeven ScriptShellTypes = "Powershell7" +) + +func PossibleValuesForScriptShellTypes() []string { + return []string{ + string(ScriptShellTypesDefault), + string(ScriptShellTypesPowershellSeven), + } +} + +func (s *ScriptShellTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScriptShellTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseScriptShellTypes(input string) (*ScriptShellTypes, error) { + vals := map[string]ScriptShellTypes{ + "default": ScriptShellTypesDefault, + "powershell7": ScriptShellTypesPowershellSeven, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScriptShellTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go new file mode 100644 index 00000000000..5aad888a916 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go @@ -0,0 +1,139 @@ +package virtualmachinescalesetvmruncommands + +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(&VirtualMachineScaleSetVirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineId{} + +// VirtualMachineScaleSetVirtualMachineId is a struct representing the Resource ID for a Virtual Machine Scale Set Virtual Machine +type VirtualMachineScaleSetVirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string +} + +// NewVirtualMachineScaleSetVirtualMachineID returns a new VirtualMachineScaleSetVirtualMachineId struct +func NewVirtualMachineScaleSetVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string) VirtualMachineScaleSetVirtualMachineId { + return VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + } +} + +// ParseVirtualMachineScaleSetVirtualMachineID parses 'input' into a VirtualMachineScaleSetVirtualMachineId +func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetVirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID +func ValidateVirtualMachineScaleSetVirtualMachineID(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 := ParseVirtualMachineScaleSetVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + } + return fmt.Sprintf("Virtual Machine Scale Set Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine_test.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine_test.go new file mode 100644 index 00000000000..f8746c63c07 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine_test.go @@ -0,0 +1,327 @@ +package virtualmachinescalesetvmruncommands + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineId{} + +func TestNewVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + id := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } +} + +func TestFormatVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetVirtualMachineId(t *testing.T) { + segments := VirtualMachineScaleSetVirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetVirtualMachineId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go new file mode 100644 index 00000000000..447f4dcb0c2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go @@ -0,0 +1,148 @@ +package virtualmachinescalesetvmruncommands + +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(&VirtualMachineScaleSetVirtualMachineRunCommandId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineRunCommandId{} + +// VirtualMachineScaleSetVirtualMachineRunCommandId is a struct representing the Resource ID for a Virtual Machine Scale Set Virtual Machine Run Command +type VirtualMachineScaleSetVirtualMachineRunCommandId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string + RunCommandName string +} + +// NewVirtualMachineScaleSetVirtualMachineRunCommandID returns a new VirtualMachineScaleSetVirtualMachineRunCommandId struct +func NewVirtualMachineScaleSetVirtualMachineRunCommandID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string, runCommandName string) VirtualMachineScaleSetVirtualMachineRunCommandId { + return VirtualMachineScaleSetVirtualMachineRunCommandId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + RunCommandName: runCommandName, + } +} + +// ParseVirtualMachineScaleSetVirtualMachineRunCommandID parses 'input' into a VirtualMachineScaleSetVirtualMachineRunCommandId +func ParseVirtualMachineScaleSetVirtualMachineRunCommandID(input string) (*VirtualMachineScaleSetVirtualMachineRunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineRunCommandId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineRunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetVirtualMachineRunCommandId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(input string) (*VirtualMachineScaleSetVirtualMachineRunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineRunCommandId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineRunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineRunCommandId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine Run Command ID +func ValidateVirtualMachineScaleSetVirtualMachineRunCommandID(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 := ParseVirtualMachineScaleSetVirtualMachineRunCommandID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Virtual Machine Run Command ID +func (id VirtualMachineScaleSetVirtualMachineRunCommandId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s/runCommands/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId, id.RunCommandName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Virtual Machine Run Command ID +func (id VirtualMachineScaleSetVirtualMachineRunCommandId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + resourceids.StaticSegment("staticRunCommands", "runCommands", "runCommands"), + resourceids.UserSpecifiedSegment("runCommandName", "runCommandName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Virtual Machine Run Command ID +func (id VirtualMachineScaleSetVirtualMachineRunCommandId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + fmt.Sprintf("Run Command Name: %q", id.RunCommandName), + } + return fmt.Sprintf("Virtual Machine Scale Set Virtual Machine Run Command (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand_test.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand_test.go new file mode 100644 index 00000000000..e337b87a196 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand_test.go @@ -0,0 +1,372 @@ +package virtualmachinescalesetvmruncommands + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineRunCommandId{} + +func TestNewVirtualMachineScaleSetVirtualMachineRunCommandID(t *testing.T) { + id := NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } + + if id.RunCommandName != "runCommandName" { + t.Fatalf("Expected %q but got %q for Segment 'RunCommandName'", id.RunCommandName, "runCommandName") + } +} + +func TestFormatVirtualMachineScaleSetVirtualMachineRunCommandID(t *testing.T) { + actual := NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineRunCommandID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineRunCommandId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName", + Expected: &VirtualMachineScaleSetVirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + RunCommandName: "runCommandName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineRunCommandID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + if actual.RunCommandName != v.Expected.RunCommandName { + t.Fatalf("Expected %q but got %q for RunCommandName", v.Expected.RunCommandName, actual.RunCommandName) + } + + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineRunCommandId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/rUnCoMmAnDs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName", + Expected: &VirtualMachineScaleSetVirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + RunCommandName: "runCommandName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/rUnCoMmAnDs/rUnCoMmAnDnAmE", + Expected: &VirtualMachineScaleSetVirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + RunCommandName: "rUnCoMmAnDnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/rUnCoMmAnDs/rUnCoMmAnDnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + if actual.RunCommandName != v.Expected.RunCommandName { + t.Fatalf("Expected %q but got %q for RunCommandName", v.Expected.RunCommandName, actual.RunCommandName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetVirtualMachineRunCommandId(t *testing.T) { + segments := VirtualMachineScaleSetVirtualMachineRunCommandId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetVirtualMachineRunCommandId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_createorupdate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_createorupdate.go new file mode 100644 index 00000000000..b02c921d34e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetvmruncommands + +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 *VirtualMachineRunCommand +} + +// CreateOrUpdate ... +func (c VirtualMachineScaleSetVMRunCommandsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, input VirtualMachineRunCommand) (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 VirtualMachineScaleSetVMRunCommandsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, input VirtualMachineRunCommand) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_delete.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_delete.go new file mode 100644 index 00000000000..739ea1ef99a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachinescalesetvmruncommands + +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 VirtualMachineScaleSetVMRunCommandsClient) Delete(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachineScaleSetVMRunCommandsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_get.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_get.go new file mode 100644 index 00000000000..7504f816267 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvmruncommands + +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 *VirtualMachineRunCommand +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetVMRunCommandsClient) Get(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 VirtualMachineRunCommand + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_list.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_list.go new file mode 100644 index 00000000000..14ad4b942ca --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_list.go @@ -0,0 +1,134 @@ +package virtualmachinescalesetvmruncommands + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineRunCommand +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineRunCommand +} + +type ListOperationOptions struct { + Expand *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachineScaleSetVMRunCommandsClient) List(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/runCommands", 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 *[]VirtualMachineRunCommand `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetVMRunCommandsClient) ListComplete(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, VirtualMachineRunCommandOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetVMRunCommandsClient) ListCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options ListOperationOptions, predicate VirtualMachineRunCommandOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineRunCommand, 0) + + resp, err := c.List(ctx, id, options) + 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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_update.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_update.go new file mode 100644 index 00000000000..083579e6b72 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/method_update.go @@ -0,0 +1,74 @@ +package virtualmachinescalesetvmruncommands + +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 *VirtualMachineRunCommand +} + +// Update ... +func (c VirtualMachineScaleSetVMRunCommandsClient) Update(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, input VirtualMachineRunCommandUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VirtualMachineScaleSetVMRunCommandsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, input VirtualMachineRunCommandUpdate) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_instanceviewstatus.go new file mode 100644 index 00000000000..83940dc765f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachinescalesetvmruncommands + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_runcommandinputparameter.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_runcommandinputparameter.go new file mode 100644 index 00000000000..f69bb471974 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_runcommandinputparameter.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInputParameter struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_runcommandmanagedidentity.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_runcommandmanagedidentity.go new file mode 100644 index 00000000000..1cbfaf8c306 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_runcommandmanagedidentity.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandManagedIdentity struct { + ClientId *string `json:"clientId,omitempty"` + ObjectId *string `json:"objectId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommand.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommand.go new file mode 100644 index 00000000000..574a1a9be1d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommand.go @@ -0,0 +1,18 @@ +package virtualmachinescalesetvmruncommands + +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 VirtualMachineRunCommand struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandinstanceview.go new file mode 100644 index 00000000000..b2040f55f7d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandinstanceview.go @@ -0,0 +1,45 @@ +package virtualmachinescalesetvmruncommands + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandInstanceView struct { + EndTime *string `json:"endTime,omitempty"` + Error *string `json:"error,omitempty"` + ExecutionMessage *string `json:"executionMessage,omitempty"` + ExecutionState *ExecutionState `json:"executionState,omitempty"` + ExitCode *int64 `json:"exitCode,omitempty"` + Output *string `json:"output,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +func (o *VirtualMachineRunCommandInstanceView) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineRunCommandInstanceView) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *VirtualMachineRunCommandInstanceView) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineRunCommandInstanceView) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandproperties.go new file mode 100644 index 00000000000..47ffc19c5a2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandproperties.go @@ -0,0 +1,21 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandProperties struct { + AsyncExecution *bool `json:"asyncExecution,omitempty"` + ErrorBlobManagedIdentity *RunCommandManagedIdentity `json:"errorBlobManagedIdentity,omitempty"` + ErrorBlobUri *string `json:"errorBlobUri,omitempty"` + InstanceView *VirtualMachineRunCommandInstanceView `json:"instanceView,omitempty"` + OutputBlobManagedIdentity *RunCommandManagedIdentity `json:"outputBlobManagedIdentity,omitempty"` + OutputBlobUri *string `json:"outputBlobUri,omitempty"` + Parameters *[]RunCommandInputParameter `json:"parameters,omitempty"` + ProtectedParameters *[]RunCommandInputParameter `json:"protectedParameters,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + RunAsPassword *string `json:"runAsPassword,omitempty"` + RunAsUser *string `json:"runAsUser,omitempty"` + Source *VirtualMachineRunCommandScriptSource `json:"source,omitempty"` + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandscriptsource.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandscriptsource.go new file mode 100644 index 00000000000..2e58ec0e2bd --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandscriptsource.go @@ -0,0 +1,13 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandScriptSource struct { + CommandId *string `json:"commandId,omitempty"` + GalleryScriptReferenceId *string `json:"galleryScriptReferenceId,omitempty"` + Script *string `json:"script,omitempty"` + ScriptShell *ScriptShellTypes `json:"scriptShell,omitempty"` + ScriptUri *string `json:"scriptUri,omitempty"` + ScriptUriManagedIdentity *RunCommandManagedIdentity `json:"scriptUriManagedIdentity,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandupdate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandupdate.go new file mode 100644 index 00000000000..5bc80a68f4c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandupdate.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandUpdate struct { + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/predicates.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/predicates.go new file mode 100644 index 00000000000..3858937cfb3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/predicates.go @@ -0,0 +1,32 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineRunCommandOperationPredicate) Matches(input VirtualMachineRunCommand) 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/version.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/version.go new file mode 100644 index 00000000000..4b0693706e3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvmruncommands/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvmruncommands + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesetvmruncommands/2025-04-01" +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/README.md b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/README.md new file mode 100644 index 00000000000..8fda00b33dd --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/README.md @@ -0,0 +1,277 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2025-04-01/virtualmachinescalesetvms` Documentation + +The `virtualmachinescalesetvms` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2025-04-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/compute/2025-04-01/virtualmachinescalesetvms" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesetvms.NewVirtualMachineScaleSetVMsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.ApproveRollingUpgrade` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.ApproveRollingUpgradeThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.AttachDetachDataDisks` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +payload := virtualmachinescalesetvms.AttachDetachDataDisksRequest{ + // ... +} + + +if err := client.AttachDetachDataDisksThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Deallocate` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.DeallocateThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.DeleteThenPoll(ctx, id, virtualmachinescalesetvms.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.Get(ctx, id, virtualmachinescalesetvms.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.GetInstanceView` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.GetInstanceView(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.List` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +// alternatively `client.List(ctx, id, virtualmachinescalesetvms.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, virtualmachinescalesetvms.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.PerformMaintenance` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.PerformMaintenanceThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.PowerOff` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.PowerOffThenPoll(ctx, id, virtualmachinescalesetvms.DefaultPowerOffOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Redeploy` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.RedeployThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Reimage` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +payload := virtualmachinescalesetvms.VirtualMachineScaleSetVMReimageParameters{ + // ... +} + + +if err := client.ReimageThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.ReimageAll` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.ReimageAllThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Restart` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.RetrieveBootDiagnosticsData` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.RetrieveBootDiagnosticsData(ctx, id, virtualmachinescalesetvms.DefaultRetrieveBootDiagnosticsDataOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.RunCommand` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +payload := virtualmachinescalesetvms.RunCommandInput{ + // ... +} + + +if err := client.RunCommandThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.SimulateEviction` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.SimulateEviction(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Start` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +payload := virtualmachinescalesetvms.VirtualMachineScaleSetVM{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, virtualmachinescalesetvms.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/client.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/client.go new file mode 100644 index 00000000000..61a216f26bf --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesetvms + +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 VirtualMachineScaleSetVMsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetVMsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetVMsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesetvms", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetVMsClient: %+v", err) + } + + return &VirtualMachineScaleSetVMsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/constants.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/constants.go new file mode 100644 index 00000000000..9d83a546c8a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/constants.go @@ -0,0 +1,2176 @@ +package virtualmachinescalesetvms + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentName string + +const ( + ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentName = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentName() []string { + return []string{ + string(ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentName(input string) (*ComponentName, error) { + vals := map[string]ComponentName{ + "microsoft-windows-shell-setup": ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentName(input) + return &out, nil +} + +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +func PossibleValuesForDeleteOptions() []string { + return []string{ + string(DeleteOptionsDelete), + string(DeleteOptionsDetach), + } +} + +func (s *DeleteOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeleteOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeleteOptions(input string) (*DeleteOptions, error) { + vals := map[string]DeleteOptions{ + "delete": DeleteOptionsDelete, + "detach": DeleteOptionsDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeleteOptions(input) + return &out, nil +} + +type DiffDiskOptions string + +const ( + DiffDiskOptionsLocal DiffDiskOptions = "Local" +) + +func PossibleValuesForDiffDiskOptions() []string { + return []string{ + string(DiffDiskOptionsLocal), + } +} + +func (s *DiffDiskOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskOptions(input string) (*DiffDiskOptions, error) { + vals := map[string]DiffDiskOptions{ + "local": DiffDiskOptionsLocal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskOptions(input) + return &out, nil +} + +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" + DiffDiskPlacementNVMeDisk DiffDiskPlacement = "NvmeDisk" + DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" +) + +func PossibleValuesForDiffDiskPlacement() []string { + return []string{ + string(DiffDiskPlacementCacheDisk), + string(DiffDiskPlacementNVMeDisk), + string(DiffDiskPlacementResourceDisk), + } +} + +func (s *DiffDiskPlacement) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskPlacement(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) { + vals := map[string]DiffDiskPlacement{ + "cachedisk": DiffDiskPlacementCacheDisk, + "nvmedisk": DiffDiskPlacementNVMeDisk, + "resourcedisk": DiffDiskPlacementResourceDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskPlacement(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + DiskCreateOptionTypesCopy DiskCreateOptionTypes = "Copy" + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" + DiskCreateOptionTypesRestore DiskCreateOptionTypes = "Restore" +) + +func PossibleValuesForDiskCreateOptionTypes() []string { + return []string{ + string(DiskCreateOptionTypesAttach), + string(DiskCreateOptionTypesCopy), + string(DiskCreateOptionTypesEmpty), + string(DiskCreateOptionTypesFromImage), + string(DiskCreateOptionTypesRestore), + } +} + +func (s *DiskCreateOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskCreateOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskCreateOptionTypes(input string) (*DiskCreateOptionTypes, error) { + vals := map[string]DiskCreateOptionTypes{ + "attach": DiskCreateOptionTypesAttach, + "copy": DiskCreateOptionTypesCopy, + "empty": DiskCreateOptionTypesEmpty, + "fromimage": DiskCreateOptionTypesFromImage, + "restore": DiskCreateOptionTypesRestore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskCreateOptionTypes(input) + return &out, nil +} + +type DiskDeleteOptionTypes string + +const ( + DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete" + DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach" +) + +func PossibleValuesForDiskDeleteOptionTypes() []string { + return []string{ + string(DiskDeleteOptionTypesDelete), + string(DiskDeleteOptionTypesDetach), + } +} + +func (s *DiskDeleteOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDeleteOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDeleteOptionTypes(input string) (*DiskDeleteOptionTypes, error) { + vals := map[string]DiskDeleteOptionTypes{ + "delete": DiskDeleteOptionTypesDelete, + "detach": DiskDeleteOptionTypesDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDeleteOptionTypes(input) + return &out, nil +} + +type DiskDetachOptionTypes string + +const ( + DiskDetachOptionTypesForceDetach DiskDetachOptionTypes = "ForceDetach" +) + +func PossibleValuesForDiskDetachOptionTypes() []string { + return []string{ + string(DiskDetachOptionTypesForceDetach), + } +} + +func (s *DiskDetachOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDetachOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDetachOptionTypes(input string) (*DiskDetachOptionTypes, error) { + vals := map[string]DiskDetachOptionTypes{ + "forcedetach": DiskDetachOptionTypesForceDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDetachOptionTypes(input) + return &out, nil +} + +type DomainNameLabelScopeTypes string + +const ( + DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse" + DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse" + DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse" + DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse" +) + +func PossibleValuesForDomainNameLabelScopeTypes() []string { + return []string{ + string(DomainNameLabelScopeTypesNoReuse), + string(DomainNameLabelScopeTypesResourceGroupReuse), + string(DomainNameLabelScopeTypesSubscriptionReuse), + string(DomainNameLabelScopeTypesTenantReuse), + } +} + +func (s *DomainNameLabelScopeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDomainNameLabelScopeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDomainNameLabelScopeTypes(input string) (*DomainNameLabelScopeTypes, error) { + vals := map[string]DomainNameLabelScopeTypes{ + "noreuse": DomainNameLabelScopeTypesNoReuse, + "resourcegroupreuse": DomainNameLabelScopeTypesResourceGroupReuse, + "subscriptionreuse": DomainNameLabelScopeTypesSubscriptionReuse, + "tenantreuse": DomainNameLabelScopeTypesTenantReuse, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DomainNameLabelScopeTypes(input) + return &out, nil +} + +type HyperVGeneration string + +const ( + HyperVGenerationVOne HyperVGeneration = "V1" + HyperVGenerationVTwo HyperVGeneration = "V2" +) + +func PossibleValuesForHyperVGeneration() []string { + return []string{ + string(HyperVGenerationVOne), + string(HyperVGenerationVTwo), + } +} + +func (s *HyperVGeneration) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGeneration(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGeneration(input string) (*HyperVGeneration, error) { + vals := map[string]HyperVGeneration{ + "v1": HyperVGenerationVOne, + "v2": HyperVGenerationVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGeneration(input) + return &out, nil +} + +type IPVersion string + +const ( + IPVersionIPvFour IPVersion = "IPv4" + IPVersionIPvSix IPVersion = "IPv6" +) + +func PossibleValuesForIPVersion() []string { + return []string{ + string(IPVersionIPvFour), + string(IPVersionIPvSix), + } +} + +func (s *IPVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersion(input string) (*IPVersion, error) { + vals := map[string]IPVersion{ + "ipv4": IPVersionIPvFour, + "ipv6": IPVersionIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersion(input) + return &out, nil +} + +type IPVersions string + +const ( + IPVersionsIPvFour IPVersions = "IPv4" + IPVersionsIPvSix IPVersions = "IPv6" +) + +func PossibleValuesForIPVersions() []string { + return []string{ + string(IPVersionsIPvFour), + string(IPVersionsIPvSix), + } +} + +func (s *IPVersions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersions(input string) (*IPVersions, error) { + vals := map[string]IPVersions{ + "ipv4": IPVersionsIPvFour, + "ipv6": IPVersionsIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersions(input) + return &out, nil +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesResiliencyView InstanceViewTypes = "resiliencyView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesResiliencyView), + string(InstanceViewTypesUserData), + } +} + +func (s *InstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "resiliencyview": InstanceViewTypesResiliencyView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type MaintenanceOperationResultCodeTypes string + +const ( + MaintenanceOperationResultCodeTypesMaintenanceAborted MaintenanceOperationResultCodeTypes = "MaintenanceAborted" + MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted" + MaintenanceOperationResultCodeTypesNone MaintenanceOperationResultCodeTypes = "None" + MaintenanceOperationResultCodeTypesRetryLater MaintenanceOperationResultCodeTypes = "RetryLater" +) + +func PossibleValuesForMaintenanceOperationResultCodeTypes() []string { + return []string{ + string(MaintenanceOperationResultCodeTypesMaintenanceAborted), + string(MaintenanceOperationResultCodeTypesMaintenanceCompleted), + string(MaintenanceOperationResultCodeTypesNone), + string(MaintenanceOperationResultCodeTypesRetryLater), + } +} + +func (s *MaintenanceOperationResultCodeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMaintenanceOperationResultCodeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMaintenanceOperationResultCodeTypes(input string) (*MaintenanceOperationResultCodeTypes, error) { + vals := map[string]MaintenanceOperationResultCodeTypes{ + "maintenanceaborted": MaintenanceOperationResultCodeTypesMaintenanceAborted, + "maintenancecompleted": MaintenanceOperationResultCodeTypesMaintenanceCompleted, + "none": MaintenanceOperationResultCodeTypesNone, + "retrylater": MaintenanceOperationResultCodeTypesRetryLater, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MaintenanceOperationResultCodeTypes(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type NetworkApiVersion string + +const ( + NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne NetworkApiVersion = "2022-11-01" + NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne NetworkApiVersion = "2020-11-01" +) + +func PossibleValuesForNetworkApiVersion() []string { + return []string{ + string(NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne), + string(NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne), + } +} + +func (s *NetworkApiVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkApiVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkApiVersion(input string) (*NetworkApiVersion, error) { + vals := map[string]NetworkApiVersion{ + "2022-11-01": NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne, + "2020-11-01": NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkApiVersion(input) + return &out, nil +} + +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliaryMode() []string { + return []string{ + string(NetworkInterfaceAuxiliaryModeAcceleratedConnections), + string(NetworkInterfaceAuxiliaryModeFloating), + string(NetworkInterfaceAuxiliaryModeNone), + } +} + +func (s *NetworkInterfaceAuxiliaryMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliaryMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliaryMode(input string) (*NetworkInterfaceAuxiliaryMode, error) { + vals := map[string]NetworkInterfaceAuxiliaryMode{ + "acceleratedconnections": NetworkInterfaceAuxiliaryModeAcceleratedConnections, + "floating": NetworkInterfaceAuxiliaryModeFloating, + "none": NetworkInterfaceAuxiliaryModeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliaryMode(input) + return &out, nil +} + +type NetworkInterfaceAuxiliarySku string + +const ( + NetworkInterfaceAuxiliarySkuAEight NetworkInterfaceAuxiliarySku = "A8" + NetworkInterfaceAuxiliarySkuAFour NetworkInterfaceAuxiliarySku = "A4" + NetworkInterfaceAuxiliarySkuAOne NetworkInterfaceAuxiliarySku = "A1" + NetworkInterfaceAuxiliarySkuATwo NetworkInterfaceAuxiliarySku = "A2" + NetworkInterfaceAuxiliarySkuNone NetworkInterfaceAuxiliarySku = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliarySku() []string { + return []string{ + string(NetworkInterfaceAuxiliarySkuAEight), + string(NetworkInterfaceAuxiliarySkuAFour), + string(NetworkInterfaceAuxiliarySkuAOne), + string(NetworkInterfaceAuxiliarySkuATwo), + string(NetworkInterfaceAuxiliarySkuNone), + } +} + +func (s *NetworkInterfaceAuxiliarySku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliarySku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliarySku(input string) (*NetworkInterfaceAuxiliarySku, error) { + vals := map[string]NetworkInterfaceAuxiliarySku{ + "a8": NetworkInterfaceAuxiliarySkuAEight, + "a4": NetworkInterfaceAuxiliarySkuAFour, + "a1": NetworkInterfaceAuxiliarySkuAOne, + "a2": NetworkInterfaceAuxiliarySkuATwo, + "none": NetworkInterfaceAuxiliarySkuNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliarySku(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type PassName string + +const ( + PassNameOobeSystem PassName = "OobeSystem" +) + +func PossibleValuesForPassName() []string { + return []string{ + string(PassNameOobeSystem), + } +} + +func (s *PassName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassName(input string) (*PassName, error) { + vals := map[string]PassName{ + "oobesystem": PassNameOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassName(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type PublicIPAddressSkuName string + +const ( + PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" + PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" +) + +func PossibleValuesForPublicIPAddressSkuName() []string { + return []string{ + string(PublicIPAddressSkuNameBasic), + string(PublicIPAddressSkuNameStandard), + } +} + +func (s *PublicIPAddressSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuName(input string) (*PublicIPAddressSkuName, error) { + vals := map[string]PublicIPAddressSkuName{ + "basic": PublicIPAddressSkuNameBasic, + "standard": PublicIPAddressSkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuName(input) + return &out, nil +} + +type PublicIPAddressSkuTier string + +const ( + PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" + PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" +) + +func PossibleValuesForPublicIPAddressSkuTier() []string { + return []string{ + string(PublicIPAddressSkuTierGlobal), + string(PublicIPAddressSkuTierRegional), + } +} + +func (s *PublicIPAddressSkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuTier(input string) (*PublicIPAddressSkuTier, error) { + vals := map[string]PublicIPAddressSkuTier{ + "global": PublicIPAddressSkuTierGlobal, + "regional": PublicIPAddressSkuTierRegional, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuTier(input) + return &out, nil +} + +type PublicIPAllocationMethod string + +const ( + PublicIPAllocationMethodDynamic PublicIPAllocationMethod = "Dynamic" + PublicIPAllocationMethodStatic PublicIPAllocationMethod = "Static" +) + +func PossibleValuesForPublicIPAllocationMethod() []string { + return []string{ + string(PublicIPAllocationMethodDynamic), + string(PublicIPAllocationMethodStatic), + } +} + +func (s *PublicIPAllocationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAllocationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAllocationMethod(input string) (*PublicIPAllocationMethod, error) { + vals := map[string]PublicIPAllocationMethod{ + "dynamic": PublicIPAllocationMethodDynamic, + "static": PublicIPAllocationMethodStatic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAllocationMethod(input) + return &out, nil +} + +type ResilientVMDeletionStatus string + +const ( + ResilientVMDeletionStatusDisabled ResilientVMDeletionStatus = "Disabled" + ResilientVMDeletionStatusEnabled ResilientVMDeletionStatus = "Enabled" + ResilientVMDeletionStatusFailed ResilientVMDeletionStatus = "Failed" + ResilientVMDeletionStatusInProgress ResilientVMDeletionStatus = "InProgress" +) + +func PossibleValuesForResilientVMDeletionStatus() []string { + return []string{ + string(ResilientVMDeletionStatusDisabled), + string(ResilientVMDeletionStatusEnabled), + string(ResilientVMDeletionStatusFailed), + string(ResilientVMDeletionStatusInProgress), + } +} + +func (s *ResilientVMDeletionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResilientVMDeletionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResilientVMDeletionStatus(input string) (*ResilientVMDeletionStatus, error) { + vals := map[string]ResilientVMDeletionStatus{ + "disabled": ResilientVMDeletionStatusDisabled, + "enabled": ResilientVMDeletionStatusEnabled, + "failed": ResilientVMDeletionStatusFailed, + "inprogress": ResilientVMDeletionStatusInProgress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResilientVMDeletionStatus(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicAFour VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesBasicAOne VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicAThree VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicATwo VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicAZero VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesStandardAEight VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardAEightVTwo VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardAEightmVTwo VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardAFive VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardAFour VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardAFourVTwo VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardAFourmVTwo VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardANine VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardAOne VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardAOneOne VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardAOneVTwo VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardAOneZero VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardASeven VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardASix VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardAThree VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardATwo VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardATwoVTwo VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardATwomVTwo VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardAZero VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardBEightms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardBFourms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardBOnems VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardBOnes VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardBTwoms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardBTwos VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardDEightVThree VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDEightsVThree VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardDFiveVTwo VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDFour VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardDFourVThree VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardDFourVTwo VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardDFoursVThree VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardDOne VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardDOneFiveVTwo VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardDOneFour VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardDOneFourVTwo VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardDOneOne VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardDOneOneVTwo VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardDOneSixVThree VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardDOneSixsVThree VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardDOneThree VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardDOneThreeVTwo VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardDOneTwo VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardDOneTwoVTwo VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardDOneVTwo VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardDSFiveVTwo VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardDSFour VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDSFourVTwo VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDSOne VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDSOneFiveVTwo VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDSOneFour VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDSOneFourVTwo VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDSOneOne VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDSOneOneVTwo VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDSOneThree VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDSOneThreeVTwo VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDSOneTwo VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDSOneTwoVTwo VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDSOneVTwo VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDSThree VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDSThreeVTwo VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDSTwo VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDSTwoVTwo VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDSixFourVThree VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardDSixFoursVThree VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardDThree VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardDThreeTwoVThree VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardDThreeTwosVThree VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardDThreeVTwo VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardDTwo VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardDTwoVThree VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardDTwoVTwo VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardDTwosVThree VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardEEightVThree VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardEEightsVThree VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardEFourVThree VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardEFoursVThree VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardEOneSixVThree VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardEOneSixsVThree VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardESixFourVThree VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardESixFoursVThree VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardEThreeTwoVThree VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardEThreeTwosVThree VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardETwoVThree VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardETwosVThree VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardFEight VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardFEights VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardFEightsVTwo VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardFFour VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardFFours VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardFFoursVTwo VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardFOne VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardFOneSix VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardFOneSixs VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardFOneSixsVTwo VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardFOnes VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardFSevenTwosVTwo VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardFSixFoursVTwo VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardFThreeTwosVTwo VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardFTwo VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardFTwos VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardFTwosVTwo VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardGFive VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGFour VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardGOne VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardGSFive VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGSFiveNegativeEight VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardGSFiveNegativeOneSix VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGSFour VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGSFourNegativeEight VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGSFourNegativeFour VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGSOne VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGSThree VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGSTwo VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGThree VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardGTwo VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardHEight VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardHEightm VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardHOneSix VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardHOneSixm VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardHOneSixmr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardHOneSixr VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardLEights VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardLFours VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardLOneSixs VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardLThreeTwos VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardMOneTwoEightms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardMOneTwoEights VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardMSixFourms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardMSixFours VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNCOneTwo VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNCOneTwosVThree VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNCOneTwosVTwo VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNCSix VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNCSixsVThree VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardNCSixsVTwo VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNCTwoFour VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNCTwoFourr VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNCTwoFourrsVThree VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNCTwoFourrsVTwo VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNCTwoFoursVThree VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNCTwoFoursVTwo VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNDOneTwos VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardNDSixs VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNDTwoFourrs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardNDTwoFours VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardNVOneTwo VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNVSix VirtualMachineSizeTypes = "Standard_NV6" + VirtualMachineSizeTypesStandardNVTwoFour VirtualMachineSizeTypes = "Standard_NV24" +) + +func PossibleValuesForVirtualMachineSizeTypes() []string { + return []string{ + string(VirtualMachineSizeTypesBasicAFour), + string(VirtualMachineSizeTypesBasicAOne), + string(VirtualMachineSizeTypesBasicAThree), + string(VirtualMachineSizeTypesBasicATwo), + string(VirtualMachineSizeTypesBasicAZero), + string(VirtualMachineSizeTypesStandardAEight), + string(VirtualMachineSizeTypesStandardAEightVTwo), + string(VirtualMachineSizeTypesStandardAEightmVTwo), + string(VirtualMachineSizeTypesStandardAFive), + string(VirtualMachineSizeTypesStandardAFour), + string(VirtualMachineSizeTypesStandardAFourVTwo), + string(VirtualMachineSizeTypesStandardAFourmVTwo), + string(VirtualMachineSizeTypesStandardANine), + string(VirtualMachineSizeTypesStandardAOne), + string(VirtualMachineSizeTypesStandardAOneOne), + string(VirtualMachineSizeTypesStandardAOneVTwo), + string(VirtualMachineSizeTypesStandardAOneZero), + string(VirtualMachineSizeTypesStandardASeven), + string(VirtualMachineSizeTypesStandardASix), + string(VirtualMachineSizeTypesStandardAThree), + string(VirtualMachineSizeTypesStandardATwo), + string(VirtualMachineSizeTypesStandardATwoVTwo), + string(VirtualMachineSizeTypesStandardATwomVTwo), + string(VirtualMachineSizeTypesStandardAZero), + string(VirtualMachineSizeTypesStandardBEightms), + string(VirtualMachineSizeTypesStandardBFourms), + string(VirtualMachineSizeTypesStandardBOnems), + string(VirtualMachineSizeTypesStandardBOnes), + string(VirtualMachineSizeTypesStandardBTwoms), + string(VirtualMachineSizeTypesStandardBTwos), + string(VirtualMachineSizeTypesStandardDEightVThree), + string(VirtualMachineSizeTypesStandardDEightsVThree), + string(VirtualMachineSizeTypesStandardDFiveVTwo), + string(VirtualMachineSizeTypesStandardDFour), + string(VirtualMachineSizeTypesStandardDFourVThree), + string(VirtualMachineSizeTypesStandardDFourVTwo), + string(VirtualMachineSizeTypesStandardDFoursVThree), + string(VirtualMachineSizeTypesStandardDOne), + string(VirtualMachineSizeTypesStandardDOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDOneFour), + string(VirtualMachineSizeTypesStandardDOneFourVTwo), + string(VirtualMachineSizeTypesStandardDOneOne), + string(VirtualMachineSizeTypesStandardDOneOneVTwo), + string(VirtualMachineSizeTypesStandardDOneSixVThree), + string(VirtualMachineSizeTypesStandardDOneSixsVThree), + string(VirtualMachineSizeTypesStandardDOneThree), + string(VirtualMachineSizeTypesStandardDOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDOneTwo), + string(VirtualMachineSizeTypesStandardDOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDOneVTwo), + string(VirtualMachineSizeTypesStandardDSFiveVTwo), + string(VirtualMachineSizeTypesStandardDSFour), + string(VirtualMachineSizeTypesStandardDSFourVTwo), + string(VirtualMachineSizeTypesStandardDSOne), + string(VirtualMachineSizeTypesStandardDSOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDSOneFour), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneOne), + string(VirtualMachineSizeTypesStandardDSOneOneVTwo), + string(VirtualMachineSizeTypesStandardDSOneThree), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDSOneTwo), + string(VirtualMachineSizeTypesStandardDSOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneVTwo), + string(VirtualMachineSizeTypesStandardDSThree), + string(VirtualMachineSizeTypesStandardDSThreeVTwo), + string(VirtualMachineSizeTypesStandardDSTwo), + string(VirtualMachineSizeTypesStandardDSTwoVTwo), + string(VirtualMachineSizeTypesStandardDSixFourVThree), + string(VirtualMachineSizeTypesStandardDSixFoursVThree), + string(VirtualMachineSizeTypesStandardDThree), + string(VirtualMachineSizeTypesStandardDThreeTwoVThree), + string(VirtualMachineSizeTypesStandardDThreeTwosVThree), + string(VirtualMachineSizeTypesStandardDThreeVTwo), + string(VirtualMachineSizeTypesStandardDTwo), + string(VirtualMachineSizeTypesStandardDTwoVThree), + string(VirtualMachineSizeTypesStandardDTwoVTwo), + string(VirtualMachineSizeTypesStandardDTwosVThree), + string(VirtualMachineSizeTypesStandardEEightVThree), + string(VirtualMachineSizeTypesStandardEEightsVThree), + string(VirtualMachineSizeTypesStandardEFourVThree), + string(VirtualMachineSizeTypesStandardEFoursVThree), + string(VirtualMachineSizeTypesStandardEOneSixVThree), + string(VirtualMachineSizeTypesStandardEOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree), + string(VirtualMachineSizeTypesStandardESixFourVThree), + string(VirtualMachineSizeTypesStandardESixFoursVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoVThree), + string(VirtualMachineSizeTypesStandardEThreeTwosVThree), + string(VirtualMachineSizeTypesStandardETwoVThree), + string(VirtualMachineSizeTypesStandardETwosVThree), + string(VirtualMachineSizeTypesStandardFEight), + string(VirtualMachineSizeTypesStandardFEights), + string(VirtualMachineSizeTypesStandardFEightsVTwo), + string(VirtualMachineSizeTypesStandardFFour), + string(VirtualMachineSizeTypesStandardFFours), + string(VirtualMachineSizeTypesStandardFFoursVTwo), + string(VirtualMachineSizeTypesStandardFOne), + string(VirtualMachineSizeTypesStandardFOneSix), + string(VirtualMachineSizeTypesStandardFOneSixs), + string(VirtualMachineSizeTypesStandardFOneSixsVTwo), + string(VirtualMachineSizeTypesStandardFOnes), + string(VirtualMachineSizeTypesStandardFSevenTwosVTwo), + string(VirtualMachineSizeTypesStandardFSixFoursVTwo), + string(VirtualMachineSizeTypesStandardFThreeTwosVTwo), + string(VirtualMachineSizeTypesStandardFTwo), + string(VirtualMachineSizeTypesStandardFTwos), + string(VirtualMachineSizeTypesStandardFTwosVTwo), + string(VirtualMachineSizeTypesStandardGFive), + string(VirtualMachineSizeTypesStandardGFour), + string(VirtualMachineSizeTypesStandardGOne), + string(VirtualMachineSizeTypesStandardGSFive), + string(VirtualMachineSizeTypesStandardGSFiveNegativeEight), + string(VirtualMachineSizeTypesStandardGSFiveNegativeOneSix), + string(VirtualMachineSizeTypesStandardGSFour), + string(VirtualMachineSizeTypesStandardGSFourNegativeEight), + string(VirtualMachineSizeTypesStandardGSFourNegativeFour), + string(VirtualMachineSizeTypesStandardGSOne), + string(VirtualMachineSizeTypesStandardGSThree), + string(VirtualMachineSizeTypesStandardGSTwo), + string(VirtualMachineSizeTypesStandardGThree), + string(VirtualMachineSizeTypesStandardGTwo), + string(VirtualMachineSizeTypesStandardHEight), + string(VirtualMachineSizeTypesStandardHEightm), + string(VirtualMachineSizeTypesStandardHOneSix), + string(VirtualMachineSizeTypesStandardHOneSixm), + string(VirtualMachineSizeTypesStandardHOneSixmr), + string(VirtualMachineSizeTypesStandardHOneSixr), + string(VirtualMachineSizeTypesStandardLEights), + string(VirtualMachineSizeTypesStandardLFours), + string(VirtualMachineSizeTypesStandardLOneSixs), + string(VirtualMachineSizeTypesStandardLThreeTwos), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMOneTwoEightms), + string(VirtualMachineSizeTypesStandardMOneTwoEights), + string(VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms), + string(VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMSixFourms), + string(VirtualMachineSizeTypesStandardMSixFours), + string(VirtualMachineSizeTypesStandardNCOneTwo), + string(VirtualMachineSizeTypesStandardNCOneTwosVThree), + string(VirtualMachineSizeTypesStandardNCOneTwosVTwo), + string(VirtualMachineSizeTypesStandardNCSix), + string(VirtualMachineSizeTypesStandardNCSixsVThree), + string(VirtualMachineSizeTypesStandardNCSixsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFour), + string(VirtualMachineSizeTypesStandardNCTwoFourr), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVThree), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFoursVThree), + string(VirtualMachineSizeTypesStandardNCTwoFoursVTwo), + string(VirtualMachineSizeTypesStandardNDOneTwos), + string(VirtualMachineSizeTypesStandardNDSixs), + string(VirtualMachineSizeTypesStandardNDTwoFourrs), + string(VirtualMachineSizeTypesStandardNDTwoFours), + string(VirtualMachineSizeTypesStandardNVOneTwo), + string(VirtualMachineSizeTypesStandardNVSix), + string(VirtualMachineSizeTypesStandardNVTwoFour), + } +} + +func (s *VirtualMachineSizeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineSizeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineSizeTypes(input string) (*VirtualMachineSizeTypes, error) { + vals := map[string]VirtualMachineSizeTypes{ + "basic_a4": VirtualMachineSizeTypesBasicAFour, + "basic_a1": VirtualMachineSizeTypesBasicAOne, + "basic_a3": VirtualMachineSizeTypesBasicAThree, + "basic_a2": VirtualMachineSizeTypesBasicATwo, + "basic_a0": VirtualMachineSizeTypesBasicAZero, + "standard_a8": VirtualMachineSizeTypesStandardAEight, + "standard_a8_v2": VirtualMachineSizeTypesStandardAEightVTwo, + "standard_a8m_v2": VirtualMachineSizeTypesStandardAEightmVTwo, + "standard_a5": VirtualMachineSizeTypesStandardAFive, + "standard_a4": VirtualMachineSizeTypesStandardAFour, + "standard_a4_v2": VirtualMachineSizeTypesStandardAFourVTwo, + "standard_a4m_v2": VirtualMachineSizeTypesStandardAFourmVTwo, + "standard_a9": VirtualMachineSizeTypesStandardANine, + "standard_a1": VirtualMachineSizeTypesStandardAOne, + "standard_a11": VirtualMachineSizeTypesStandardAOneOne, + "standard_a1_v2": VirtualMachineSizeTypesStandardAOneVTwo, + "standard_a10": VirtualMachineSizeTypesStandardAOneZero, + "standard_a7": VirtualMachineSizeTypesStandardASeven, + "standard_a6": VirtualMachineSizeTypesStandardASix, + "standard_a3": VirtualMachineSizeTypesStandardAThree, + "standard_a2": VirtualMachineSizeTypesStandardATwo, + "standard_a2_v2": VirtualMachineSizeTypesStandardATwoVTwo, + "standard_a2m_v2": VirtualMachineSizeTypesStandardATwomVTwo, + "standard_a0": VirtualMachineSizeTypesStandardAZero, + "standard_b8ms": VirtualMachineSizeTypesStandardBEightms, + "standard_b4ms": VirtualMachineSizeTypesStandardBFourms, + "standard_b1ms": VirtualMachineSizeTypesStandardBOnems, + "standard_b1s": VirtualMachineSizeTypesStandardBOnes, + "standard_b2ms": VirtualMachineSizeTypesStandardBTwoms, + "standard_b2s": VirtualMachineSizeTypesStandardBTwos, + "standard_d8_v3": VirtualMachineSizeTypesStandardDEightVThree, + "standard_d8s_v3": VirtualMachineSizeTypesStandardDEightsVThree, + "standard_d5_v2": VirtualMachineSizeTypesStandardDFiveVTwo, + "standard_d4": VirtualMachineSizeTypesStandardDFour, + "standard_d4_v3": VirtualMachineSizeTypesStandardDFourVThree, + "standard_d4_v2": VirtualMachineSizeTypesStandardDFourVTwo, + "standard_d4s_v3": VirtualMachineSizeTypesStandardDFoursVThree, + "standard_d1": VirtualMachineSizeTypesStandardDOne, + "standard_d15_v2": VirtualMachineSizeTypesStandardDOneFiveVTwo, + "standard_d14": VirtualMachineSizeTypesStandardDOneFour, + "standard_d14_v2": VirtualMachineSizeTypesStandardDOneFourVTwo, + "standard_d11": VirtualMachineSizeTypesStandardDOneOne, + "standard_d11_v2": VirtualMachineSizeTypesStandardDOneOneVTwo, + "standard_d16_v3": VirtualMachineSizeTypesStandardDOneSixVThree, + "standard_d16s_v3": VirtualMachineSizeTypesStandardDOneSixsVThree, + "standard_d13": VirtualMachineSizeTypesStandardDOneThree, + "standard_d13_v2": VirtualMachineSizeTypesStandardDOneThreeVTwo, + "standard_d12": VirtualMachineSizeTypesStandardDOneTwo, + "standard_d12_v2": VirtualMachineSizeTypesStandardDOneTwoVTwo, + "standard_d1_v2": VirtualMachineSizeTypesStandardDOneVTwo, + "standard_ds5_v2": VirtualMachineSizeTypesStandardDSFiveVTwo, + "standard_ds4": VirtualMachineSizeTypesStandardDSFour, + "standard_ds4_v2": VirtualMachineSizeTypesStandardDSFourVTwo, + "standard_ds1": VirtualMachineSizeTypesStandardDSOne, + "standard_ds15_v2": VirtualMachineSizeTypesStandardDSOneFiveVTwo, + "standard_ds14": VirtualMachineSizeTypesStandardDSOneFour, + "standard_ds14-8_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo, + "standard_ds14-4_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo, + "standard_ds14_v2": VirtualMachineSizeTypesStandardDSOneFourVTwo, + "standard_ds11": VirtualMachineSizeTypesStandardDSOneOne, + "standard_ds11_v2": VirtualMachineSizeTypesStandardDSOneOneVTwo, + "standard_ds13": VirtualMachineSizeTypesStandardDSOneThree, + "standard_ds13-4_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo, + "standard_ds13-2_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo, + "standard_ds13_v2": VirtualMachineSizeTypesStandardDSOneThreeVTwo, + "standard_ds12": VirtualMachineSizeTypesStandardDSOneTwo, + "standard_ds12_v2": VirtualMachineSizeTypesStandardDSOneTwoVTwo, + "standard_ds1_v2": VirtualMachineSizeTypesStandardDSOneVTwo, + "standard_ds3": VirtualMachineSizeTypesStandardDSThree, + "standard_ds3_v2": VirtualMachineSizeTypesStandardDSThreeVTwo, + "standard_ds2": VirtualMachineSizeTypesStandardDSTwo, + "standard_ds2_v2": VirtualMachineSizeTypesStandardDSTwoVTwo, + "standard_d64_v3": VirtualMachineSizeTypesStandardDSixFourVThree, + "standard_d64s_v3": VirtualMachineSizeTypesStandardDSixFoursVThree, + "standard_d3": VirtualMachineSizeTypesStandardDThree, + "standard_d32_v3": VirtualMachineSizeTypesStandardDThreeTwoVThree, + "standard_d32s_v3": VirtualMachineSizeTypesStandardDThreeTwosVThree, + "standard_d3_v2": VirtualMachineSizeTypesStandardDThreeVTwo, + "standard_d2": VirtualMachineSizeTypesStandardDTwo, + "standard_d2_v3": VirtualMachineSizeTypesStandardDTwoVThree, + "standard_d2_v2": VirtualMachineSizeTypesStandardDTwoVTwo, + "standard_d2s_v3": VirtualMachineSizeTypesStandardDTwosVThree, + "standard_e8_v3": VirtualMachineSizeTypesStandardEEightVThree, + "standard_e8s_v3": VirtualMachineSizeTypesStandardEEightsVThree, + "standard_e4_v3": VirtualMachineSizeTypesStandardEFourVThree, + "standard_e4s_v3": VirtualMachineSizeTypesStandardEFoursVThree, + "standard_e16_v3": VirtualMachineSizeTypesStandardEOneSixVThree, + "standard_e16s_v3": VirtualMachineSizeTypesStandardEOneSixsVThree, + "standard_e64-16s_v3": VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree, + "standard_e64-32s_v3": VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree, + "standard_e64_v3": VirtualMachineSizeTypesStandardESixFourVThree, + "standard_e64s_v3": VirtualMachineSizeTypesStandardESixFoursVThree, + "standard_e32-8s_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree, + "standard_e32-16_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree, + "standard_e32_v3": VirtualMachineSizeTypesStandardEThreeTwoVThree, + "standard_e32s_v3": VirtualMachineSizeTypesStandardEThreeTwosVThree, + "standard_e2_v3": VirtualMachineSizeTypesStandardETwoVThree, + "standard_e2s_v3": VirtualMachineSizeTypesStandardETwosVThree, + "standard_f8": VirtualMachineSizeTypesStandardFEight, + "standard_f8s": VirtualMachineSizeTypesStandardFEights, + "standard_f8s_v2": VirtualMachineSizeTypesStandardFEightsVTwo, + "standard_f4": VirtualMachineSizeTypesStandardFFour, + "standard_f4s": VirtualMachineSizeTypesStandardFFours, + "standard_f4s_v2": VirtualMachineSizeTypesStandardFFoursVTwo, + "standard_f1": VirtualMachineSizeTypesStandardFOne, + "standard_f16": VirtualMachineSizeTypesStandardFOneSix, + "standard_f16s": VirtualMachineSizeTypesStandardFOneSixs, + "standard_f16s_v2": VirtualMachineSizeTypesStandardFOneSixsVTwo, + "standard_f1s": VirtualMachineSizeTypesStandardFOnes, + "standard_f72s_v2": VirtualMachineSizeTypesStandardFSevenTwosVTwo, + "standard_f64s_v2": VirtualMachineSizeTypesStandardFSixFoursVTwo, + "standard_f32s_v2": VirtualMachineSizeTypesStandardFThreeTwosVTwo, + "standard_f2": VirtualMachineSizeTypesStandardFTwo, + "standard_f2s": VirtualMachineSizeTypesStandardFTwos, + "standard_f2s_v2": VirtualMachineSizeTypesStandardFTwosVTwo, + "standard_g5": VirtualMachineSizeTypesStandardGFive, + "standard_g4": VirtualMachineSizeTypesStandardGFour, + "standard_g1": VirtualMachineSizeTypesStandardGOne, + "standard_gs5": VirtualMachineSizeTypesStandardGSFive, + "standard_gs5-8": VirtualMachineSizeTypesStandardGSFiveNegativeEight, + "standard_gs5-16": VirtualMachineSizeTypesStandardGSFiveNegativeOneSix, + "standard_gs4": VirtualMachineSizeTypesStandardGSFour, + "standard_gs4-8": VirtualMachineSizeTypesStandardGSFourNegativeEight, + "standard_gs4-4": VirtualMachineSizeTypesStandardGSFourNegativeFour, + "standard_gs1": VirtualMachineSizeTypesStandardGSOne, + "standard_gs3": VirtualMachineSizeTypesStandardGSThree, + "standard_gs2": VirtualMachineSizeTypesStandardGSTwo, + "standard_g3": VirtualMachineSizeTypesStandardGThree, + "standard_g2": VirtualMachineSizeTypesStandardGTwo, + "standard_h8": VirtualMachineSizeTypesStandardHEight, + "standard_h8m": VirtualMachineSizeTypesStandardHEightm, + "standard_h16": VirtualMachineSizeTypesStandardHOneSix, + "standard_h16m": VirtualMachineSizeTypesStandardHOneSixm, + "standard_h16mr": VirtualMachineSizeTypesStandardHOneSixmr, + "standard_h16r": VirtualMachineSizeTypesStandardHOneSixr, + "standard_l8s": VirtualMachineSizeTypesStandardLEights, + "standard_l4s": VirtualMachineSizeTypesStandardLFours, + "standard_l16s": VirtualMachineSizeTypesStandardLOneSixs, + "standard_l32s": VirtualMachineSizeTypesStandardLThreeTwos, + "standard_m128-64ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms, + "standard_m128-32ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms, + "standard_m128ms": VirtualMachineSizeTypesStandardMOneTwoEightms, + "standard_m128s": VirtualMachineSizeTypesStandardMOneTwoEights, + "standard_m64-16ms": VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms, + "standard_m64-32ms": VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms, + "standard_m64ms": VirtualMachineSizeTypesStandardMSixFourms, + "standard_m64s": VirtualMachineSizeTypesStandardMSixFours, + "standard_nc12": VirtualMachineSizeTypesStandardNCOneTwo, + "standard_nc12s_v3": VirtualMachineSizeTypesStandardNCOneTwosVThree, + "standard_nc12s_v2": VirtualMachineSizeTypesStandardNCOneTwosVTwo, + "standard_nc6": VirtualMachineSizeTypesStandardNCSix, + "standard_nc6s_v3": VirtualMachineSizeTypesStandardNCSixsVThree, + "standard_nc6s_v2": VirtualMachineSizeTypesStandardNCSixsVTwo, + "standard_nc24": VirtualMachineSizeTypesStandardNCTwoFour, + "standard_nc24r": VirtualMachineSizeTypesStandardNCTwoFourr, + "standard_nc24rs_v3": VirtualMachineSizeTypesStandardNCTwoFourrsVThree, + "standard_nc24rs_v2": VirtualMachineSizeTypesStandardNCTwoFourrsVTwo, + "standard_nc24s_v3": VirtualMachineSizeTypesStandardNCTwoFoursVThree, + "standard_nc24s_v2": VirtualMachineSizeTypesStandardNCTwoFoursVTwo, + "standard_nd12s": VirtualMachineSizeTypesStandardNDOneTwos, + "standard_nd6s": VirtualMachineSizeTypesStandardNDSixs, + "standard_nd24rs": VirtualMachineSizeTypesStandardNDTwoFourrs, + "standard_nd24s": VirtualMachineSizeTypesStandardNDTwoFours, + "standard_nv12": VirtualMachineSizeTypesStandardNVOneTwo, + "standard_nv6": VirtualMachineSizeTypesStandardNVSix, + "standard_nv24": VirtualMachineSizeTypesStandardNVTwoFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineSizeTypes(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go new file mode 100644 index 00000000000..4a4bde1ec78 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go @@ -0,0 +1,130 @@ +package virtualmachinescalesetvms + +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(&VirtualMachineScaleSetId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +// VirtualMachineScaleSetId is a struct representing the Resource ID for a Virtual Machine Scale Set +type VirtualMachineScaleSetId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string +} + +// NewVirtualMachineScaleSetID returns a new VirtualMachineScaleSetId struct +func NewVirtualMachineScaleSetID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string) VirtualMachineScaleSetId { + return VirtualMachineScaleSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + } +} + +// ParseVirtualMachineScaleSetID parses 'input' into a VirtualMachineScaleSetId +func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID +func ValidateVirtualMachineScaleSetID(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 := ParseVirtualMachineScaleSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + } + return fmt.Sprintf("Virtual Machine Scale Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescaleset_test.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescaleset_test.go new file mode 100644 index 00000000000..9ca34f474f3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescaleset_test.go @@ -0,0 +1,282 @@ +package virtualmachinescalesetvms + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +func TestNewVirtualMachineScaleSetID(t *testing.T) { + id := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } +} + +func TestFormatVirtualMachineScaleSetID(t *testing.T) { + actual := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestParseVirtualMachineScaleSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetId(t *testing.T) { + segments := VirtualMachineScaleSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go new file mode 100644 index 00000000000..dd2751e73ac --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go @@ -0,0 +1,139 @@ +package virtualmachinescalesetvms + +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(&VirtualMachineScaleSetVirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineId{} + +// VirtualMachineScaleSetVirtualMachineId is a struct representing the Resource ID for a Virtual Machine Scale Set Virtual Machine +type VirtualMachineScaleSetVirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string +} + +// NewVirtualMachineScaleSetVirtualMachineID returns a new VirtualMachineScaleSetVirtualMachineId struct +func NewVirtualMachineScaleSetVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string) VirtualMachineScaleSetVirtualMachineId { + return VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + } +} + +// ParseVirtualMachineScaleSetVirtualMachineID parses 'input' into a VirtualMachineScaleSetVirtualMachineId +func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetVirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID +func ValidateVirtualMachineScaleSetVirtualMachineID(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 := ParseVirtualMachineScaleSetVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + } + return fmt.Sprintf("Virtual Machine Scale Set Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine_test.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine_test.go new file mode 100644 index 00000000000..d89744aa15b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine_test.go @@ -0,0 +1,327 @@ +package virtualmachinescalesetvms + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineId{} + +func TestNewVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + id := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } +} + +func TestFormatVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetVirtualMachineId(t *testing.T) { + segments := VirtualMachineScaleSetVirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetVirtualMachineId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_approverollingupgrade.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_approverollingupgrade.go new file mode 100644 index 00000000000..c79754f4ef7 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_approverollingupgrade.go @@ -0,0 +1,69 @@ +package virtualmachinescalesetvms + +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 ApproveRollingUpgradeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApproveRollingUpgrade ... +func (c VirtualMachineScaleSetVMsClient) ApproveRollingUpgrade(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result ApproveRollingUpgradeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/approveRollingUpgrade", 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 +} + +// ApproveRollingUpgradeThenPoll performs ApproveRollingUpgrade then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) ApproveRollingUpgradeThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.ApproveRollingUpgrade(ctx, id) + if err != nil { + return fmt.Errorf("performing ApproveRollingUpgrade: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApproveRollingUpgrade: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_attachdetachdatadisks.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_attachdetachdatadisks.go new file mode 100644 index 00000000000..019181331e3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_attachdetachdatadisks.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetvms + +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 AttachDetachDataDisksOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *StorageProfile +} + +// AttachDetachDataDisks ... +func (c VirtualMachineScaleSetVMsClient) AttachDetachDataDisks(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input AttachDetachDataDisksRequest) (result AttachDetachDataDisksOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/attachDetachDataDisks", 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 +} + +// AttachDetachDataDisksThenPoll performs AttachDetachDataDisks then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) AttachDetachDataDisksThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input AttachDetachDataDisksRequest) error { + result, err := c.AttachDetachDataDisks(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AttachDetachDataDisks: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AttachDetachDataDisks: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_deallocate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_deallocate.go new file mode 100644 index 00000000000..4829c85c98a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_deallocate.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 DeallocateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Deallocate ... +func (c VirtualMachineScaleSetVMsClient) Deallocate(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result DeallocateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/deallocate", 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 +} + +// DeallocateThenPoll performs Deallocate then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) DeallocateThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.Deallocate(ctx, id) + if err != nil { + return fmt.Errorf("performing Deallocate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Deallocate: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_delete.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_delete.go new file mode 100644 index 00000000000..2c4fdb5bb39 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_delete.go @@ -0,0 +1,100 @@ +package virtualmachinescalesetvms + +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 +} + +type DeleteOperationOptions struct { + ForceDeletion *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ForceDeletion != nil { + out.Append("forceDeletion", fmt.Sprintf("%v", *o.ForceDeletion)) + } + return &out +} + +// Delete ... +func (c VirtualMachineScaleSetVMsClient) Delete(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + OptionsObject: options, + 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 VirtualMachineScaleSetVMsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_get.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_get.go new file mode 100644 index 00000000000..48056f0eab3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvms + +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 *VirtualMachineScaleSetVM +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetVMsClient) Get(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + 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 VirtualMachineScaleSetVM + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_getinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_getinstanceview.go new file mode 100644 index 00000000000..d2e27a1295d --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_getinstanceview.go @@ -0,0 +1,54 @@ +package virtualmachinescalesetvms + +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 GetInstanceViewOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetVMInstanceView +} + +// GetInstanceView ... +func (c VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result GetInstanceViewOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/instanceView", 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 VirtualMachineScaleSetVMInstanceView + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_list.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_list.go new file mode 100644 index 00000000000..bb09ed5d71a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_list.go @@ -0,0 +1,142 @@ +package virtualmachinescalesetvms + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSetVM +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSetVM +} + +type ListOperationOptions struct { + Expand *string + Filter *string + Select *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Select != nil { + out.Append("$select", fmt.Sprintf("%v", *o.Select)) + } + return &out +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachineScaleSetVMsClient) List(ctx context.Context, id VirtualMachineScaleSetId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/virtualMachines", 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 *[]VirtualMachineScaleSetVM `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetVMsClient) ListComplete(ctx context.Context, id VirtualMachineScaleSetId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, VirtualMachineScaleSetVMOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetVMsClient) ListCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetId, options ListOperationOptions, predicate VirtualMachineScaleSetVMOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineScaleSetVM, 0) + + resp, err := c.List(ctx, id, options) + 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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_performmaintenance.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_performmaintenance.go new file mode 100644 index 00000000000..ca5dce7234a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_performmaintenance.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 PerformMaintenanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PerformMaintenance ... +func (c VirtualMachineScaleSetVMsClient) PerformMaintenance(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result PerformMaintenanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/performMaintenance", 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 +} + +// PerformMaintenanceThenPoll performs PerformMaintenance then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) PerformMaintenanceThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.PerformMaintenance(ctx, id) + if err != nil { + return fmt.Errorf("performing PerformMaintenance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PerformMaintenance: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_poweroff.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_poweroff.go new file mode 100644 index 00000000000..de17bf3550b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_poweroff.go @@ -0,0 +1,99 @@ +package virtualmachinescalesetvms + +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 PowerOffOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type PowerOffOperationOptions struct { + SkipShutdown *bool +} + +func DefaultPowerOffOperationOptions() PowerOffOperationOptions { + return PowerOffOperationOptions{} +} + +func (o PowerOffOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o PowerOffOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o PowerOffOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SkipShutdown != nil { + out.Append("skipShutdown", fmt.Sprintf("%v", *o.SkipShutdown)) + } + return &out +} + +// PowerOff ... +func (c VirtualMachineScaleSetVMsClient) PowerOff(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options PowerOffOperationOptions) (result PowerOffOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/powerOff", 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 +} + +// PowerOffThenPoll performs PowerOff then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) PowerOffThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options PowerOffOperationOptions) error { + result, err := c.PowerOff(ctx, id, options) + if err != nil { + return fmt.Errorf("performing PowerOff: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PowerOff: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_redeploy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_redeploy.go new file mode 100644 index 00000000000..2d129ba42a1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_redeploy.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 RedeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Redeploy ... +func (c VirtualMachineScaleSetVMsClient) Redeploy(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result RedeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/redeploy", 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 +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) RedeployThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.Redeploy(ctx, id) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_reimage.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_reimage.go new file mode 100644 index 00000000000..8ea94bc4004 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_reimage.go @@ -0,0 +1,74 @@ +package virtualmachinescalesetvms + +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 ReimageOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reimage ... +func (c VirtualMachineScaleSetVMsClient) Reimage(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input VirtualMachineScaleSetVMReimageParameters) (result ReimageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimage", 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 +} + +// ReimageThenPoll performs Reimage then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) ReimageThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input VirtualMachineScaleSetVMReimageParameters) error { + result, err := c.Reimage(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Reimage: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reimage: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_reimageall.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_reimageall.go new file mode 100644 index 00000000000..e09dc08aa1b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_reimageall.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 ReimageAllOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ReimageAll ... +func (c VirtualMachineScaleSetVMsClient) ReimageAll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result ReimageAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimageall", 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 +} + +// ReimageAllThenPoll performs ReimageAll then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) ReimageAllThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.ReimageAll(ctx, id) + if err != nil { + return fmt.Errorf("performing ReimageAll: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ReimageAll: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_restart.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_restart.go new file mode 100644 index 00000000000..3abf763049f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_restart.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c VirtualMachineScaleSetVMsClient) Restart(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) RestartThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.Restart(ctx, id) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_retrievebootdiagnosticsdata.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_retrievebootdiagnosticsdata.go new file mode 100644 index 00000000000..a93248b3042 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_retrievebootdiagnosticsdata.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvms + +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 RetrieveBootDiagnosticsDataOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RetrieveBootDiagnosticsDataResult +} + +type RetrieveBootDiagnosticsDataOperationOptions struct { + SasUriExpirationTimeInMinutes *int64 +} + +func DefaultRetrieveBootDiagnosticsDataOperationOptions() RetrieveBootDiagnosticsDataOperationOptions { + return RetrieveBootDiagnosticsDataOperationOptions{} +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SasUriExpirationTimeInMinutes != nil { + out.Append("sasUriExpirationTimeInMinutes", fmt.Sprintf("%v", *o.SasUriExpirationTimeInMinutes)) + } + return &out +} + +// RetrieveBootDiagnosticsData ... +func (c VirtualMachineScaleSetVMsClient) RetrieveBootDiagnosticsData(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options RetrieveBootDiagnosticsDataOperationOptions) (result RetrieveBootDiagnosticsDataOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/retrieveBootDiagnosticsData", 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 RetrieveBootDiagnosticsDataResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_runcommand.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_runcommand.go new file mode 100644 index 00000000000..909ab91e4b2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_runcommand.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetvms + +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 RunCommandOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// RunCommand ... +func (c VirtualMachineScaleSetVMsClient) RunCommand(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input RunCommandInput) (result RunCommandOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/runCommand", 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 +} + +// RunCommandThenPoll performs RunCommand then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) RunCommandThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input RunCommandInput) error { + result, err := c.RunCommand(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RunCommand: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RunCommand: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_simulateeviction.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_simulateeviction.go new file mode 100644 index 00000000000..f5099b02f8f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_simulateeviction.go @@ -0,0 +1,47 @@ +package virtualmachinescalesetvms + +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 SimulateEvictionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// SimulateEviction ... +func (c VirtualMachineScaleSetVMsClient) SimulateEviction(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result SimulateEvictionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/simulateEviction", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_start.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_start.go new file mode 100644 index 00000000000..f7181a07733 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_start.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c VirtualMachineScaleSetVMsClient) Start(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StartThenPoll performs Start then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) StartThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_update.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_update.go new file mode 100644 index 00000000000..e08fda7ace4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/method_update.go @@ -0,0 +1,108 @@ +package virtualmachinescalesetvms + +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 *VirtualMachineScaleSetVM +} + +type UpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c VirtualMachineScaleSetVMsClient) Update(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input VirtualMachineScaleSetVM, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + OptionsObject: options, + 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 VirtualMachineScaleSetVMsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input VirtualMachineScaleSetVM, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_additionalcapabilities.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_additionalcapabilities.go new file mode 100644 index 00000000000..032cbde9ace --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_additionalcapabilities.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalCapabilities struct { + EnableFips1403Encryption *bool `json:"enableFips1403Encryption,omitempty"` + HibernationEnabled *bool `json:"hibernationEnabled,omitempty"` + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_additionalunattendcontent.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_additionalunattendcontent.go new file mode 100644 index 00000000000..418c91dd60a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentName `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassName `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_apientityreference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_apientityreference.go new file mode 100644 index 00000000000..83c85311d72 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_apientityreference.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_attachdetachdatadisksrequest.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_attachdetachdatadisksrequest.go new file mode 100644 index 00000000000..9b561c4f1d1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_attachdetachdatadisksrequest.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachDetachDataDisksRequest struct { + DataDisksToAttach *[]DataDisksToAttach `json:"dataDisksToAttach,omitempty"` + DataDisksToDetach *[]DataDisksToDetach `json:"dataDisksToDetach,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_bootdiagnostics.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_bootdiagnostics.go new file mode 100644 index 00000000000..1c1457f479b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_bootdiagnosticsinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_bootdiagnosticsinstanceview.go new file mode 100644 index 00000000000..627078c9cc9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_bootdiagnosticsinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnosticsInstanceView struct { + ConsoleScreenshotBlobUri *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobUri *string `json:"serialConsoleLogBlobUri,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_datadisk.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_datadisk.go new file mode 100644 index 00000000000..074ea20b167 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_datadisk.go @@ -0,0 +1,22 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + SourceResource *ApiEntityReference `json:"sourceResource,omitempty"` + ToBeDetached *bool `json:"toBeDetached,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_datadiskstoattach.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_datadiskstoattach.go new file mode 100644 index 00000000000..35fdfa1e437 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_datadiskstoattach.go @@ -0,0 +1,13 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisksToAttach struct { + Caching *CachingTypes `json:"caching,omitempty"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + DiskId string `json:"diskId"` + Lun *int64 `json:"lun,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_datadiskstodetach.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_datadiskstodetach.go new file mode 100644 index 00000000000..d283d93ab0c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_datadiskstodetach.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisksToDetach struct { + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + DiskId string `json:"diskId"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diagnosticsprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diagnosticsprofile.go new file mode 100644 index 00000000000..c7a95be33d0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diffdisksettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diffdisksettings.go new file mode 100644 index 00000000000..a80fc6b1d1c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diffdisksettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiffDiskSettings struct { + Option *DiffDiskOptions `json:"option,omitempty"` + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diskencryptionsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diskencryptionsettings.go new file mode 100644 index 00000000000..30f62f12488 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diskencryptionsettings.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diskinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diskinstanceview.go new file mode 100644 index 00000000000..efb5f5ed94a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_diskinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskInstanceView struct { + EncryptionSettings *[]DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_encryptionidentity.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_encryptionidentity.go new file mode 100644 index 00000000000..5371893ebbe --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionIdentity struct { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_hardwareprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_hardwareprofile.go new file mode 100644 index 00000000000..36b7827df42 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_hardwareprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_hostendpointsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_hostendpointsettings.go new file mode 100644 index 00000000000..eee18be4ae6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_imagereference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_imagereference.go new file mode 100644 index 00000000000..9e8a7c31109 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_imagereference.go @@ -0,0 +1,15 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + CommunityGalleryImageId *string `json:"communityGalleryImageId,omitempty"` + ExactVersion *string `json:"exactVersion,omitempty"` + Id *string `json:"id,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + SharedGalleryImageId *string `json:"sharedGalleryImageId,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_instanceviewstatus.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_instanceviewstatus.go new file mode 100644 index 00000000000..e23c59c9420 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachinescalesetvms + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_keyvaultkeyreference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_keyvaultkeyreference.go new file mode 100644 index 00000000000..641c4d6cecc --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_keyvaultkeyreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyURL string `json:"keyUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_keyvaultsecretreference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..102c8c99c7f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_linuxconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_linuxconfiguration.go new file mode 100644 index 00000000000..b42a4e859db --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_linuxpatchsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_linuxpatchsettings.go new file mode 100644 index 00000000000..f9e09edf6aa --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..7e71a925499 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_maintenanceredeploystatus.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_maintenanceredeploystatus.go new file mode 100644 index 00000000000..3bd82eab939 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_maintenanceredeploystatus.go @@ -0,0 +1,68 @@ +package virtualmachinescalesetvms + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceRedeployStatus struct { + IsCustomerInitiatedMaintenanceAllowed *bool `json:"isCustomerInitiatedMaintenanceAllowed,omitempty"` + LastOperationMessage *string `json:"lastOperationMessage,omitempty"` + LastOperationResultCode *MaintenanceOperationResultCodeTypes `json:"lastOperationResultCode,omitempty"` + MaintenanceWindowEndTime *string `json:"maintenanceWindowEndTime,omitempty"` + MaintenanceWindowStartTime *string `json:"maintenanceWindowStartTime,omitempty"` + PreMaintenanceWindowEndTime *string `json:"preMaintenanceWindowEndTime,omitempty"` + PreMaintenanceWindowStartTime *string `json:"preMaintenanceWindowStartTime,omitempty"` +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowStartTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowStartTime = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_manageddiskparameters.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_manageddiskparameters.go new file mode 100644 index 00000000000..0a2e47fead5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_manageddiskparameters.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Id *string `json:"id,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_networkinterfacereference.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_networkinterfacereference.go new file mode 100644 index 00000000000..dd4f67b9365 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_networkinterfacereference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReference struct { + Id *string `json:"id,omitempty"` + Properties *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_networkinterfacereferenceproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_networkinterfacereferenceproperties.go new file mode 100644 index 00000000000..a01e731baf3 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_networkinterfacereferenceproperties.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReferenceProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_networkprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_networkprofile.go new file mode 100644 index 00000000000..9bef9b0b18a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_networkprofile.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineNetworkInterfaceConfiguration `json:"networkInterfaceConfigurations,omitempty"` + NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_osdisk.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_osdisk.go new file mode 100644 index 00000000000..273c553709f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_osdisk.go @@ -0,0 +1,19 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemTypes `json:"osType,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_osprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_osprofile.go new file mode 100644 index 00000000000..a32e556050e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_osprofile.go @@ -0,0 +1,16 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_osprofileprovisioningdata.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_osprofileprovisioningdata.go new file mode 100644 index 00000000000..d6c035d4d02 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_osprofileprovisioningdata.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfileProvisioningData struct { + AdminPassword *string `json:"adminPassword,omitempty"` + CustomData *string `json:"customData,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_patchsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_patchsettings.go new file mode 100644 index 00000000000..c9a3f5ddcff --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_patchsettings.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_plan.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_plan.go new file mode 100644 index 00000000000..f39cc115a50 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_plan.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher *string `json:"publisher,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_proxyagentsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_proxyagentsettings.go new file mode 100644 index 00000000000..05c46fbcf14 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_proxyagentsettings.go @@ -0,0 +1,13 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + AddProxyAgentExtension *bool `json:"addProxyAgentExtension,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_publicipaddresssku.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_publicipaddresssku.go new file mode 100644 index 00000000000..9638bdf2343 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_publicipaddresssku.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicIPAddressSku struct { + Name *PublicIPAddressSkuName `json:"name,omitempty"` + Tier *PublicIPAddressSkuTier `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_retrievebootdiagnosticsdataresult.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_retrievebootdiagnosticsdataresult.go new file mode 100644 index 00000000000..16155960aa8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_retrievebootdiagnosticsdataresult.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetrieveBootDiagnosticsDataResult struct { + ConsoleScreenshotBlobUri *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobUri *string `json:"serialConsoleLogBlobUri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_runcommandinput.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_runcommandinput.go new file mode 100644 index 00000000000..aff992d6555 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_runcommandinput.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInput struct { + CommandId string `json:"commandId"` + Parameters *[]RunCommandInputParameter `json:"parameters,omitempty"` + Script *[]string `json:"script,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_runcommandinputparameter.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_runcommandinputparameter.go new file mode 100644 index 00000000000..765f694dad8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_runcommandinputparameter.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInputParameter struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_runcommandresult.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_runcommandresult.go new file mode 100644 index 00000000000..3257f1d24ea --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_runcommandresult.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandResult struct { + Value *[]InstanceViewStatus `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_securityprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_securityprofile.go new file mode 100644 index 00000000000..98ecfc14bae --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_securityprofile.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_sku.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_sku.go new file mode 100644 index 00000000000..56ffeb02351 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_sku.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_sshconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_sshconfiguration.go new file mode 100644 index 00000000000..ad663dc27a5 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_sshpublickey.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_sshpublickey.go new file mode 100644 index 00000000000..a12747a16a1 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_sshpublickey.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_storageprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_storageprofile.go new file mode 100644 index 00000000000..d6a13bd454b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_storageprofile.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + AlignRegionalDisksToVMZone *bool `json:"alignRegionalDisksToVMZone,omitempty"` + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *OSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_subresource.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_subresource.go new file mode 100644 index 00000000000..f4b0318fae2 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_uefisettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_uefisettings.go new file mode 100644 index 00000000000..8ccb5e8b347 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_uefisettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vaultcertificate.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vaultcertificate.go new file mode 100644 index 00000000000..2ed3161f67c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vaultsecretgroup.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vaultsecretgroup.go new file mode 100644 index 00000000000..3bf566e1cd9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualharddisk.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualharddisk.go new file mode 100644 index 00000000000..19ee527a834 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualharddisk.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualHardDisk struct { + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineagentinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineagentinstanceview.go new file mode 100644 index 00000000000..ed66c1c262a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineagentinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineAgentInstanceView struct { + ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgentVersion *string `json:"vmAgentVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextension.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextension.go new file mode 100644 index 00000000000..cf06607c080 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextension.go @@ -0,0 +1,18 @@ +package virtualmachinescalesetvms + +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 VirtualMachineExtension struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextensionhandlerinstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextensionhandlerinstanceview.go new file mode 100644 index 00000000000..a93b7688695 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextensionhandlerinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionHandlerInstanceView struct { + Status *InstanceViewStatus `json:"status,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextensioninstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextensioninstanceview.go new file mode 100644 index 00000000000..29c45a23015 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextensioninstanceview.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextensionproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextensionproperties.go new file mode 100644 index 00000000000..1e775fc8f7c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineextensionproperties.go @@ -0,0 +1,20 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinehealthstatus.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinehealthstatus.go new file mode 100644 index 00000000000..0d02495ead9 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinehealthstatus.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineHealthStatus struct { + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineiptag.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineiptag.go new file mode 100644 index 00000000000..92f99c38f79 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachineiptag.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfiguration.go new file mode 100644 index 00000000000..b956e84b8fe --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceConfigurationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfigurationproperties.go new file mode 100644 index 00000000000..38d20fa62c8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfigurationproperties.go @@ -0,0 +1,19 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineNetworkInterfaceDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineNetworkInterfaceIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfacednssettingsconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfacednssettingsconfiguration.go new file mode 100644 index 00000000000..10e54ac9a50 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfacednssettingsconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceDnsSettingsConfiguration struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfiguration.go new file mode 100644 index 00000000000..ffe7773f136 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfigurationproperties.go new file mode 100644 index 00000000000..8a4ccd9b07e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfigurationproperties.go @@ -0,0 +1,14 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersions `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachinePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *SubResource `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfiguration.go new file mode 100644 index 00000000000..59f547acd2a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfiguration.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachinePublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..668109748fc --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfigurationproperties.go @@ -0,0 +1,14 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachinePublicIPAddressDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersions `json:"publicIPAddressVersion,omitempty"` + PublicIPAllocationMethod *PublicIPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressdnssettingsconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressdnssettingsconfiguration.go new file mode 100644 index 00000000000..18a20a7ae89 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressdnssettingsconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressDnsSettingsConfiguration struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfiguration.go new file mode 100644 index 00000000000..84c3d9ad8c0 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfigurationproperties.go new file mode 100644 index 00000000000..55274c9b4c4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfigurationproperties.go @@ -0,0 +1,15 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *ApiEntityReference `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetiptag.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetiptag.go new file mode 100644 index 00000000000..964b748cbde --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetiptag.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfiguration.go new file mode 100644 index 00000000000..f3b6934419f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationdnssettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationdnssettings.go new file mode 100644 index 00000000000..18ed5c06142 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationdnssettings.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationDnsSettings struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationproperties.go new file mode 100644 index 00000000000..a4ed65755c4 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationproperties.go @@ -0,0 +1,18 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings `json:"dnsSettings,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfiguration.go new file mode 100644 index 00000000000..d0c2c33c2be --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfiguration.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetPublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go new file mode 100644 index 00000000000..850e2fe1b82 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..71fb301655f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go @@ -0,0 +1,13 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineScaleSetIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvm.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvm.go new file mode 100644 index 00000000000..5e69030ad0f --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvm.go @@ -0,0 +1,27 @@ +package virtualmachinescalesetvms + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVM struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + InstanceId *string `json:"instanceId,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvminstanceview.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvminstanceview.go new file mode 100644 index 00000000000..541bc2d91a6 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvminstanceview.go @@ -0,0 +1,23 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMInstanceView struct { + AssignedHost *string `json:"assignedHost,omitempty"` + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + Disks *[]DiskInstanceView `json:"disks,omitempty"` + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + HyperVGeneration *HyperVGeneration `json:"hyperVGeneration,omitempty"` + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + OsName *string `json:"osName,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + PlacementGroupId *string `json:"placementGroupId,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + PlatformUpdateDomain *int64 `json:"platformUpdateDomain,omitempty"` + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmnetworkprofileconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmnetworkprofileconfiguration.go new file mode 100644 index 00000000000..40865049b2e --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmnetworkprofileconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMNetworkProfileConfiguration struct { + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmproperties.go new file mode 100644 index 00000000000..387cfc26f36 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmproperties.go @@ -0,0 +1,44 @@ +package virtualmachinescalesetvms + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + InstanceView *VirtualMachineScaleSetVMInstanceView `json:"instanceView,omitempty"` + LatestModelApplied *bool `json:"latestModelApplied,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + ModelDefinitionApplied *string `json:"modelDefinitionApplied,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + NetworkProfileConfiguration *VirtualMachineScaleSetVMNetworkProfileConfiguration `json:"networkProfileConfiguration,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + ProtectionPolicy *VirtualMachineScaleSetVMProtectionPolicy `json:"protectionPolicy,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ResilientVMDeletionStatus *ResilientVMDeletionStatus `json:"resilientVMDeletionStatus,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UserData *string `json:"userData,omitempty"` + VMId *string `json:"vmId,omitempty"` +} + +func (o *VirtualMachineScaleSetVMProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineScaleSetVMProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmprotectionpolicy.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmprotectionpolicy.go new file mode 100644 index 00000000000..b3bd8c52f2a --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmprotectionpolicy.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMProtectionPolicy struct { + ProtectFromScaleIn *bool `json:"protectFromScaleIn,omitempty"` + ProtectFromScaleSetActions *bool `json:"protectFromScaleSetActions,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmreimageparameters.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmreimageparameters.go new file mode 100644 index 00000000000..1b7bf9d3146 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmreimageparameters.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMReimageParameters struct { + ExactVersion *string `json:"exactVersion,omitempty"` + ForceUpdateOSDiskForEphemeral *bool `json:"forceUpdateOSDiskForEphemeral,omitempty"` + OsProfile *OSProfileProvisioningData `json:"osProfile,omitempty"` + TempDisk *bool `json:"tempDisk,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vmdisksecurityprofile.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..fb043c2e835 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vmsizeproperties.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vmsizeproperties.go new file mode 100644 index 00000000000..467974e02e8 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_windowsconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_windowsconfiguration.go new file mode 100644 index 00000000000..67edc81cb90 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..47e77a5679c --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_winrmconfiguration.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_winrmconfiguration.go new file mode 100644 index 00000000000..c8f4edf8678 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_winrmlistener.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_winrmlistener.go new file mode 100644 index 00000000000..59cdd2f5c0b --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/model_winrmlistener.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/predicates.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/predicates.go new file mode 100644 index 00000000000..f5a573a7400 --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/predicates.go @@ -0,0 +1,42 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMOperationPredicate struct { + Etag *string + Id *string + InstanceId *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineScaleSetVMOperationPredicate) Matches(input VirtualMachineScaleSetVM) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.InstanceId != nil && (input.InstanceId == nil || *p.InstanceId != *input.InstanceId) { + 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/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/version.go b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/version.go new file mode 100644 index 00000000000..3ffcc75d1bb --- /dev/null +++ b/resource-manager/compute/2025-04-01/virtualmachinescalesetvms/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// 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-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesetvms/2025-04-01" +} diff --git a/resource-manager/containerinstance/2025-09-01/client.go b/resource-manager/containerinstance/2025-09-01/client.go new file mode 100644 index 00000000000..7d199b48a5b --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/client.go @@ -0,0 +1,28 @@ +package v2025_09_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2025-09-01/containerinstance" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + ContainerInstance *containerinstance.ContainerInstanceClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + containerInstanceClient, err := containerinstance.NewContainerInstanceClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ContainerInstance client: %+v", err) + } + configureFunc(containerInstanceClient.Client) + + return &Client{ + ContainerInstance: containerInstanceClient, + }, nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/README.md b/resource-manager/containerinstance/2025-09-01/containerinstance/README.md new file mode 100644 index 00000000000..e1e1267e4ca --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/README.md @@ -0,0 +1,569 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2025-09-01/containerinstance` Documentation + +The `containerinstance` SDK allows for interaction with Azure Resource Manager `containerinstance` (API Version `2025-09-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/containerinstance/2025-09-01/containerinstance" +``` + + +### Client Initialization + +```go +client := containerinstance.NewContainerInstanceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ContainerInstanceClient.CGProfileCreateOrUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName") + +payload := containerinstance.ContainerGroupProfile{ + // ... +} + + +read, err := client.CGProfileCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.CGProfileDelete` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName") + +read, err := client.CGProfileDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.CGProfileGet` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName") + +read, err := client.CGProfileGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.CGProfileGetByRevisionNumber` + +```go +ctx := context.TODO() +id := containerinstance.NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName", "revisionName") + +read, err := client.CGProfileGetByRevisionNumber(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.CGProfileListAllRevisions` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName") + +// alternatively `client.CGProfileListAllRevisions(ctx, id)` can be used to do batched pagination +items, err := client.CGProfileListAllRevisionsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.CGProfileUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName") + +payload := containerinstance.ContainerGroupProfilePatch{ + // ... +} + + +read, err := client.CGProfileUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.CGProfilesListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.CGProfilesListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.CGProfilesListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.CGProfilesListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.CGProfilesListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.CGProfilesListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsCreateOrUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName") + +payload := containerinstance.ContainerGroup{ + // ... +} + + +if err := client.ContainerGroupsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsDelete` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName") + +if err := client.ContainerGroupsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsGet` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName") + +read, err := client.ContainerGroupsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsGetOutboundNetworkDependenciesEndpoints` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName") + +read, err := client.ContainerGroupsGetOutboundNetworkDependenciesEndpoints(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsList` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ContainerGroupsList(ctx, id)` can be used to do batched pagination +items, err := client.ContainerGroupsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ContainerGroupsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ContainerGroupsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsRestart` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName") + +if err := client.ContainerGroupsRestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsStart` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName") + +if err := client.ContainerGroupsStartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsStop` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName") + +read, err := client.ContainerGroupsStop(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName") + +payload := containerinstance.Resource{ + // ... +} + + +read, err := client.ContainerGroupsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainersAttach` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName", "containerName") + +read, err := client.ContainersAttach(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainersExecuteCommand` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName", "containerName") + +payload := containerinstance.ContainerExecRequest{ + // ... +} + + +read, err := client.ContainersExecuteCommand(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainersListLogs` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName", "containerName") + +read, err := client.ContainersListLogs(ctx, id, containerinstance.DefaultContainersListLogsOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.LocationListCachedImages` + +```go +ctx := context.TODO() +id := containerinstance.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.LocationListCachedImages(ctx, id)` can be used to do batched pagination +items, err := client.LocationListCachedImagesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.LocationListCapabilities` + +```go +ctx := context.TODO() +id := containerinstance.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.LocationListCapabilities(ctx, id)` can be used to do batched pagination +items, err := client.LocationListCapabilitiesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.LocationListUsage` + +```go +ctx := context.TODO() +id := containerinstance.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +read, err := client.LocationListUsage(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.NGroupsCreateOrUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewNgroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ngroupName") + +payload := containerinstance.NGroup{ + // ... +} + + +if err := client.NGroupsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.NGroupsDelete` + +```go +ctx := context.TODO() +id := containerinstance.NewNgroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ngroupName") + +if err := client.NGroupsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.NGroupsGet` + +```go +ctx := context.TODO() +id := containerinstance.NewNgroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ngroupName") + +read, err := client.NGroupsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.NGroupsList` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.NGroupsList(ctx, id)` can be used to do batched pagination +items, err := client.NGroupsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.NGroupsListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.NGroupsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.NGroupsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.NGroupsRestart` + +```go +ctx := context.TODO() +id := containerinstance.NewNgroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ngroupName") + +if err := client.NGroupsRestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.NGroupsStart` + +```go +ctx := context.TODO() +id := containerinstance.NewNgroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ngroupName") + +if err := client.NGroupsStartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.NGroupsStop` + +```go +ctx := context.TODO() +id := containerinstance.NewNgroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ngroupName") + +read, err := client.NGroupsStop(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.NGroupsUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewNgroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ngroupName") + +payload := containerinstance.NGroupPatch{ + // ... +} + + +if err := client.NGroupsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.SubnetServiceAssociationLinkDelete` + +```go +ctx := context.TODO() +id := commonids.NewSubnetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkName", "subnetName") + +if err := client.SubnetServiceAssociationLinkDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/client.go b/resource-manager/containerinstance/2025-09-01/containerinstance/client.go new file mode 100644 index 00000000000..9e2dd14ce18 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/client.go @@ -0,0 +1,26 @@ +package containerinstance + +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 ContainerInstanceClient struct { + Client *resourcemanager.Client +} + +func NewContainerInstanceClientWithBaseURI(sdkApi sdkEnv.Api) (*ContainerInstanceClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "containerinstance", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ContainerInstanceClient: %+v", err) + } + + return &ContainerInstanceClient{ + Client: client, + }, nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/constants.go b/resource-manager/containerinstance/2025-09-01/containerinstance/constants.go new file mode 100644 index 00000000000..8ab90587ba8 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/constants.go @@ -0,0 +1,826 @@ +package containerinstance + +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 AzureFileShareAccessTier string + +const ( + AzureFileShareAccessTierCool AzureFileShareAccessTier = "Cool" + AzureFileShareAccessTierHot AzureFileShareAccessTier = "Hot" + AzureFileShareAccessTierPremium AzureFileShareAccessTier = "Premium" + AzureFileShareAccessTierTransactionOptimized AzureFileShareAccessTier = "TransactionOptimized" +) + +func PossibleValuesForAzureFileShareAccessTier() []string { + return []string{ + string(AzureFileShareAccessTierCool), + string(AzureFileShareAccessTierHot), + string(AzureFileShareAccessTierPremium), + string(AzureFileShareAccessTierTransactionOptimized), + } +} + +func (s *AzureFileShareAccessTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureFileShareAccessTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureFileShareAccessTier(input string) (*AzureFileShareAccessTier, error) { + vals := map[string]AzureFileShareAccessTier{ + "cool": AzureFileShareAccessTierCool, + "hot": AzureFileShareAccessTierHot, + "premium": AzureFileShareAccessTierPremium, + "transactionoptimized": AzureFileShareAccessTierTransactionOptimized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureFileShareAccessTier(input) + return &out, nil +} + +type AzureFileShareAccessType string + +const ( + AzureFileShareAccessTypeExclusive AzureFileShareAccessType = "Exclusive" + AzureFileShareAccessTypeShared AzureFileShareAccessType = "Shared" +) + +func PossibleValuesForAzureFileShareAccessType() []string { + return []string{ + string(AzureFileShareAccessTypeExclusive), + string(AzureFileShareAccessTypeShared), + } +} + +func (s *AzureFileShareAccessType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureFileShareAccessType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureFileShareAccessType(input string) (*AzureFileShareAccessType, error) { + vals := map[string]AzureFileShareAccessType{ + "exclusive": AzureFileShareAccessTypeExclusive, + "shared": AzureFileShareAccessTypeShared, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureFileShareAccessType(input) + return &out, nil +} + +type ContainerGroupIPAddressType string + +const ( + ContainerGroupIPAddressTypePrivate ContainerGroupIPAddressType = "Private" + ContainerGroupIPAddressTypePublic ContainerGroupIPAddressType = "Public" +) + +func PossibleValuesForContainerGroupIPAddressType() []string { + return []string{ + string(ContainerGroupIPAddressTypePrivate), + string(ContainerGroupIPAddressTypePublic), + } +} + +func (s *ContainerGroupIPAddressType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupIPAddressType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseContainerGroupIPAddressType(input string) (*ContainerGroupIPAddressType, error) { + vals := map[string]ContainerGroupIPAddressType{ + "private": ContainerGroupIPAddressTypePrivate, + "public": ContainerGroupIPAddressTypePublic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupIPAddressType(input) + return &out, nil +} + +type ContainerGroupNetworkProtocol string + +const ( + ContainerGroupNetworkProtocolTCP ContainerGroupNetworkProtocol = "TCP" + ContainerGroupNetworkProtocolUDP ContainerGroupNetworkProtocol = "UDP" +) + +func PossibleValuesForContainerGroupNetworkProtocol() []string { + return []string{ + string(ContainerGroupNetworkProtocolTCP), + string(ContainerGroupNetworkProtocolUDP), + } +} + +func (s *ContainerGroupNetworkProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupNetworkProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseContainerGroupNetworkProtocol(input string) (*ContainerGroupNetworkProtocol, error) { + vals := map[string]ContainerGroupNetworkProtocol{ + "tcp": ContainerGroupNetworkProtocolTCP, + "udp": ContainerGroupNetworkProtocolUDP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupNetworkProtocol(input) + return &out, nil +} + +type ContainerGroupPriority string + +const ( + ContainerGroupPriorityRegular ContainerGroupPriority = "Regular" + ContainerGroupPrioritySpot ContainerGroupPriority = "Spot" +) + +func PossibleValuesForContainerGroupPriority() []string { + return []string{ + string(ContainerGroupPriorityRegular), + string(ContainerGroupPrioritySpot), + } +} + +func (s *ContainerGroupPriority) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupPriority(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseContainerGroupPriority(input string) (*ContainerGroupPriority, error) { + vals := map[string]ContainerGroupPriority{ + "regular": ContainerGroupPriorityRegular, + "spot": ContainerGroupPrioritySpot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupPriority(input) + return &out, nil +} + +type ContainerGroupProvisioningState string + +const ( + ContainerGroupProvisioningStateAccepted ContainerGroupProvisioningState = "Accepted" + ContainerGroupProvisioningStateCanceled ContainerGroupProvisioningState = "Canceled" + ContainerGroupProvisioningStateCreating ContainerGroupProvisioningState = "Creating" + ContainerGroupProvisioningStateDeleting ContainerGroupProvisioningState = "Deleting" + ContainerGroupProvisioningStateFailed ContainerGroupProvisioningState = "Failed" + ContainerGroupProvisioningStateNotAccessible ContainerGroupProvisioningState = "NotAccessible" + ContainerGroupProvisioningStateNotSpecified ContainerGroupProvisioningState = "NotSpecified" + ContainerGroupProvisioningStatePending ContainerGroupProvisioningState = "Pending" + ContainerGroupProvisioningStatePreProvisioned ContainerGroupProvisioningState = "PreProvisioned" + ContainerGroupProvisioningStateRepairing ContainerGroupProvisioningState = "Repairing" + ContainerGroupProvisioningStateSucceeded ContainerGroupProvisioningState = "Succeeded" + ContainerGroupProvisioningStateUnhealthy ContainerGroupProvisioningState = "Unhealthy" + ContainerGroupProvisioningStateUpdating ContainerGroupProvisioningState = "Updating" +) + +func PossibleValuesForContainerGroupProvisioningState() []string { + return []string{ + string(ContainerGroupProvisioningStateAccepted), + string(ContainerGroupProvisioningStateCanceled), + string(ContainerGroupProvisioningStateCreating), + string(ContainerGroupProvisioningStateDeleting), + string(ContainerGroupProvisioningStateFailed), + string(ContainerGroupProvisioningStateNotAccessible), + string(ContainerGroupProvisioningStateNotSpecified), + string(ContainerGroupProvisioningStatePending), + string(ContainerGroupProvisioningStatePreProvisioned), + string(ContainerGroupProvisioningStateRepairing), + string(ContainerGroupProvisioningStateSucceeded), + string(ContainerGroupProvisioningStateUnhealthy), + string(ContainerGroupProvisioningStateUpdating), + } +} + +func (s *ContainerGroupProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseContainerGroupProvisioningState(input string) (*ContainerGroupProvisioningState, error) { + vals := map[string]ContainerGroupProvisioningState{ + "accepted": ContainerGroupProvisioningStateAccepted, + "canceled": ContainerGroupProvisioningStateCanceled, + "creating": ContainerGroupProvisioningStateCreating, + "deleting": ContainerGroupProvisioningStateDeleting, + "failed": ContainerGroupProvisioningStateFailed, + "notaccessible": ContainerGroupProvisioningStateNotAccessible, + "notspecified": ContainerGroupProvisioningStateNotSpecified, + "pending": ContainerGroupProvisioningStatePending, + "preprovisioned": ContainerGroupProvisioningStatePreProvisioned, + "repairing": ContainerGroupProvisioningStateRepairing, + "succeeded": ContainerGroupProvisioningStateSucceeded, + "unhealthy": ContainerGroupProvisioningStateUnhealthy, + "updating": ContainerGroupProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupProvisioningState(input) + return &out, nil +} + +type ContainerGroupRestartPolicy string + +const ( + ContainerGroupRestartPolicyAlways ContainerGroupRestartPolicy = "Always" + ContainerGroupRestartPolicyNever ContainerGroupRestartPolicy = "Never" + ContainerGroupRestartPolicyOnFailure ContainerGroupRestartPolicy = "OnFailure" +) + +func PossibleValuesForContainerGroupRestartPolicy() []string { + return []string{ + string(ContainerGroupRestartPolicyAlways), + string(ContainerGroupRestartPolicyNever), + string(ContainerGroupRestartPolicyOnFailure), + } +} + +func (s *ContainerGroupRestartPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupRestartPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseContainerGroupRestartPolicy(input string) (*ContainerGroupRestartPolicy, error) { + vals := map[string]ContainerGroupRestartPolicy{ + "always": ContainerGroupRestartPolicyAlways, + "never": ContainerGroupRestartPolicyNever, + "onfailure": ContainerGroupRestartPolicyOnFailure, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupRestartPolicy(input) + return &out, nil +} + +type ContainerGroupSku string + +const ( + ContainerGroupSkuConfidential ContainerGroupSku = "Confidential" + ContainerGroupSkuDedicated ContainerGroupSku = "Dedicated" + ContainerGroupSkuNotSpecified ContainerGroupSku = "NotSpecified" + ContainerGroupSkuStandard ContainerGroupSku = "Standard" +) + +func PossibleValuesForContainerGroupSku() []string { + return []string{ + string(ContainerGroupSkuConfidential), + string(ContainerGroupSkuDedicated), + string(ContainerGroupSkuNotSpecified), + string(ContainerGroupSkuStandard), + } +} + +func (s *ContainerGroupSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerGroupSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseContainerGroupSku(input string) (*ContainerGroupSku, error) { + vals := map[string]ContainerGroupSku{ + "confidential": ContainerGroupSkuConfidential, + "dedicated": ContainerGroupSkuDedicated, + "notspecified": ContainerGroupSkuNotSpecified, + "standard": ContainerGroupSkuStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupSku(input) + return &out, nil +} + +type ContainerNetworkProtocol string + +const ( + ContainerNetworkProtocolTCP ContainerNetworkProtocol = "TCP" + ContainerNetworkProtocolUDP ContainerNetworkProtocol = "UDP" +) + +func PossibleValuesForContainerNetworkProtocol() []string { + return []string{ + string(ContainerNetworkProtocolTCP), + string(ContainerNetworkProtocolUDP), + } +} + +func (s *ContainerNetworkProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContainerNetworkProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseContainerNetworkProtocol(input string) (*ContainerNetworkProtocol, error) { + vals := map[string]ContainerNetworkProtocol{ + "tcp": ContainerNetworkProtocolTCP, + "udp": ContainerNetworkProtocolUDP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerNetworkProtocol(input) + return &out, nil +} + +type DnsNameLabelReusePolicy string + +const ( + DnsNameLabelReusePolicyNoreuse DnsNameLabelReusePolicy = "Noreuse" + DnsNameLabelReusePolicyResourceGroupReuse DnsNameLabelReusePolicy = "ResourceGroupReuse" + DnsNameLabelReusePolicySubscriptionReuse DnsNameLabelReusePolicy = "SubscriptionReuse" + DnsNameLabelReusePolicyTenantReuse DnsNameLabelReusePolicy = "TenantReuse" + DnsNameLabelReusePolicyUnsecure DnsNameLabelReusePolicy = "Unsecure" +) + +func PossibleValuesForDnsNameLabelReusePolicy() []string { + return []string{ + string(DnsNameLabelReusePolicyNoreuse), + string(DnsNameLabelReusePolicyResourceGroupReuse), + string(DnsNameLabelReusePolicySubscriptionReuse), + string(DnsNameLabelReusePolicyTenantReuse), + string(DnsNameLabelReusePolicyUnsecure), + } +} + +func (s *DnsNameLabelReusePolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDnsNameLabelReusePolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDnsNameLabelReusePolicy(input string) (*DnsNameLabelReusePolicy, error) { + vals := map[string]DnsNameLabelReusePolicy{ + "noreuse": DnsNameLabelReusePolicyNoreuse, + "resourcegroupreuse": DnsNameLabelReusePolicyResourceGroupReuse, + "subscriptionreuse": DnsNameLabelReusePolicySubscriptionReuse, + "tenantreuse": DnsNameLabelReusePolicyTenantReuse, + "unsecure": DnsNameLabelReusePolicyUnsecure, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DnsNameLabelReusePolicy(input) + return &out, nil +} + +type GpuSku string + +const ( + GpuSkuKEightZero GpuSku = "K80" + GpuSkuPOneHundred GpuSku = "P100" + GpuSkuVOneHundred GpuSku = "V100" +) + +func PossibleValuesForGpuSku() []string { + return []string{ + string(GpuSkuKEightZero), + string(GpuSkuPOneHundred), + string(GpuSkuVOneHundred), + } +} + +func (s *GpuSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGpuSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGpuSku(input string) (*GpuSku, error) { + vals := map[string]GpuSku{ + "k80": GpuSkuKEightZero, + "p100": GpuSkuPOneHundred, + "v100": GpuSkuVOneHundred, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GpuSku(input) + return &out, nil +} + +type IdentityAccessLevel string + +const ( + IdentityAccessLevelAll IdentityAccessLevel = "All" + IdentityAccessLevelSystem IdentityAccessLevel = "System" + IdentityAccessLevelUser IdentityAccessLevel = "User" +) + +func PossibleValuesForIdentityAccessLevel() []string { + return []string{ + string(IdentityAccessLevelAll), + string(IdentityAccessLevelSystem), + string(IdentityAccessLevelUser), + } +} + +func (s *IdentityAccessLevel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIdentityAccessLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIdentityAccessLevel(input string) (*IdentityAccessLevel, error) { + vals := map[string]IdentityAccessLevel{ + "all": IdentityAccessLevelAll, + "system": IdentityAccessLevelSystem, + "user": IdentityAccessLevelUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IdentityAccessLevel(input) + return &out, nil +} + +type LogAnalyticsLogType string + +const ( + LogAnalyticsLogTypeContainerInsights LogAnalyticsLogType = "ContainerInsights" + LogAnalyticsLogTypeContainerInstanceLogs LogAnalyticsLogType = "ContainerInstanceLogs" +) + +func PossibleValuesForLogAnalyticsLogType() []string { + return []string{ + string(LogAnalyticsLogTypeContainerInsights), + string(LogAnalyticsLogTypeContainerInstanceLogs), + } +} + +func (s *LogAnalyticsLogType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLogAnalyticsLogType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLogAnalyticsLogType(input string) (*LogAnalyticsLogType, error) { + vals := map[string]LogAnalyticsLogType{ + "containerinsights": LogAnalyticsLogTypeContainerInsights, + "containerinstancelogs": LogAnalyticsLogTypeContainerInstanceLogs, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LogAnalyticsLogType(input) + return &out, nil +} + +type NGroupProvisioningState string + +const ( + NGroupProvisioningStateCanceled NGroupProvisioningState = "Canceled" + NGroupProvisioningStateCreating NGroupProvisioningState = "Creating" + NGroupProvisioningStateDeleting NGroupProvisioningState = "Deleting" + NGroupProvisioningStateFailed NGroupProvisioningState = "Failed" + NGroupProvisioningStateMigrating NGroupProvisioningState = "Migrating" + NGroupProvisioningStateSucceeded NGroupProvisioningState = "Succeeded" + NGroupProvisioningStateUpdating NGroupProvisioningState = "Updating" +) + +func PossibleValuesForNGroupProvisioningState() []string { + return []string{ + string(NGroupProvisioningStateCanceled), + string(NGroupProvisioningStateCreating), + string(NGroupProvisioningStateDeleting), + string(NGroupProvisioningStateFailed), + string(NGroupProvisioningStateMigrating), + string(NGroupProvisioningStateSucceeded), + string(NGroupProvisioningStateUpdating), + } +} + +func (s *NGroupProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNGroupProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNGroupProvisioningState(input string) (*NGroupProvisioningState, error) { + vals := map[string]NGroupProvisioningState{ + "canceled": NGroupProvisioningStateCanceled, + "creating": NGroupProvisioningStateCreating, + "deleting": NGroupProvisioningStateDeleting, + "failed": NGroupProvisioningStateFailed, + "migrating": NGroupProvisioningStateMigrating, + "succeeded": NGroupProvisioningStateSucceeded, + "updating": NGroupProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NGroupProvisioningState(input) + return &out, nil +} + +type NGroupUpdateMode string + +const ( + NGroupUpdateModeManual NGroupUpdateMode = "Manual" + NGroupUpdateModeRolling NGroupUpdateMode = "Rolling" +) + +func PossibleValuesForNGroupUpdateMode() []string { + return []string{ + string(NGroupUpdateModeManual), + string(NGroupUpdateModeRolling), + } +} + +func (s *NGroupUpdateMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNGroupUpdateMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNGroupUpdateMode(input string) (*NGroupUpdateMode, error) { + vals := map[string]NGroupUpdateMode{ + "manual": NGroupUpdateModeManual, + "rolling": NGroupUpdateModeRolling, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NGroupUpdateMode(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type Priority string + +const ( + PriorityRegular Priority = "Regular" + PrioritySpot Priority = "Spot" +) + +func PossibleValuesForPriority() []string { + return []string{ + string(PriorityRegular), + string(PrioritySpot), + } +} + +func (s *Priority) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePriority(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePriority(input string) (*Priority, error) { + vals := map[string]Priority{ + "regular": PriorityRegular, + "spot": PrioritySpot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Priority(input) + return &out, nil +} + +type Scheme string + +const ( + SchemeHTTP Scheme = "http" + SchemeHTTPS Scheme = "https" +) + +func PossibleValuesForScheme() []string { + return []string{ + string(SchemeHTTP), + string(SchemeHTTPS), + } +} + +func (s *Scheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseScheme(input string) (*Scheme, error) { + vals := map[string]Scheme{ + "http": SchemeHTTP, + "https": SchemeHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Scheme(input) + return &out, nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_container.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_container.go new file mode 100644 index 00000000000..22e536f257e --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_container.go @@ -0,0 +1,139 @@ +package containerinstance + +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(&ContainerId{}) +} + +var _ resourceids.ResourceId = &ContainerId{} + +// ContainerId is a struct representing the Resource ID for a Container +type ContainerId struct { + SubscriptionId string + ResourceGroupName string + ContainerGroupName string + ContainerName string +} + +// NewContainerID returns a new ContainerId struct +func NewContainerID(subscriptionId string, resourceGroupName string, containerGroupName string, containerName string) ContainerId { + return ContainerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerGroupName: containerGroupName, + ContainerName: containerName, + } +} + +// ParseContainerID parses 'input' into a ContainerId +func ParseContainerID(input string) (*ContainerId, error) { + parser := resourceids.NewParserFromResourceIdType(&ContainerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ContainerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseContainerIDInsensitively parses 'input' case-insensitively into a ContainerId +// note: this method should only be used for API response data and not user input +func ParseContainerIDInsensitively(input string) (*ContainerId, error) { + parser := resourceids.NewParserFromResourceIdType(&ContainerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ContainerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContainerId) 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.ContainerGroupName, ok = input.Parsed["containerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerGroupName", input) + } + + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) + } + + return nil +} + +// ValidateContainerID checks that 'input' can be parsed as a Container ID +func ValidateContainerID(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 := ParseContainerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container ID +func (id ContainerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroups/%s/containers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerGroupName, id.ContainerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container ID +func (id ContainerId) 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("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticContainerGroups", "containerGroups", "containerGroups"), + resourceids.UserSpecifiedSegment("containerGroupName", "containerGroupName"), + resourceids.StaticSegment("staticContainers", "containers", "containers"), + resourceids.UserSpecifiedSegment("containerName", "containerName"), + } +} + +// String returns a human-readable description of this Container ID +func (id ContainerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container Group Name: %q", id.ContainerGroupName), + fmt.Sprintf("Container Name: %q", id.ContainerName), + } + return fmt.Sprintf("Container (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_container_test.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_container_test.go new file mode 100644 index 00000000000..12a32dbbe1b --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_container_test.go @@ -0,0 +1,327 @@ +package containerinstance + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ContainerId{} + +func TestNewContainerID(t *testing.T) { + id := NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName", "containerName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ContainerGroupName != "containerGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'ContainerGroupName'", id.ContainerGroupName, "containerGroupName") + } + + if id.ContainerName != "containerName" { + t.Fatalf("Expected %q but got %q for Segment 'ContainerName'", id.ContainerName, "containerName") + } +} + +func TestFormatContainerID(t *testing.T) { + actual := NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName", "containerName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName/containers/containerName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseContainerID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ContainerId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName/containers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName/containers/containerName", + Expected: &ContainerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ContainerGroupName: "containerGroupName", + ContainerName: "containerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName/containers/containerName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseContainerID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ContainerGroupName != v.Expected.ContainerGroupName { + t.Fatalf("Expected %q but got %q for ContainerGroupName", v.Expected.ContainerGroupName, actual.ContainerGroupName) + } + + if actual.ContainerName != v.Expected.ContainerName { + t.Fatalf("Expected %q but got %q for ContainerName", v.Expected.ContainerName, actual.ContainerName) + } + + } +} + +func TestParseContainerIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ContainerId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPs/cOnTaInErGrOuPnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName/containers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPs/cOnTaInErGrOuPnAmE/cOnTaInErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName/containers/containerName", + Expected: &ContainerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ContainerGroupName: "containerGroupName", + ContainerName: "containerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName/containers/containerName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPs/cOnTaInErGrOuPnAmE/cOnTaInErS/cOnTaInErNaMe", + Expected: &ContainerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ContainerGroupName: "cOnTaInErGrOuPnAmE", + ContainerName: "cOnTaInErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPs/cOnTaInErGrOuPnAmE/cOnTaInErS/cOnTaInErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseContainerIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ContainerGroupName != v.Expected.ContainerGroupName { + t.Fatalf("Expected %q but got %q for ContainerGroupName", v.Expected.ContainerGroupName, actual.ContainerGroupName) + } + + if actual.ContainerName != v.Expected.ContainerName { + t.Fatalf("Expected %q but got %q for ContainerName", v.Expected.ContainerName, actual.ContainerName) + } + + } +} + +func TestSegmentsForContainerId(t *testing.T) { + segments := ContainerId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ContainerId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroup.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroup.go new file mode 100644 index 00000000000..a878d95b3bc --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroup.go @@ -0,0 +1,130 @@ +package containerinstance + +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(&ContainerGroupId{}) +} + +var _ resourceids.ResourceId = &ContainerGroupId{} + +// ContainerGroupId is a struct representing the Resource ID for a Container Group +type ContainerGroupId struct { + SubscriptionId string + ResourceGroupName string + ContainerGroupName string +} + +// NewContainerGroupID returns a new ContainerGroupId struct +func NewContainerGroupID(subscriptionId string, resourceGroupName string, containerGroupName string) ContainerGroupId { + return ContainerGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerGroupName: containerGroupName, + } +} + +// ParseContainerGroupID parses 'input' into a ContainerGroupId +func ParseContainerGroupID(input string) (*ContainerGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&ContainerGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ContainerGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseContainerGroupIDInsensitively parses 'input' case-insensitively into a ContainerGroupId +// note: this method should only be used for API response data and not user input +func ParseContainerGroupIDInsensitively(input string) (*ContainerGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&ContainerGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ContainerGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContainerGroupId) 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.ContainerGroupName, ok = input.Parsed["containerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerGroupName", input) + } + + return nil +} + +// ValidateContainerGroupID checks that 'input' can be parsed as a Container Group ID +func ValidateContainerGroupID(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 := ParseContainerGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container Group ID +func (id ContainerGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container Group ID +func (id ContainerGroupId) 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("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticContainerGroups", "containerGroups", "containerGroups"), + resourceids.UserSpecifiedSegment("containerGroupName", "containerGroupName"), + } +} + +// String returns a human-readable description of this Container Group ID +func (id ContainerGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container Group Name: %q", id.ContainerGroupName), + } + return fmt.Sprintf("Container Group (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroup_test.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroup_test.go new file mode 100644 index 00000000000..7dad4954c90 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroup_test.go @@ -0,0 +1,282 @@ +package containerinstance + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ContainerGroupId{} + +func TestNewContainerGroupID(t *testing.T) { + id := NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ContainerGroupName != "containerGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'ContainerGroupName'", id.ContainerGroupName, "containerGroupName") + } +} + +func TestFormatContainerGroupID(t *testing.T) { + actual := NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseContainerGroupID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ContainerGroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName", + Expected: &ContainerGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ContainerGroupName: "containerGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseContainerGroupID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ContainerGroupName != v.Expected.ContainerGroupName { + t.Fatalf("Expected %q but got %q for ContainerGroupName", v.Expected.ContainerGroupName, actual.ContainerGroupName) + } + + } +} + +func TestParseContainerGroupIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ContainerGroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName", + Expected: &ContainerGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ContainerGroupName: "containerGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroups/containerGroupName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPs/cOnTaInErGrOuPnAmE", + Expected: &ContainerGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ContainerGroupName: "cOnTaInErGrOuPnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPs/cOnTaInErGrOuPnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseContainerGroupIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ContainerGroupName != v.Expected.ContainerGroupName { + t.Fatalf("Expected %q but got %q for ContainerGroupName", v.Expected.ContainerGroupName, actual.ContainerGroupName) + } + + } +} + +func TestSegmentsForContainerGroupId(t *testing.T) { + segments := ContainerGroupId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ContainerGroupId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroupprofile.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroupprofile.go new file mode 100644 index 00000000000..d44e077d979 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroupprofile.go @@ -0,0 +1,130 @@ +package containerinstance + +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(&ContainerGroupProfileId{}) +} + +var _ resourceids.ResourceId = &ContainerGroupProfileId{} + +// ContainerGroupProfileId is a struct representing the Resource ID for a Container Group Profile +type ContainerGroupProfileId struct { + SubscriptionId string + ResourceGroupName string + ContainerGroupProfileName string +} + +// NewContainerGroupProfileID returns a new ContainerGroupProfileId struct +func NewContainerGroupProfileID(subscriptionId string, resourceGroupName string, containerGroupProfileName string) ContainerGroupProfileId { + return ContainerGroupProfileId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerGroupProfileName: containerGroupProfileName, + } +} + +// ParseContainerGroupProfileID parses 'input' into a ContainerGroupProfileId +func ParseContainerGroupProfileID(input string) (*ContainerGroupProfileId, error) { + parser := resourceids.NewParserFromResourceIdType(&ContainerGroupProfileId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ContainerGroupProfileId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseContainerGroupProfileIDInsensitively parses 'input' case-insensitively into a ContainerGroupProfileId +// note: this method should only be used for API response data and not user input +func ParseContainerGroupProfileIDInsensitively(input string) (*ContainerGroupProfileId, error) { + parser := resourceids.NewParserFromResourceIdType(&ContainerGroupProfileId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ContainerGroupProfileId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContainerGroupProfileId) 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.ContainerGroupProfileName, ok = input.Parsed["containerGroupProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerGroupProfileName", input) + } + + return nil +} + +// ValidateContainerGroupProfileID checks that 'input' can be parsed as a Container Group Profile ID +func ValidateContainerGroupProfileID(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 := ParseContainerGroupProfileID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container Group Profile ID +func (id ContainerGroupProfileId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroupProfiles/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerGroupProfileName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container Group Profile ID +func (id ContainerGroupProfileId) 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("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticContainerGroupProfiles", "containerGroupProfiles", "containerGroupProfiles"), + resourceids.UserSpecifiedSegment("containerGroupProfileName", "containerGroupProfileName"), + } +} + +// String returns a human-readable description of this Container Group Profile ID +func (id ContainerGroupProfileId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container Group Profile Name: %q", id.ContainerGroupProfileName), + } + return fmt.Sprintf("Container Group Profile (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroupprofile_test.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroupprofile_test.go new file mode 100644 index 00000000000..81662fa2ef1 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_containergroupprofile_test.go @@ -0,0 +1,282 @@ +package containerinstance + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ContainerGroupProfileId{} + +func TestNewContainerGroupProfileID(t *testing.T) { + id := NewContainerGroupProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ContainerGroupProfileName != "containerGroupProfileName" { + t.Fatalf("Expected %q but got %q for Segment 'ContainerGroupProfileName'", id.ContainerGroupProfileName, "containerGroupProfileName") + } +} + +func TestFormatContainerGroupProfileID(t *testing.T) { + actual := NewContainerGroupProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseContainerGroupProfileID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ContainerGroupProfileId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName", + Expected: &ContainerGroupProfileId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ContainerGroupProfileName: "containerGroupProfileName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseContainerGroupProfileID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ContainerGroupProfileName != v.Expected.ContainerGroupProfileName { + t.Fatalf("Expected %q but got %q for ContainerGroupProfileName", v.Expected.ContainerGroupProfileName, actual.ContainerGroupProfileName) + } + + } +} + +func TestParseContainerGroupProfileIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ContainerGroupProfileId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPpRoFiLeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName", + Expected: &ContainerGroupProfileId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ContainerGroupProfileName: "containerGroupProfileName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPpRoFiLeS/cOnTaInErGrOuPpRoFiLeNaMe", + Expected: &ContainerGroupProfileId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ContainerGroupProfileName: "cOnTaInErGrOuPpRoFiLeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPpRoFiLeS/cOnTaInErGrOuPpRoFiLeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseContainerGroupProfileIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ContainerGroupProfileName != v.Expected.ContainerGroupProfileName { + t.Fatalf("Expected %q but got %q for ContainerGroupProfileName", v.Expected.ContainerGroupProfileName, actual.ContainerGroupProfileName) + } + + } +} + +func TestSegmentsForContainerGroupProfileId(t *testing.T) { + segments := ContainerGroupProfileId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ContainerGroupProfileId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_location.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_location.go new file mode 100644 index 00000000000..62c4630d9e1 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_location.go @@ -0,0 +1,121 @@ +package containerinstance + +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(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.ContainerInstance/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_location_test.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_location_test.go new file mode 100644 index 00000000000..7828f2d0663 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_location_test.go @@ -0,0 +1,237 @@ +package containerinstance + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.ContainerInstance/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.ContainerInstance/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.ContainerInstance/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.ContainerInstance/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.ContainerInstance/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.ContainerInstance/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.ContainerInstance/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_ngroup.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_ngroup.go new file mode 100644 index 00000000000..e7973ee5aff --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_ngroup.go @@ -0,0 +1,130 @@ +package containerinstance + +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(&NgroupId{}) +} + +var _ resourceids.ResourceId = &NgroupId{} + +// NgroupId is a struct representing the Resource ID for a Ngroup +type NgroupId struct { + SubscriptionId string + ResourceGroupName string + NgroupName string +} + +// NewNgroupID returns a new NgroupId struct +func NewNgroupID(subscriptionId string, resourceGroupName string, ngroupName string) NgroupId { + return NgroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NgroupName: ngroupName, + } +} + +// ParseNgroupID parses 'input' into a NgroupId +func ParseNgroupID(input string) (*NgroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&NgroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := NgroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseNgroupIDInsensitively parses 'input' case-insensitively into a NgroupId +// note: this method should only be used for API response data and not user input +func ParseNgroupIDInsensitively(input string) (*NgroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&NgroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := NgroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NgroupId) 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.NgroupName, ok = input.Parsed["ngroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ngroupName", input) + } + + return nil +} + +// ValidateNgroupID checks that 'input' can be parsed as a Ngroup ID +func ValidateNgroupID(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 := ParseNgroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Ngroup ID +func (id NgroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/ngroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NgroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Ngroup ID +func (id NgroupId) 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("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticNgroups", "ngroups", "ngroups"), + resourceids.UserSpecifiedSegment("ngroupName", "ngroupName"), + } +} + +// String returns a human-readable description of this Ngroup ID +func (id NgroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Ngroup Name: %q", id.NgroupName), + } + return fmt.Sprintf("Ngroup (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_ngroup_test.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_ngroup_test.go new file mode 100644 index 00000000000..59a4b99abac --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_ngroup_test.go @@ -0,0 +1,282 @@ +package containerinstance + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &NgroupId{} + +func TestNewNgroupID(t *testing.T) { + id := NewNgroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ngroupName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.NgroupName != "ngroupName" { + t.Fatalf("Expected %q but got %q for Segment 'NgroupName'", id.NgroupName, "ngroupName") + } +} + +func TestFormatNgroupID(t *testing.T) { + actual := NewNgroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ngroupName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/ngroups/ngroupName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseNgroupID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *NgroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/ngroups", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/ngroups/ngroupName", + Expected: &NgroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + NgroupName: "ngroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/ngroups/ngroupName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseNgroupID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.NgroupName != v.Expected.NgroupName { + t.Fatalf("Expected %q but got %q for NgroupName", v.Expected.NgroupName, actual.NgroupName) + } + + } +} + +func TestParseNgroupIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *NgroupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/ngroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/nGrOuPs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/ngroups/ngroupName", + Expected: &NgroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + NgroupName: "ngroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/ngroups/ngroupName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/nGrOuPs/nGrOuPnAmE", + Expected: &NgroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + NgroupName: "nGrOuPnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/nGrOuPs/nGrOuPnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseNgroupIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.NgroupName != v.Expected.NgroupName { + t.Fatalf("Expected %q but got %q for NgroupName", v.Expected.NgroupName, actual.NgroupName) + } + + } +} + +func TestSegmentsForNgroupId(t *testing.T) { + segments := NgroupId{}.Segments() + if len(segments) == 0 { + t.Fatalf("NgroupId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_revision.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_revision.go new file mode 100644 index 00000000000..55b68f00f62 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_revision.go @@ -0,0 +1,139 @@ +package containerinstance + +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(&RevisionId{}) +} + +var _ resourceids.ResourceId = &RevisionId{} + +// RevisionId is a struct representing the Resource ID for a Revision +type RevisionId struct { + SubscriptionId string + ResourceGroupName string + ContainerGroupProfileName string + RevisionName string +} + +// NewRevisionID returns a new RevisionId struct +func NewRevisionID(subscriptionId string, resourceGroupName string, containerGroupProfileName string, revisionName string) RevisionId { + return RevisionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerGroupProfileName: containerGroupProfileName, + RevisionName: revisionName, + } +} + +// ParseRevisionID parses 'input' into a RevisionId +func ParseRevisionID(input string) (*RevisionId, error) { + parser := resourceids.NewParserFromResourceIdType(&RevisionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RevisionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRevisionIDInsensitively parses 'input' case-insensitively into a RevisionId +// note: this method should only be used for API response data and not user input +func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { + parser := resourceids.NewParserFromResourceIdType(&RevisionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RevisionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) 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.ContainerGroupProfileName, ok = input.Parsed["containerGroupProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerGroupProfileName", input) + } + + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) + } + + return nil +} + +// ValidateRevisionID checks that 'input' can be parsed as a Revision ID +func ValidateRevisionID(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 := ParseRevisionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Revision ID +func (id RevisionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroupProfiles/%s/revisions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerGroupProfileName, id.RevisionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Revision ID +func (id RevisionId) 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("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticContainerGroupProfiles", "containerGroupProfiles", "containerGroupProfiles"), + resourceids.UserSpecifiedSegment("containerGroupProfileName", "containerGroupProfileName"), + resourceids.StaticSegment("staticRevisions", "revisions", "revisions"), + resourceids.UserSpecifiedSegment("revisionName", "revisionName"), + } +} + +// String returns a human-readable description of this Revision ID +func (id RevisionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container Group Profile Name: %q", id.ContainerGroupProfileName), + fmt.Sprintf("Revision Name: %q", id.RevisionName), + } + return fmt.Sprintf("Revision (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/id_revision_test.go b/resource-manager/containerinstance/2025-09-01/containerinstance/id_revision_test.go new file mode 100644 index 00000000000..68cb9db9999 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/id_revision_test.go @@ -0,0 +1,327 @@ +package containerinstance + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &RevisionId{} + +func TestNewRevisionID(t *testing.T) { + id := NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName", "revisionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ContainerGroupProfileName != "containerGroupProfileName" { + t.Fatalf("Expected %q but got %q for Segment 'ContainerGroupProfileName'", id.ContainerGroupProfileName, "containerGroupProfileName") + } + + if id.RevisionName != "revisionName" { + t.Fatalf("Expected %q but got %q for Segment 'RevisionName'", id.RevisionName, "revisionName") + } +} + +func TestFormatRevisionID(t *testing.T) { + actual := NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupProfileName", "revisionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName/revisions/revisionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRevisionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RevisionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName/revisions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName/revisions/revisionName", + Expected: &RevisionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ContainerGroupProfileName: "containerGroupProfileName", + RevisionName: "revisionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName/revisions/revisionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRevisionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ContainerGroupProfileName != v.Expected.ContainerGroupProfileName { + t.Fatalf("Expected %q but got %q for ContainerGroupProfileName", v.Expected.ContainerGroupProfileName, actual.ContainerGroupProfileName) + } + + if actual.RevisionName != v.Expected.RevisionName { + t.Fatalf("Expected %q but got %q for RevisionName", v.Expected.RevisionName, actual.RevisionName) + } + + } +} + +func TestParseRevisionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RevisionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPpRoFiLeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPpRoFiLeS/cOnTaInErGrOuPpRoFiLeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName/revisions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPpRoFiLeS/cOnTaInErGrOuPpRoFiLeNaMe/rEvIsIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName/revisions/revisionName", + Expected: &RevisionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ContainerGroupProfileName: "containerGroupProfileName", + RevisionName: "revisionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ContainerInstance/containerGroupProfiles/containerGroupProfileName/revisions/revisionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPpRoFiLeS/cOnTaInErGrOuPpRoFiLeNaMe/rEvIsIoNs/rEvIsIoNnAmE", + Expected: &RevisionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ContainerGroupProfileName: "cOnTaInErGrOuPpRoFiLeNaMe", + RevisionName: "rEvIsIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOnTaInErInStAnCe/cOnTaInErGrOuPpRoFiLeS/cOnTaInErGrOuPpRoFiLeNaMe/rEvIsIoNs/rEvIsIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRevisionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ContainerGroupProfileName != v.Expected.ContainerGroupProfileName { + t.Fatalf("Expected %q but got %q for ContainerGroupProfileName", v.Expected.ContainerGroupProfileName, actual.ContainerGroupProfileName) + } + + if actual.RevisionName != v.Expected.RevisionName { + t.Fatalf("Expected %q but got %q for RevisionName", v.Expected.RevisionName, actual.RevisionName) + } + + } +} + +func TestSegmentsForRevisionId(t *testing.T) { + segments := RevisionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RevisionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofilecreateorupdate.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofilecreateorupdate.go new file mode 100644 index 00000000000..81903604b6b --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofilecreateorupdate.go @@ -0,0 +1,58 @@ +package containerinstance + +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 CGProfileCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroupProfile +} + +// CGProfileCreateOrUpdate ... +func (c ContainerInstanceClient) CGProfileCreateOrUpdate(ctx context.Context, id ContainerGroupProfileId, input ContainerGroupProfile) (result CGProfileCreateOrUpdateOperationResponse, 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 + } + + var model ContainerGroupProfile + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofiledelete.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofiledelete.go new file mode 100644 index 00000000000..e317047c91f --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofiledelete.go @@ -0,0 +1,47 @@ +package containerinstance + +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 CGProfileDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CGProfileDelete ... +func (c ContainerInstanceClient) CGProfileDelete(ctx context.Context, id ContainerGroupProfileId) (result CGProfileDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileget.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileget.go new file mode 100644 index 00000000000..088e57746ae --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileget.go @@ -0,0 +1,53 @@ +package containerinstance + +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 CGProfileGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroupProfile +} + +// CGProfileGet ... +func (c ContainerInstanceClient) CGProfileGet(ctx context.Context, id ContainerGroupProfileId) (result CGProfileGetOperationResponse, 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 ContainerGroupProfile + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofilegetbyrevisionnumber.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofilegetbyrevisionnumber.go new file mode 100644 index 00000000000..201e9d76099 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofilegetbyrevisionnumber.go @@ -0,0 +1,53 @@ +package containerinstance + +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 CGProfileGetByRevisionNumberOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroupProfile +} + +// CGProfileGetByRevisionNumber ... +func (c ContainerInstanceClient) CGProfileGetByRevisionNumber(ctx context.Context, id RevisionId) (result CGProfileGetByRevisionNumberOperationResponse, 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 ContainerGroupProfile + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofilelistallrevisions.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofilelistallrevisions.go new file mode 100644 index 00000000000..bbeb3d9f607 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofilelistallrevisions.go @@ -0,0 +1,105 @@ +package containerinstance + +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 CGProfileListAllRevisionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ContainerGroupProfile +} + +type CGProfileListAllRevisionsCompleteResult struct { + LatestHttpResponse *http.Response + Items []ContainerGroupProfile +} + +type CGProfileListAllRevisionsCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *CGProfileListAllRevisionsCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// CGProfileListAllRevisions ... +func (c ContainerInstanceClient) CGProfileListAllRevisions(ctx context.Context, id ContainerGroupProfileId) (result CGProfileListAllRevisionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &CGProfileListAllRevisionsCustomPager{}, + Path: fmt.Sprintf("%s/revisions", 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 *[]ContainerGroupProfile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// CGProfileListAllRevisionsComplete retrieves all the results into a single object +func (c ContainerInstanceClient) CGProfileListAllRevisionsComplete(ctx context.Context, id ContainerGroupProfileId) (CGProfileListAllRevisionsCompleteResult, error) { + return c.CGProfileListAllRevisionsCompleteMatchingPredicate(ctx, id, ContainerGroupProfileOperationPredicate{}) +} + +// CGProfileListAllRevisionsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContainerInstanceClient) CGProfileListAllRevisionsCompleteMatchingPredicate(ctx context.Context, id ContainerGroupProfileId, predicate ContainerGroupProfileOperationPredicate) (result CGProfileListAllRevisionsCompleteResult, err error) { + items := make([]ContainerGroupProfile, 0) + + resp, err := c.CGProfileListAllRevisions(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 = CGProfileListAllRevisionsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileslistbyresourcegroup.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileslistbyresourcegroup.go new file mode 100644 index 00000000000..28c96d7e042 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileslistbyresourcegroup.go @@ -0,0 +1,106 @@ +package containerinstance + +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 CGProfilesListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ContainerGroupProfile +} + +type CGProfilesListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ContainerGroupProfile +} + +type CGProfilesListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *CGProfilesListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// CGProfilesListByResourceGroup ... +func (c ContainerInstanceClient) CGProfilesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result CGProfilesListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &CGProfilesListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/containerGroupProfiles", 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 *[]ContainerGroupProfile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// CGProfilesListByResourceGroupComplete retrieves all the results into a single object +func (c ContainerInstanceClient) CGProfilesListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (CGProfilesListByResourceGroupCompleteResult, error) { + return c.CGProfilesListByResourceGroupCompleteMatchingPredicate(ctx, id, ContainerGroupProfileOperationPredicate{}) +} + +// CGProfilesListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContainerInstanceClient) CGProfilesListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ContainerGroupProfileOperationPredicate) (result CGProfilesListByResourceGroupCompleteResult, err error) { + items := make([]ContainerGroupProfile, 0) + + resp, err := c.CGProfilesListByResourceGroup(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 = CGProfilesListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileslistbysubscription.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileslistbysubscription.go new file mode 100644 index 00000000000..4e05a0e9a32 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileslistbysubscription.go @@ -0,0 +1,106 @@ +package containerinstance + +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 CGProfilesListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ContainerGroupProfile +} + +type CGProfilesListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []ContainerGroupProfile +} + +type CGProfilesListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *CGProfilesListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// CGProfilesListBySubscription ... +func (c ContainerInstanceClient) CGProfilesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result CGProfilesListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &CGProfilesListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/containerGroupProfiles", 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 *[]ContainerGroupProfile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// CGProfilesListBySubscriptionComplete retrieves all the results into a single object +func (c ContainerInstanceClient) CGProfilesListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (CGProfilesListBySubscriptionCompleteResult, error) { + return c.CGProfilesListBySubscriptionCompleteMatchingPredicate(ctx, id, ContainerGroupProfileOperationPredicate{}) +} + +// CGProfilesListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContainerInstanceClient) CGProfilesListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ContainerGroupProfileOperationPredicate) (result CGProfilesListBySubscriptionCompleteResult, err error) { + items := make([]ContainerGroupProfile, 0) + + resp, err := c.CGProfilesListBySubscription(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 = CGProfilesListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileupdate.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileupdate.go new file mode 100644 index 00000000000..16b9c9b29af --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_cgprofileupdate.go @@ -0,0 +1,57 @@ +package containerinstance + +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 CGProfileUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroupProfile +} + +// CGProfileUpdate ... +func (c ContainerInstanceClient) CGProfileUpdate(ctx context.Context, id ContainerGroupProfileId, input ContainerGroupProfilePatch) (result CGProfileUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ContainerGroupProfile + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupscreateorupdate.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupscreateorupdate.go new file mode 100644 index 00000000000..f79115be3fd --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupscreateorupdate.go @@ -0,0 +1,75 @@ +package containerinstance + +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 ContainerGroupsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroup +} + +// ContainerGroupsCreateOrUpdate ... +func (c ContainerInstanceClient) ContainerGroupsCreateOrUpdate(ctx context.Context, id ContainerGroupId, input ContainerGroup) (result ContainerGroupsCreateOrUpdateOperationResponse, 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 +} + +// ContainerGroupsCreateOrUpdateThenPoll performs ContainerGroupsCreateOrUpdate then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsCreateOrUpdateThenPoll(ctx context.Context, id ContainerGroupId, input ContainerGroup) error { + result, err := c.ContainerGroupsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ContainerGroupsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ContainerGroupsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsdelete.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsdelete.go new file mode 100644 index 00000000000..3052b7351c1 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsdelete.go @@ -0,0 +1,72 @@ +package containerinstance + +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 ContainerGroupsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroup +} + +// ContainerGroupsDelete ... +func (c ContainerInstanceClient) ContainerGroupsDelete(ctx context.Context, id ContainerGroupId) (result ContainerGroupsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ContainerGroupsDeleteThenPoll performs ContainerGroupsDelete then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsDeleteThenPoll(ctx context.Context, id ContainerGroupId) error { + result, err := c.ContainerGroupsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerGroupsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ContainerGroupsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsget.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsget.go new file mode 100644 index 00000000000..56a159e9123 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsget.go @@ -0,0 +1,53 @@ +package containerinstance + +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 ContainerGroupsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroup +} + +// ContainerGroupsGet ... +func (c ContainerInstanceClient) ContainerGroupsGet(ctx context.Context, id ContainerGroupId) (result ContainerGroupsGetOperationResponse, 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 ContainerGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsgetoutboundnetworkdependenciesendpoints.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsgetoutboundnetworkdependenciesendpoints.go new file mode 100644 index 00000000000..85d12a682e4 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsgetoutboundnetworkdependenciesendpoints.go @@ -0,0 +1,54 @@ +package containerinstance + +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 ContainerGroupsGetOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]string +} + +// ContainerGroupsGetOutboundNetworkDependenciesEndpoints ... +func (c ContainerInstanceClient) ContainerGroupsGetOutboundNetworkDependenciesEndpoints(ctx context.Context, id ContainerGroupId) (result ContainerGroupsGetOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", 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 []string + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupslist.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupslist.go new file mode 100644 index 00000000000..4922492eec8 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupslist.go @@ -0,0 +1,106 @@ +package containerinstance + +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 ContainerGroupsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ListResultContainerGroup +} + +type ContainerGroupsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ListResultContainerGroup +} + +type ContainerGroupsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ContainerGroupsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ContainerGroupsList ... +func (c ContainerInstanceClient) ContainerGroupsList(ctx context.Context, id commonids.SubscriptionId) (result ContainerGroupsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ContainerGroupsListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/containerGroups", 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 *[]ListResultContainerGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ContainerGroupsListComplete retrieves all the results into a single object +func (c ContainerInstanceClient) ContainerGroupsListComplete(ctx context.Context, id commonids.SubscriptionId) (ContainerGroupsListCompleteResult, error) { + return c.ContainerGroupsListCompleteMatchingPredicate(ctx, id, ListResultContainerGroupOperationPredicate{}) +} + +// ContainerGroupsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContainerInstanceClient) ContainerGroupsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ListResultContainerGroupOperationPredicate) (result ContainerGroupsListCompleteResult, err error) { + items := make([]ListResultContainerGroup, 0) + + resp, err := c.ContainerGroupsList(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 = ContainerGroupsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupslistbyresourcegroup.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupslistbyresourcegroup.go new file mode 100644 index 00000000000..65847169139 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupslistbyresourcegroup.go @@ -0,0 +1,106 @@ +package containerinstance + +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 ContainerGroupsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ListResultContainerGroup +} + +type ContainerGroupsListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ListResultContainerGroup +} + +type ContainerGroupsListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ContainerGroupsListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ContainerGroupsListByResourceGroup ... +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ContainerGroupsListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ContainerGroupsListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/containerGroups", 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 *[]ListResultContainerGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ContainerGroupsListByResourceGroupComplete retrieves all the results into a single object +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ContainerGroupsListByResourceGroupCompleteResult, error) { + return c.ContainerGroupsListByResourceGroupCompleteMatchingPredicate(ctx, id, ListResultContainerGroupOperationPredicate{}) +} + +// ContainerGroupsListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ListResultContainerGroupOperationPredicate) (result ContainerGroupsListByResourceGroupCompleteResult, err error) { + items := make([]ListResultContainerGroup, 0) + + resp, err := c.ContainerGroupsListByResourceGroup(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 = ContainerGroupsListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsrestart.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsrestart.go new file mode 100644 index 00000000000..1d567778c03 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsrestart.go @@ -0,0 +1,69 @@ +package containerinstance + +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 ContainerGroupsRestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ContainerGroupsRestart ... +func (c ContainerInstanceClient) ContainerGroupsRestart(ctx context.Context, id ContainerGroupId) (result ContainerGroupsRestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// ContainerGroupsRestartThenPoll performs ContainerGroupsRestart then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsRestartThenPoll(ctx context.Context, id ContainerGroupId) error { + result, err := c.ContainerGroupsRestart(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerGroupsRestart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ContainerGroupsRestart: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsstart.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsstart.go new file mode 100644 index 00000000000..c3e6d2c5684 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsstart.go @@ -0,0 +1,70 @@ +package containerinstance + +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 ContainerGroupsStartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ContainerGroupsStart ... +func (c ContainerInstanceClient) ContainerGroupsStart(ctx context.Context, id ContainerGroupId) (result ContainerGroupsStartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ContainerGroupsStartThenPoll performs ContainerGroupsStart then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsStartThenPoll(ctx context.Context, id ContainerGroupId) error { + result, err := c.ContainerGroupsStart(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerGroupsStart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ContainerGroupsStart: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsstop.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsstop.go new file mode 100644 index 00000000000..82a8c0b9a07 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsstop.go @@ -0,0 +1,47 @@ +package containerinstance + +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 ContainerGroupsStopOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// ContainerGroupsStop ... +func (c ContainerInstanceClient) ContainerGroupsStop(ctx context.Context, id ContainerGroupId) (result ContainerGroupsStopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsupdate.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsupdate.go new file mode 100644 index 00000000000..25dcf502693 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containergroupsupdate.go @@ -0,0 +1,57 @@ +package containerinstance + +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 ContainerGroupsUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContainerGroup +} + +// ContainerGroupsUpdate ... +func (c ContainerInstanceClient) ContainerGroupsUpdate(ctx context.Context, id ContainerGroupId, input Resource) (result ContainerGroupsUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ContainerGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containersattach.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containersattach.go new file mode 100644 index 00000000000..89c06f345eb --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containersattach.go @@ -0,0 +1,54 @@ +package containerinstance + +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 ContainersAttachOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContainerAttachResponse +} + +// ContainersAttach ... +func (c ContainerInstanceClient) ContainersAttach(ctx context.Context, id ContainerId) (result ContainersAttachOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/attach", 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 ContainerAttachResponse + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containersexecutecommand.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containersexecutecommand.go new file mode 100644 index 00000000000..04d63544727 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containersexecutecommand.go @@ -0,0 +1,58 @@ +package containerinstance + +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 ContainersExecuteCommandOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContainerExecResponse +} + +// ContainersExecuteCommand ... +func (c ContainerInstanceClient) ContainersExecuteCommand(ctx context.Context, id ContainerId, input ContainerExecRequest) (result ContainersExecuteCommandOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/exec", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ContainerExecResponse + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_containerslistlogs.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containerslistlogs.go new file mode 100644 index 00000000000..968ef8f3636 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_containerslistlogs.go @@ -0,0 +1,87 @@ +package containerinstance + +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 ContainersListLogsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Logs +} + +type ContainersListLogsOperationOptions struct { + Tail *int64 + Timestamps *bool +} + +func DefaultContainersListLogsOperationOptions() ContainersListLogsOperationOptions { + return ContainersListLogsOperationOptions{} +} + +func (o ContainersListLogsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ContainersListLogsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ContainersListLogsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Tail != nil { + out.Append("tail", fmt.Sprintf("%v", *o.Tail)) + } + if o.Timestamps != nil { + out.Append("timestamps", fmt.Sprintf("%v", *o.Timestamps)) + } + return &out +} + +// ContainersListLogs ... +func (c ContainerInstanceClient) ContainersListLogs(ctx context.Context, id ContainerId, options ContainersListLogsOperationOptions) (result ContainersListLogsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/logs", 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 Logs + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_locationlistcachedimages.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_locationlistcachedimages.go new file mode 100644 index 00000000000..ca7204c1dd7 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_locationlistcachedimages.go @@ -0,0 +1,105 @@ +package containerinstance + +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 LocationListCachedImagesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CachedImages +} + +type LocationListCachedImagesCompleteResult struct { + LatestHttpResponse *http.Response + Items []CachedImages +} + +type LocationListCachedImagesCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *LocationListCachedImagesCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// LocationListCachedImages ... +func (c ContainerInstanceClient) LocationListCachedImages(ctx context.Context, id LocationId) (result LocationListCachedImagesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &LocationListCachedImagesCustomPager{}, + Path: fmt.Sprintf("%s/cachedImages", 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 *[]CachedImages `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// LocationListCachedImagesComplete retrieves all the results into a single object +func (c ContainerInstanceClient) LocationListCachedImagesComplete(ctx context.Context, id LocationId) (LocationListCachedImagesCompleteResult, error) { + return c.LocationListCachedImagesCompleteMatchingPredicate(ctx, id, CachedImagesOperationPredicate{}) +} + +// LocationListCachedImagesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContainerInstanceClient) LocationListCachedImagesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate CachedImagesOperationPredicate) (result LocationListCachedImagesCompleteResult, err error) { + items := make([]CachedImages, 0) + + resp, err := c.LocationListCachedImages(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 = LocationListCachedImagesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_locationlistcapabilities.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_locationlistcapabilities.go new file mode 100644 index 00000000000..86cce2b8494 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_locationlistcapabilities.go @@ -0,0 +1,105 @@ +package containerinstance + +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 LocationListCapabilitiesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Capabilities +} + +type LocationListCapabilitiesCompleteResult struct { + LatestHttpResponse *http.Response + Items []Capabilities +} + +type LocationListCapabilitiesCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *LocationListCapabilitiesCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// LocationListCapabilities ... +func (c ContainerInstanceClient) LocationListCapabilities(ctx context.Context, id LocationId) (result LocationListCapabilitiesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &LocationListCapabilitiesCustomPager{}, + Path: fmt.Sprintf("%s/capabilities", 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 *[]Capabilities `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// LocationListCapabilitiesComplete retrieves all the results into a single object +func (c ContainerInstanceClient) LocationListCapabilitiesComplete(ctx context.Context, id LocationId) (LocationListCapabilitiesCompleteResult, error) { + return c.LocationListCapabilitiesCompleteMatchingPredicate(ctx, id, CapabilitiesOperationPredicate{}) +} + +// LocationListCapabilitiesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContainerInstanceClient) LocationListCapabilitiesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate CapabilitiesOperationPredicate) (result LocationListCapabilitiesCompleteResult, err error) { + items := make([]Capabilities, 0) + + resp, err := c.LocationListCapabilities(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 = LocationListCapabilitiesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_locationlistusage.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_locationlistusage.go new file mode 100644 index 00000000000..2883aab9a36 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_locationlistusage.go @@ -0,0 +1,54 @@ +package containerinstance + +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 LocationListUsageOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UsageListResult +} + +// LocationListUsage ... +func (c ContainerInstanceClient) LocationListUsage(ctx context.Context, id LocationId) (result LocationListUsageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/usages", 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 UsageListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupscreateorupdate.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupscreateorupdate.go new file mode 100644 index 00000000000..4a31f1eb5d3 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupscreateorupdate.go @@ -0,0 +1,75 @@ +package containerinstance + +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 NGroupsCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *NGroup +} + +// NGroupsCreateOrUpdate ... +func (c ContainerInstanceClient) NGroupsCreateOrUpdate(ctx context.Context, id NgroupId, input NGroup) (result NGroupsCreateOrUpdateOperationResponse, 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 +} + +// NGroupsCreateOrUpdateThenPoll performs NGroupsCreateOrUpdate then polls until it's completed +func (c ContainerInstanceClient) NGroupsCreateOrUpdateThenPoll(ctx context.Context, id NgroupId, input NGroup) error { + result, err := c.NGroupsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing NGroupsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after NGroupsCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsdelete.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsdelete.go new file mode 100644 index 00000000000..dc1a724556b --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsdelete.go @@ -0,0 +1,70 @@ +package containerinstance + +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 NGroupsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// NGroupsDelete ... +func (c ContainerInstanceClient) NGroupsDelete(ctx context.Context, id NgroupId) (result NGroupsDeleteOperationResponse, 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 +} + +// NGroupsDeleteThenPoll performs NGroupsDelete then polls until it's completed +func (c ContainerInstanceClient) NGroupsDeleteThenPoll(ctx context.Context, id NgroupId) error { + result, err := c.NGroupsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing NGroupsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after NGroupsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsget.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsget.go new file mode 100644 index 00000000000..e046a2132d5 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsget.go @@ -0,0 +1,53 @@ +package containerinstance + +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 NGroupsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NGroup +} + +// NGroupsGet ... +func (c ContainerInstanceClient) NGroupsGet(ctx context.Context, id NgroupId) (result NGroupsGetOperationResponse, 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 NGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupslist.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupslist.go new file mode 100644 index 00000000000..b7ac8ed7461 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupslist.go @@ -0,0 +1,106 @@ +package containerinstance + +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 NGroupsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NGroup +} + +type NGroupsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []NGroup +} + +type NGroupsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *NGroupsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// NGroupsList ... +func (c ContainerInstanceClient) NGroupsList(ctx context.Context, id commonids.SubscriptionId) (result NGroupsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &NGroupsListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/ngroups", 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 *[]NGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// NGroupsListComplete retrieves all the results into a single object +func (c ContainerInstanceClient) NGroupsListComplete(ctx context.Context, id commonids.SubscriptionId) (NGroupsListCompleteResult, error) { + return c.NGroupsListCompleteMatchingPredicate(ctx, id, NGroupOperationPredicate{}) +} + +// NGroupsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContainerInstanceClient) NGroupsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate NGroupOperationPredicate) (result NGroupsListCompleteResult, err error) { + items := make([]NGroup, 0) + + resp, err := c.NGroupsList(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 = NGroupsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupslistbyresourcegroup.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupslistbyresourcegroup.go new file mode 100644 index 00000000000..797744a575e --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupslistbyresourcegroup.go @@ -0,0 +1,106 @@ +package containerinstance + +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 NGroupsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NGroup +} + +type NGroupsListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []NGroup +} + +type NGroupsListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *NGroupsListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// NGroupsListByResourceGroup ... +func (c ContainerInstanceClient) NGroupsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result NGroupsListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &NGroupsListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/ngroups", 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 *[]NGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// NGroupsListByResourceGroupComplete retrieves all the results into a single object +func (c ContainerInstanceClient) NGroupsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (NGroupsListByResourceGroupCompleteResult, error) { + return c.NGroupsListByResourceGroupCompleteMatchingPredicate(ctx, id, NGroupOperationPredicate{}) +} + +// NGroupsListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContainerInstanceClient) NGroupsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate NGroupOperationPredicate) (result NGroupsListByResourceGroupCompleteResult, err error) { + items := make([]NGroup, 0) + + resp, err := c.NGroupsListByResourceGroup(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 = NGroupsListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsrestart.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsrestart.go new file mode 100644 index 00000000000..946a757ae93 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsrestart.go @@ -0,0 +1,69 @@ +package containerinstance + +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 NGroupsRestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// NGroupsRestart ... +func (c ContainerInstanceClient) NGroupsRestart(ctx context.Context, id NgroupId) (result NGroupsRestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// NGroupsRestartThenPoll performs NGroupsRestart then polls until it's completed +func (c ContainerInstanceClient) NGroupsRestartThenPoll(ctx context.Context, id NgroupId) error { + result, err := c.NGroupsRestart(ctx, id) + if err != nil { + return fmt.Errorf("performing NGroupsRestart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after NGroupsRestart: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsstart.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsstart.go new file mode 100644 index 00000000000..5805deeafe0 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsstart.go @@ -0,0 +1,69 @@ +package containerinstance + +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 NGroupsStartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// NGroupsStart ... +func (c ContainerInstanceClient) NGroupsStart(ctx context.Context, id NgroupId) (result NGroupsStartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// NGroupsStartThenPoll performs NGroupsStart then polls until it's completed +func (c ContainerInstanceClient) NGroupsStartThenPoll(ctx context.Context, id NgroupId) error { + result, err := c.NGroupsStart(ctx, id) + if err != nil { + return fmt.Errorf("performing NGroupsStart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after NGroupsStart: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsstop.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsstop.go new file mode 100644 index 00000000000..90c4fe0a76e --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsstop.go @@ -0,0 +1,47 @@ +package containerinstance + +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 NGroupsStopOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// NGroupsStop ... +func (c ContainerInstanceClient) NGroupsStop(ctx context.Context, id NgroupId) (result NGroupsStopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsupdate.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsupdate.go new file mode 100644 index 00000000000..5088566103f --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_ngroupsupdate.go @@ -0,0 +1,75 @@ +package containerinstance + +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 NGroupsUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *NGroup +} + +// NGroupsUpdate ... +func (c ContainerInstanceClient) NGroupsUpdate(ctx context.Context, id NgroupId, input NGroupPatch) (result NGroupsUpdateOperationResponse, 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 +} + +// NGroupsUpdateThenPoll performs NGroupsUpdate then polls until it's completed +func (c ContainerInstanceClient) NGroupsUpdateThenPoll(ctx context.Context, id NgroupId, input NGroupPatch) error { + result, err := c.NGroupsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing NGroupsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after NGroupsUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/method_subnetserviceassociationlinkdelete.go b/resource-manager/containerinstance/2025-09-01/containerinstance/method_subnetserviceassociationlinkdelete.go new file mode 100644 index 00000000000..a9b469719f8 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/method_subnetserviceassociationlinkdelete.go @@ -0,0 +1,72 @@ +package containerinstance + +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/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 SubnetServiceAssociationLinkDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// SubnetServiceAssociationLinkDelete ... +func (c ContainerInstanceClient) SubnetServiceAssociationLinkDelete(ctx context.Context, id commonids.SubnetId) (result SubnetServiceAssociationLinkDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/serviceAssociationLinks/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 +} + +// SubnetServiceAssociationLinkDeleteThenPoll performs SubnetServiceAssociationLinkDelete then polls until it's completed +func (c ContainerInstanceClient) SubnetServiceAssociationLinkDeleteThenPoll(ctx context.Context, id commonids.SubnetId) error { + result, err := c.SubnetServiceAssociationLinkDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing SubnetServiceAssociationLinkDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after SubnetServiceAssociationLinkDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_apientityreference.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_apientityreference.go new file mode 100644 index 00000000000..861d58405e9 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_apientityreference.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_applicationgateway.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_applicationgateway.go new file mode 100644 index 00000000000..7acad9699dc --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_applicationgateway.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGateway struct { + BackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"backendAddressPools,omitempty"` + Resource *string `json:"resource,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_applicationgatewaybackendaddresspool.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_applicationgatewaybackendaddresspool.go new file mode 100644 index 00000000000..6b22c372e72 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_applicationgatewaybackendaddresspool.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGatewayBackendAddressPool struct { + Resource *string `json:"resource,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_azurefilevolume.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_azurefilevolume.go new file mode 100644 index 00000000000..e949b93cca0 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_azurefilevolume.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureFileVolume struct { + ReadOnly *bool `json:"readOnly,omitempty"` + ShareName string `json:"shareName"` + StorageAccountKey *string `json:"storageAccountKey,omitempty"` + StorageAccountKeyReference *string `json:"storageAccountKeyReference,omitempty"` + StorageAccountName string `json:"storageAccountName"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_cachedimages.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_cachedimages.go new file mode 100644 index 00000000000..35f76b32704 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_cachedimages.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CachedImages struct { + Image string `json:"image"` + OsType string `json:"osType"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_capabilities.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_capabilities.go new file mode 100644 index 00000000000..9e17f471ec3 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_capabilities.go @@ -0,0 +1,13 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Capabilities struct { + Capabilities *CapabilitiesCapabilities `json:"capabilities,omitempty"` + Gpu *string `json:"gpu,omitempty"` + IPAddressType *string `json:"ipAddressType,omitempty"` + Location *string `json:"location,omitempty"` + OsType *string `json:"osType,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_capabilitiescapabilities.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_capabilitiescapabilities.go new file mode 100644 index 00000000000..b453f6cc273 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_capabilitiescapabilities.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilitiesCapabilities struct { + MaxCPU *float64 `json:"maxCpu,omitempty"` + MaxGpuCount *float64 `json:"maxGpuCount,omitempty"` + MaxMemoryInGB *float64 `json:"maxMemoryInGB,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_confidentialcomputeproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_confidentialcomputeproperties.go new file mode 100644 index 00000000000..a6588472f15 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_confidentialcomputeproperties.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfidentialComputeProperties struct { + CcePolicy *string `json:"ccePolicy,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_configmap.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_configmap.go new file mode 100644 index 00000000000..18265dc401f --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_configmap.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigMap struct { + KeyValuePairs *map[string]string `json:"keyValuePairs,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_container.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_container.go new file mode 100644 index 00000000000..cd048b57c1e --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_container.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Container struct { + Name string `json:"name"` + Properties ContainerProperties `json:"properties"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerattachresponse.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerattachresponse.go new file mode 100644 index 00000000000..5944a02f3d4 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerattachresponse.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAttachResponse struct { + Password *string `json:"password,omitempty"` + WebSocketUri *string `json:"webSocketUri,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexec.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexec.go new file mode 100644 index 00000000000..dfa94b71f19 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexec.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExec struct { + Command *[]string `json:"command,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexecrequest.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexecrequest.go new file mode 100644 index 00000000000..078e69d0fb8 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexecrequest.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExecRequest struct { + Command *string `json:"command,omitempty"` + TerminalSize *ContainerExecRequestTerminalSize `json:"terminalSize,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexecrequestterminalsize.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexecrequestterminalsize.go new file mode 100644 index 00000000000..40110632964 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexecrequestterminalsize.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExecRequestTerminalSize struct { + Cols *int64 `json:"cols,omitempty"` + Rows *int64 `json:"rows,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexecresponse.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexecresponse.go new file mode 100644 index 00000000000..61c49fda416 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerexecresponse.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExecResponse struct { + Password *string `json:"password,omitempty"` + WebSocketUri *string `json:"webSocketUri,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroup.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroup.go new file mode 100644 index 00000000000..53304c19ae9 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroup.go @@ -0,0 +1,20 @@ +package containerinstance + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroup struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ContainerGroupPropertiesProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupdiagnostics.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupdiagnostics.go new file mode 100644 index 00000000000..b26d399f458 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupdiagnostics.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupDiagnostics struct { + LogAnalytics *LogAnalytics `json:"logAnalytics,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofile.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofile.go new file mode 100644 index 00000000000..b5cdddc273d --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofile.go @@ -0,0 +1,20 @@ +package containerinstance + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupProfile struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ContainerGroupProfileProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofilepatch.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofilepatch.go new file mode 100644 index 00000000000..5d082a1529c --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofilepatch.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupProfilePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofileproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofileproperties.go new file mode 100644 index 00000000000..9da883f8520 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofileproperties.go @@ -0,0 +1,56 @@ +package containerinstance + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupProfileProperties struct { + ConfidentialComputeProperties *ConfidentialComputeProperties `json:"confidentialComputeProperties,omitempty"` + Containers []Container `json:"containers"` + Diagnostics *ContainerGroupDiagnostics `json:"diagnostics,omitempty"` + EncryptionProperties *EncryptionProperties `json:"encryptionProperties,omitempty"` + Extensions *[]DeploymentExtensionSpec `json:"extensions,omitempty"` + IPAddress *IPAddress `json:"ipAddress,omitempty"` + ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"` + InitContainers *[]InitContainerDefinition `json:"initContainers,omitempty"` + OsType OperatingSystemTypes `json:"osType"` + Priority *ContainerGroupPriority `json:"priority,omitempty"` + RegisteredRevisions *[]int64 `json:"registeredRevisions,omitempty"` + RestartPolicy *ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"` + Revision *int64 `json:"revision,omitempty"` + SecurityContext *SecurityContextDefinition `json:"securityContext,omitempty"` + ShutdownGracePeriod *string `json:"shutdownGracePeriod,omitempty"` + Sku *ContainerGroupSku `json:"sku,omitempty"` + TimeToLive *string `json:"timeToLive,omitempty"` + UseKrypton *bool `json:"useKrypton,omitempty"` + Volumes *[]Volume `json:"volumes,omitempty"` +} + +func (o *ContainerGroupProfileProperties) GetShutdownGracePeriodAsTime() (*time.Time, error) { + if o.ShutdownGracePeriod == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ShutdownGracePeriod, "2006-01-02T15:04:05Z07:00") +} + +func (o *ContainerGroupProfileProperties) SetShutdownGracePeriodAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ShutdownGracePeriod = &formatted +} + +func (o *ContainerGroupProfileProperties) GetTimeToLiveAsTime() (*time.Time, error) { + if o.TimeToLive == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeToLive, "2006-01-02T15:04:05Z07:00") +} + +func (o *ContainerGroupProfileProperties) SetTimeToLiveAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeToLive = &formatted +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofilereferencedefinition.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofilereferencedefinition.go new file mode 100644 index 00000000000..6224757d084 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofilereferencedefinition.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupProfileReferenceDefinition struct { + Id *string `json:"id,omitempty"` + Revision *int64 `json:"revision,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofilestub.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofilestub.go new file mode 100644 index 00000000000..781fd042cfb --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupprofilestub.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupProfileStub struct { + ContainerGroupProperties *NGroupContainerGroupProperties `json:"containerGroupProperties,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + Resource *ApiEntityReference `json:"resource,omitempty"` + Revision *int64 `json:"revision,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergrouppropertiesproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergrouppropertiesproperties.go new file mode 100644 index 00000000000..6299ed2d615 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergrouppropertiesproperties.go @@ -0,0 +1,29 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupPropertiesProperties struct { + ConfidentialComputeProperties *ConfidentialComputeProperties `json:"confidentialComputeProperties,omitempty"` + ContainerGroupProfile *ContainerGroupProfileReferenceDefinition `json:"containerGroupProfile,omitempty"` + Containers []Container `json:"containers"` + Diagnostics *ContainerGroupDiagnostics `json:"diagnostics,omitempty"` + DnsConfig *DnsConfiguration `json:"dnsConfig,omitempty"` + EncryptionProperties *EncryptionProperties `json:"encryptionProperties,omitempty"` + Extensions *[]DeploymentExtensionSpec `json:"extensions,omitempty"` + IPAddress *IPAddress `json:"ipAddress,omitempty"` + IdentityAcls *IdentityAcls `json:"identityAcls,omitempty"` + ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"` + InitContainers *[]InitContainerDefinition `json:"initContainers,omitempty"` + InstanceView *ContainerGroupPropertiesPropertiesInstanceView `json:"instanceView,omitempty"` + IsCreatedFromStandbyPool *bool `json:"isCreatedFromStandbyPool,omitempty"` + OsType *OperatingSystemTypes `json:"osType,omitempty"` + Priority *Priority `json:"priority,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + RestartPolicy *ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"` + SecretReferences *[]SecretReference `json:"secretReferences,omitempty"` + Sku *ContainerGroupSku `json:"sku,omitempty"` + StandbyPoolProfile *StandbyPoolProfileDefinition `json:"standbyPoolProfile,omitempty"` + SubnetIds *[]ContainerGroupSubnetId `json:"subnetIds,omitempty"` + Volumes *[]Volume `json:"volumes,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergrouppropertiespropertiesinstanceview.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergrouppropertiespropertiesinstanceview.go new file mode 100644 index 00000000000..32d0727628b --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergrouppropertiespropertiesinstanceview.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupPropertiesPropertiesInstanceView struct { + Events *[]Event `json:"events,omitempty"` + State *string `json:"state,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupsubnetid.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupsubnetid.go new file mode 100644 index 00000000000..20a6b740f5d --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containergroupsubnetid.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupSubnetId struct { + Id string `json:"id"` + Name *string `json:"name,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerhttpget.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerhttpget.go new file mode 100644 index 00000000000..1de1246474b --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerhttpget.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerHTTPGet struct { + HTTPHeaders *[]HTTPHeader `json:"httpHeaders,omitempty"` + Path *string `json:"path,omitempty"` + Port int64 `json:"port"` + Scheme *Scheme `json:"scheme,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerport.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerport.go new file mode 100644 index 00000000000..26e3c3d6180 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerport.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerPort struct { + Port int64 `json:"port"` + Protocol *ContainerNetworkProtocol `json:"protocol,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerprobe.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerprobe.go new file mode 100644 index 00000000000..fafcb047b73 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerprobe.go @@ -0,0 +1,14 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerProbe struct { + Exec *ContainerExec `json:"exec,omitempty"` + FailureThreshold *int64 `json:"failureThreshold,omitempty"` + HTTPGet *ContainerHTTPGet `json:"httpGet,omitempty"` + InitialDelaySeconds *int64 `json:"initialDelaySeconds,omitempty"` + PeriodSeconds *int64 `json:"periodSeconds,omitempty"` + SuccessThreshold *int64 `json:"successThreshold,omitempty"` + TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerproperties.go new file mode 100644 index 00000000000..ee0d1c1398e --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerproperties.go @@ -0,0 +1,18 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerProperties struct { + Command *[]string `json:"command,omitempty"` + ConfigMap *ConfigMap `json:"configMap,omitempty"` + EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` + Image *string `json:"image,omitempty"` + InstanceView *ContainerPropertiesInstanceView `json:"instanceView,omitempty"` + LivenessProbe *ContainerProbe `json:"livenessProbe,omitempty"` + Ports *[]ContainerPort `json:"ports,omitempty"` + ReadinessProbe *ContainerProbe `json:"readinessProbe,omitempty"` + Resources *ResourceRequirements `json:"resources,omitempty"` + SecurityContext *SecurityContextDefinition `json:"securityContext,omitempty"` + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerpropertiesinstanceview.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerpropertiesinstanceview.go new file mode 100644 index 00000000000..347af45a182 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerpropertiesinstanceview.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerPropertiesInstanceView struct { + CurrentState *ContainerState `json:"currentState,omitempty"` + Events *[]Event `json:"events,omitempty"` + PreviousState *ContainerState `json:"previousState,omitempty"` + RestartCount *int64 `json:"restartCount,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerstate.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerstate.go new file mode 100644 index 00000000000..b75c2eee165 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_containerstate.go @@ -0,0 +1,42 @@ +package containerinstance + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerState struct { + DetailStatus *string `json:"detailStatus,omitempty"` + ExitCode *int64 `json:"exitCode,omitempty"` + FinishTime *string `json:"finishTime,omitempty"` + StartTime *string `json:"startTime,omitempty"` + State *string `json:"state,omitempty"` +} + +func (o *ContainerState) GetFinishTimeAsTime() (*time.Time, error) { + if o.FinishTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.FinishTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ContainerState) SetFinishTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FinishTime = &formatted +} + +func (o *ContainerState) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ContainerState) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_deploymentextensionspec.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_deploymentextensionspec.go new file mode 100644 index 00000000000..524ec8728c4 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_deploymentextensionspec.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeploymentExtensionSpec struct { + Name string `json:"name"` + Properties *DeploymentExtensionSpecProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_deploymentextensionspecproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_deploymentextensionspecproperties.go new file mode 100644 index 00000000000..cf9a4ccc64d --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_deploymentextensionspecproperties.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeploymentExtensionSpecProperties struct { + ExtensionType string `json:"extensionType"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + Version string `json:"version"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_dnsconfiguration.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_dnsconfiguration.go new file mode 100644 index 00000000000..08581fd75d3 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_dnsconfiguration.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsConfiguration struct { + NameServers []string `json:"nameServers"` + Options *string `json:"options,omitempty"` + SearchDomains *string `json:"searchDomains,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_elasticprofile.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_elasticprofile.go new file mode 100644 index 00000000000..86d042624f0 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_elasticprofile.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ElasticProfile struct { + ContainerGroupNamingPolicy *ElasticProfileContainerGroupNamingPolicy `json:"containerGroupNamingPolicy,omitempty"` + DesiredCount *int64 `json:"desiredCount,omitempty"` + MaintainDesiredCount *bool `json:"maintainDesiredCount,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_elasticprofilecontainergroupnamingpolicy.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_elasticprofilecontainergroupnamingpolicy.go new file mode 100644 index 00000000000..7cb2a541228 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_elasticprofilecontainergroupnamingpolicy.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ElasticProfileContainerGroupNamingPolicy struct { + GuidNamingPolicy *ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy `json:"guidNamingPolicy,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_elasticprofilecontainergroupnamingpolicyguidnamingpolicy.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_elasticprofilecontainergroupnamingpolicyguidnamingpolicy.go new file mode 100644 index 00000000000..82543a0ea03 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_elasticprofilecontainergroupnamingpolicyguidnamingpolicy.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy struct { + Prefix *string `json:"prefix,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_encryptionproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_encryptionproperties.go new file mode 100644 index 00000000000..ed5dc7406f4 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_encryptionproperties.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionProperties struct { + Identity *string `json:"identity,omitempty"` + KeyName string `json:"keyName"` + KeyVersion string `json:"keyVersion"` + VaultBaseURL string `json:"vaultBaseUrl"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_environmentvariable.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_environmentvariable.go new file mode 100644 index 00000000000..d1aec95a78e --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_environmentvariable.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnvironmentVariable struct { + Name string `json:"name"` + SecureValue *string `json:"secureValue,omitempty"` + SecureValueReference *string `json:"secureValueReference,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_event.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_event.go new file mode 100644 index 00000000000..a66aa6de014 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_event.go @@ -0,0 +1,43 @@ +package containerinstance + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Event struct { + Count *int64 `json:"count,omitempty"` + FirstTimestamp *string `json:"firstTimestamp,omitempty"` + LastTimestamp *string `json:"lastTimestamp,omitempty"` + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +func (o *Event) GetFirstTimestampAsTime() (*time.Time, error) { + if o.FirstTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.FirstTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *Event) SetFirstTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FirstTimestamp = &formatted +} + +func (o *Event) GetLastTimestampAsTime() (*time.Time, error) { + if o.LastTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *Event) SetLastTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastTimestamp = &formatted +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_fileshare.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_fileshare.go new file mode 100644 index 00000000000..195c0e8fbdc --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_fileshare.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FileShare struct { + Name *string `json:"name,omitempty"` + Properties *FileShareProperties `json:"properties,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + StorageAccountName *string `json:"storageAccountName,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_fileshareproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_fileshareproperties.go new file mode 100644 index 00000000000..32daea6662f --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_fileshareproperties.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FileShareProperties struct { + ShareAccessTier *AzureFileShareAccessTier `json:"shareAccessTier,omitempty"` + ShareAccessType *AzureFileShareAccessType `json:"shareAccessType,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_gitrepovolume.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_gitrepovolume.go new file mode 100644 index 00000000000..fe91482b097 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_gitrepovolume.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GitRepoVolume struct { + Directory *string `json:"directory,omitempty"` + Repository string `json:"repository"` + Revision *string `json:"revision,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_gpuresource.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_gpuresource.go new file mode 100644 index 00000000000..eb389f05ae8 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_gpuresource.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GpuResource struct { + Count int64 `json:"count"` + Sku GpuSku `json:"sku"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_httpheader.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_httpheader.go new file mode 100644 index 00000000000..ae57ad8dfeb --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_httpheader.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HTTPHeader struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_identityaccesscontrol.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_identityaccesscontrol.go new file mode 100644 index 00000000000..49d74d8fce2 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_identityaccesscontrol.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityAccessControl struct { + Access *IdentityAccessLevel `json:"access,omitempty"` + Identity *string `json:"identity,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_identityacls.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_identityacls.go new file mode 100644 index 00000000000..7310f3edd31 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_identityacls.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityAcls struct { + Acls *[]IdentityAccessControl `json:"acls,omitempty"` + DefaultAccess *IdentityAccessLevel `json:"defaultAccess,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_imageregistrycredential.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_imageregistrycredential.go new file mode 100644 index 00000000000..f4f5fed2922 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_imageregistrycredential.go @@ -0,0 +1,13 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageRegistryCredential struct { + Identity *string `json:"identity,omitempty"` + IdentityURL *string `json:"identityUrl,omitempty"` + Password *string `json:"password,omitempty"` + PasswordReference *string `json:"passwordReference,omitempty"` + Server string `json:"server"` + Username *string `json:"username,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_initcontainerdefinition.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_initcontainerdefinition.go new file mode 100644 index 00000000000..01211fb4a02 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_initcontainerdefinition.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InitContainerDefinition struct { + Name string `json:"name"` + Properties InitContainerPropertiesDefinition `json:"properties"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_initcontainerpropertiesdefinition.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_initcontainerpropertiesdefinition.go new file mode 100644 index 00000000000..965e167e8e8 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_initcontainerpropertiesdefinition.go @@ -0,0 +1,13 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InitContainerPropertiesDefinition struct { + Command *[]string `json:"command,omitempty"` + EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` + Image *string `json:"image,omitempty"` + InstanceView *InitContainerPropertiesDefinitionInstanceView `json:"instanceView,omitempty"` + SecurityContext *SecurityContextDefinition `json:"securityContext,omitempty"` + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_initcontainerpropertiesdefinitioninstanceview.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_initcontainerpropertiesdefinitioninstanceview.go new file mode 100644 index 00000000000..fd71b6bc7a1 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_initcontainerpropertiesdefinitioninstanceview.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InitContainerPropertiesDefinitionInstanceView struct { + CurrentState *ContainerState `json:"currentState,omitempty"` + Events *[]Event `json:"events,omitempty"` + PreviousState *ContainerState `json:"previousState,omitempty"` + RestartCount *int64 `json:"restartCount,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_ipaddress.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ipaddress.go new file mode 100644 index 00000000000..23e53900873 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ipaddress.go @@ -0,0 +1,13 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPAddress struct { + AutoGeneratedDomainNameLabelScope *DnsNameLabelReusePolicy `json:"autoGeneratedDomainNameLabelScope,omitempty"` + DnsNameLabel *string `json:"dnsNameLabel,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + IP *string `json:"ip,omitempty"` + Ports []Port `json:"ports"` + Type ContainerGroupIPAddressType `json:"type"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_listresultcontainergroup.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_listresultcontainergroup.go new file mode 100644 index 00000000000..73f0ed309bc --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_listresultcontainergroup.go @@ -0,0 +1,20 @@ +package containerinstance + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListResultContainerGroup struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ListResultContainerGroupPropertiesProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_listresultcontainergrouppropertiesproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_listresultcontainergrouppropertiesproperties.go new file mode 100644 index 00000000000..aa747ab8b54 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_listresultcontainergrouppropertiesproperties.go @@ -0,0 +1,28 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListResultContainerGroupPropertiesProperties struct { + ConfidentialComputeProperties *ConfidentialComputeProperties `json:"confidentialComputeProperties,omitempty"` + ContainerGroupProfile *ContainerGroupProfileReferenceDefinition `json:"containerGroupProfile,omitempty"` + Containers []Container `json:"containers"` + Diagnostics *ContainerGroupDiagnostics `json:"diagnostics,omitempty"` + DnsConfig *DnsConfiguration `json:"dnsConfig,omitempty"` + EncryptionProperties *EncryptionProperties `json:"encryptionProperties,omitempty"` + Extensions *[]DeploymentExtensionSpec `json:"extensions,omitempty"` + IPAddress *IPAddress `json:"ipAddress,omitempty"` + IdentityAcls *IdentityAcls `json:"identityAcls,omitempty"` + ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"` + InitContainers *[]InitContainerDefinition `json:"initContainers,omitempty"` + IsCreatedFromStandbyPool *bool `json:"isCreatedFromStandbyPool,omitempty"` + OsType OperatingSystemTypes `json:"osType"` + Priority *Priority `json:"priority,omitempty"` + ProvisioningState *ContainerGroupProvisioningState `json:"provisioningState,omitempty"` + RestartPolicy *ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"` + SecretReferences *[]SecretReference `json:"secretReferences,omitempty"` + Sku *ContainerGroupSku `json:"sku,omitempty"` + StandbyPoolProfile *StandbyPoolProfileDefinition `json:"standbyPoolProfile,omitempty"` + SubnetIds *[]ContainerGroupSubnetId `json:"subnetIds,omitempty"` + Volumes *[]Volume `json:"volumes,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_loadbalancer.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_loadbalancer.go new file mode 100644 index 00000000000..ab65a8952ff --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_loadbalancer.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadBalancer struct { + BackendAddressPools *[]LoadBalancerBackendAddressPool `json:"backendAddressPools,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_loadbalancerbackendaddresspool.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_loadbalancerbackendaddresspool.go new file mode 100644 index 00000000000..64d7f879832 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_loadbalancerbackendaddresspool.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadBalancerBackendAddressPool struct { + Resource *string `json:"resource,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_loganalytics.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_loganalytics.go new file mode 100644 index 00000000000..d62da853052 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_loganalytics.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalytics struct { + LogType *LogAnalyticsLogType `json:"logType,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + WorkspaceId string `json:"workspaceId"` + WorkspaceKey string `json:"workspaceKey"` + WorkspaceResourceId *string `json:"workspaceResourceId,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_logs.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_logs.go new file mode 100644 index 00000000000..7e4dbc04938 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_logs.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Logs struct { + Content *string `json:"content,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_networkprofile.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_networkprofile.go new file mode 100644 index 00000000000..fc7a548d637 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_networkprofile.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + ApplicationGateway *ApplicationGateway `json:"applicationGateway,omitempty"` + LoadBalancer *LoadBalancer `json:"loadBalancer,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroup.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroup.go new file mode 100644 index 00000000000..21e0a4e9112 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroup.go @@ -0,0 +1,22 @@ +package containerinstance + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NGroup struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NGroupProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcgpropertycontainer.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcgpropertycontainer.go new file mode 100644 index 00000000000..fc689185844 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcgpropertycontainer.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NGroupCGPropertyContainer struct { + Name *string `json:"name,omitempty"` + Properties *NGroupCGPropertyContainerProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcgpropertycontainerproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcgpropertycontainerproperties.go new file mode 100644 index 00000000000..33da7b650c2 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcgpropertycontainerproperties.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NGroupCGPropertyContainerProperties struct { + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcgpropertyvolume.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcgpropertyvolume.go new file mode 100644 index 00000000000..a60a614a211 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcgpropertyvolume.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NGroupCGPropertyVolume struct { + AzureFile *AzureFileVolume `json:"azureFile,omitempty"` + Name string `json:"name"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcontainergroupproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcontainergroupproperties.go new file mode 100644 index 00000000000..0a780c291b2 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupcontainergroupproperties.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NGroupContainerGroupProperties struct { + Containers *[]NGroupCGPropertyContainer `json:"containers,omitempty"` + SubnetIds *[]ContainerGroupSubnetId `json:"subnetIds,omitempty"` + Volumes *[]NGroupCGPropertyVolume `json:"volumes,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngrouppatch.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngrouppatch.go new file mode 100644 index 00000000000..dc4f9fe0c1a --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngrouppatch.go @@ -0,0 +1,18 @@ +package containerinstance + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NGroupPatch struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Properties *NGroupProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupproperties.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupproperties.go new file mode 100644 index 00000000000..aa8220e4a36 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_ngroupproperties.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NGroupProperties struct { + ContainerGroupProfiles *[]ContainerGroupProfileStub `json:"containerGroupProfiles,omitempty"` + ElasticProfile *ElasticProfile `json:"elasticProfile,omitempty"` + PlacementProfile *PlacementProfile `json:"placementProfile,omitempty"` + ProvisioningState *NGroupProvisioningState `json:"provisioningState,omitempty"` + UpdateProfile *UpdateProfile `json:"updateProfile,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_placementprofile.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_placementprofile.go new file mode 100644 index 00000000000..5e49a56b4c4 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_placementprofile.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlacementProfile struct { + FaultDomainCount *int64 `json:"faultDomainCount,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_port.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_port.go new file mode 100644 index 00000000000..e3a87272de3 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_port.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Port struct { + Port int64 `json:"port"` + Protocol *ContainerGroupNetworkProtocol `json:"protocol,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_resource.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_resource.go new file mode 100644 index 00000000000..805afa8200b --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_resource.go @@ -0,0 +1,17 @@ +package containerinstance + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Resource struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_resourcelimits.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_resourcelimits.go new file mode 100644 index 00000000000..8a2f7fc441d --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_resourcelimits.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceLimits struct { + Cpu *float64 `json:"cpu,omitempty"` + Gpu *GpuResource `json:"gpu,omitempty"` + MemoryInGB *float64 `json:"memoryInGB,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_resourcerequests.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_resourcerequests.go new file mode 100644 index 00000000000..e17a7bf905e --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_resourcerequests.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceRequests struct { + Cpu float64 `json:"cpu"` + Gpu *GpuResource `json:"gpu,omitempty"` + MemoryInGB float64 `json:"memoryInGB"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_resourcerequirements.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_resourcerequirements.go new file mode 100644 index 00000000000..cdc6bfd4aaf --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_resourcerequirements.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceRequirements struct { + Limits *ResourceLimits `json:"limits,omitempty"` + Requests ResourceRequests `json:"requests"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_secretreference.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_secretreference.go new file mode 100644 index 00000000000..8b5ab2a79ed --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_secretreference.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecretReference struct { + Identity string `json:"identity"` + Name string `json:"name"` + SecretReferenceUri string `json:"secretReferenceUri"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_securitycontextcapabilitiesdefinition.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_securitycontextcapabilitiesdefinition.go new file mode 100644 index 00000000000..45b3ad4570f --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_securitycontextcapabilitiesdefinition.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityContextCapabilitiesDefinition struct { + Add *[]string `json:"add,omitempty"` + Drop *[]string `json:"drop,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_securitycontextdefinition.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_securitycontextdefinition.go new file mode 100644 index 00000000000..41c2ace8d6b --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_securitycontextdefinition.go @@ -0,0 +1,13 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityContextDefinition struct { + AllowPrivilegeEscalation *bool `json:"allowPrivilegeEscalation,omitempty"` + Capabilities *SecurityContextCapabilitiesDefinition `json:"capabilities,omitempty"` + Privileged *bool `json:"privileged,omitempty"` + RunAsGroup *int64 `json:"runAsGroup,omitempty"` + RunAsUser *int64 `json:"runAsUser,omitempty"` + SeccompProfile *string `json:"seccompProfile,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_standbypoolprofiledefinition.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_standbypoolprofiledefinition.go new file mode 100644 index 00000000000..44267868f4e --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_standbypoolprofiledefinition.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StandbyPoolProfileDefinition struct { + FailContainerGroupCreateOnReuseFailure *bool `json:"failContainerGroupCreateOnReuseFailure,omitempty"` + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_storageprofile.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_storageprofile.go new file mode 100644 index 00000000000..e9d33b98313 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_storageprofile.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + FileShares *[]FileShare `json:"fileShares,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_updateprofile.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_updateprofile.go new file mode 100644 index 00000000000..b33ee875e4d --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_updateprofile.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateProfile struct { + RollingUpdateProfile *UpdateProfileRollingUpdateProfile `json:"rollingUpdateProfile,omitempty"` + UpdateMode *NGroupUpdateMode `json:"updateMode,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_updateprofilerollingupdateprofile.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_updateprofilerollingupdateprofile.go new file mode 100644 index 00000000000..5541fc2cb97 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_updateprofilerollingupdateprofile.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateProfileRollingUpdateProfile struct { + InPlaceUpdate *bool `json:"inPlaceUpdate,omitempty"` + MaxBatchPercent *int64 `json:"maxBatchPercent,omitempty"` + MaxUnhealthyPercent *int64 `json:"maxUnhealthyPercent,omitempty"` + PauseTimeBetweenBatches *string `json:"pauseTimeBetweenBatches,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_usage.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_usage.go new file mode 100644 index 00000000000..f4d51a11057 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_usage.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Usage struct { + CurrentValue *int64 `json:"currentValue,omitempty"` + Id *string `json:"id,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Name *UsageName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_usagelistresult.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_usagelistresult.go new file mode 100644 index 00000000000..a473f08b4e7 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_usagelistresult.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageListResult struct { + Value *[]Usage `json:"value,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_usagename.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_usagename.go new file mode 100644 index 00000000000..eba1c36c68b --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_usagename.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageName struct { + LocalizedValue *string `json:"localizedValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_volume.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_volume.go new file mode 100644 index 00000000000..30d6e92ae60 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_volume.go @@ -0,0 +1,13 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Volume struct { + AzureFile *AzureFileVolume `json:"azureFile,omitempty"` + EmptyDir *interface{} `json:"emptyDir,omitempty"` + GitRepo *GitRepoVolume `json:"gitRepo,omitempty"` + Name string `json:"name"` + Secret *map[string]string `json:"secret,omitempty"` + SecretReference *map[string]string `json:"secretReference,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/model_volumemount.go b/resource-manager/containerinstance/2025-09-01/containerinstance/model_volumemount.go new file mode 100644 index 00000000000..71d7148c1bf --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/model_volumemount.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeMount struct { + MountPath string `json:"mountPath"` + Name string `json:"name"` + ReadOnly *bool `json:"readOnly,omitempty"` +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/predicates.go b/resource-manager/containerinstance/2025-09-01/containerinstance/predicates.go new file mode 100644 index 00000000000..da458ffb2f9 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/predicates.go @@ -0,0 +1,139 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CachedImagesOperationPredicate struct { + Image *string + OsType *string +} + +func (p CachedImagesOperationPredicate) Matches(input CachedImages) bool { + + if p.Image != nil && *p.Image != input.Image { + return false + } + + if p.OsType != nil && *p.OsType != input.OsType { + return false + } + + return true +} + +type CapabilitiesOperationPredicate struct { + Gpu *string + IPAddressType *string + Location *string + OsType *string + ResourceType *string +} + +func (p CapabilitiesOperationPredicate) Matches(input Capabilities) bool { + + if p.Gpu != nil && (input.Gpu == nil || *p.Gpu != *input.Gpu) { + return false + } + + if p.IPAddressType != nil && (input.IPAddressType == nil || *p.IPAddressType != *input.IPAddressType) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.OsType != nil && (input.OsType == nil || *p.OsType != *input.OsType) { + return false + } + + if p.ResourceType != nil && (input.ResourceType == nil || *p.ResourceType != *input.ResourceType) { + return false + } + + return true +} + +type ContainerGroupProfileOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ContainerGroupProfileOperationPredicate) Matches(input ContainerGroupProfile) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type ListResultContainerGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ListResultContainerGroupOperationPredicate) Matches(input ListResultContainerGroup) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type NGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p NGroupOperationPredicate) Matches(input NGroup) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/containerinstance/2025-09-01/containerinstance/version.go b/resource-manager/containerinstance/2025-09-01/containerinstance/version.go new file mode 100644 index 00000000000..eccf5d74697 --- /dev/null +++ b/resource-manager/containerinstance/2025-09-01/containerinstance/version.go @@ -0,0 +1,10 @@ +package containerinstance + +// 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-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/containerinstance/2025-09-01" +} diff --git a/resource-manager/databricks/2026-01-01/accessconnector/README.md b/resource-manager/databricks/2026-01-01/accessconnector/README.md new file mode 100644 index 00000000000..99324406e1f --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/accessconnector` Documentation + +The `accessconnector` SDK allows for interaction with Azure Resource Manager `databricks` (API Version `2026-01-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/databricks/2026-01-01/accessconnector" +``` + + +### Client Initialization + +```go +client := accessconnector.NewAccessConnectorClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AccessConnectorClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorName") + +payload := accessconnector.AccessConnector{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AccessConnectorClient.Delete` + +```go +ctx := context.TODO() +id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AccessConnectorClient.Get` + +```go +ctx := context.TODO() +id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorName") + +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: `AccessConnectorClient.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: `AccessConnectorClient.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: `AccessConnectorClient.Update` + +```go +ctx := context.TODO() +id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorName") + +payload := accessconnector.AccessConnectorUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/databricks/2026-01-01/accessconnector/client.go b/resource-manager/databricks/2026-01-01/accessconnector/client.go new file mode 100644 index 00000000000..815c524909d --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/client.go @@ -0,0 +1,26 @@ +package accessconnector + +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 AccessConnectorClient struct { + Client *resourcemanager.Client +} + +func NewAccessConnectorClientWithBaseURI(sdkApi sdkEnv.Api) (*AccessConnectorClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "accessconnector", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AccessConnectorClient: %+v", err) + } + + return &AccessConnectorClient{ + Client: client, + }, nil +} diff --git a/resource-manager/databricks/2026-01-01/accessconnector/constants.go b/resource-manager/databricks/2026-01-01/accessconnector/constants.go new file mode 100644 index 00000000000..388470b9144 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/constants.go @@ -0,0 +1,54 @@ +package accessconnector + +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 ( + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateDeleted), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + } +} + +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{ + "deleted": ProvisioningStateDeleted, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + } + 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/resource-manager/databricks/2026-01-01/accessconnector/id_accessconnector.go b/resource-manager/databricks/2026-01-01/accessconnector/id_accessconnector.go new file mode 100644 index 00000000000..7c4211c6630 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/id_accessconnector.go @@ -0,0 +1,130 @@ +package accessconnector + +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(&AccessConnectorId{}) +} + +var _ resourceids.ResourceId = &AccessConnectorId{} + +// AccessConnectorId is a struct representing the Resource ID for a Access Connector +type AccessConnectorId struct { + SubscriptionId string + ResourceGroupName string + AccessConnectorName string +} + +// NewAccessConnectorID returns a new AccessConnectorId struct +func NewAccessConnectorID(subscriptionId string, resourceGroupName string, accessConnectorName string) AccessConnectorId { + return AccessConnectorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccessConnectorName: accessConnectorName, + } +} + +// ParseAccessConnectorID parses 'input' into a AccessConnectorId +func ParseAccessConnectorID(input string) (*AccessConnectorId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccessConnectorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccessConnectorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccessConnectorIDInsensitively parses 'input' case-insensitively into a AccessConnectorId +// note: this method should only be used for API response data and not user input +func ParseAccessConnectorIDInsensitively(input string) (*AccessConnectorId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccessConnectorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccessConnectorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessConnectorId) 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.AccessConnectorName, ok = input.Parsed["accessConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", input) + } + + return nil +} + +// ValidateAccessConnectorID checks that 'input' can be parsed as a Access Connector ID +func ValidateAccessConnectorID(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 := ParseAccessConnectorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Access Connector ID +func (id AccessConnectorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/accessConnectors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccessConnectorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Access Connector ID +func (id AccessConnectorId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticAccessConnectors", "accessConnectors", "accessConnectors"), + resourceids.UserSpecifiedSegment("accessConnectorName", "accessConnectorName"), + } +} + +// String returns a human-readable description of this Access Connector ID +func (id AccessConnectorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Access Connector Name: %q", id.AccessConnectorName), + } + return fmt.Sprintf("Access Connector (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/accessconnector/id_accessconnector_test.go b/resource-manager/databricks/2026-01-01/accessconnector/id_accessconnector_test.go new file mode 100644 index 00000000000..b0d888fc2f5 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/id_accessconnector_test.go @@ -0,0 +1,282 @@ +package accessconnector + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AccessConnectorId{} + +func TestNewAccessConnectorID(t *testing.T) { + id := NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.AccessConnectorName != "accessConnectorName" { + t.Fatalf("Expected %q but got %q for Segment 'AccessConnectorName'", id.AccessConnectorName, "accessConnectorName") + } +} + +func TestFormatAccessConnectorID(t *testing.T) { + actual := NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/accessConnectors/accessConnectorName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAccessConnectorID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccessConnectorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/accessConnectors", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/accessConnectors/accessConnectorName", + Expected: &AccessConnectorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccessConnectorName: "accessConnectorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/accessConnectors/accessConnectorName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccessConnectorID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.AccessConnectorName != v.Expected.AccessConnectorName { + t.Fatalf("Expected %q but got %q for AccessConnectorName", v.Expected.AccessConnectorName, actual.AccessConnectorName) + } + + } +} + +func TestParseAccessConnectorIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccessConnectorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/accessConnectors", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/aCcEsScOnNeCtOrS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/accessConnectors/accessConnectorName", + Expected: &AccessConnectorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccessConnectorName: "accessConnectorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/accessConnectors/accessConnectorName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/aCcEsScOnNeCtOrS/aCcEsScOnNeCtOrNaMe", + Expected: &AccessConnectorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AccessConnectorName: "aCcEsScOnNeCtOrNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/aCcEsScOnNeCtOrS/aCcEsScOnNeCtOrNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccessConnectorIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.AccessConnectorName != v.Expected.AccessConnectorName { + t.Fatalf("Expected %q but got %q for AccessConnectorName", v.Expected.AccessConnectorName, actual.AccessConnectorName) + } + + } +} + +func TestSegmentsForAccessConnectorId(t *testing.T) { + segments := AccessConnectorId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AccessConnectorId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/accessconnector/method_createorupdate.go b/resource-manager/databricks/2026-01-01/accessconnector/method_createorupdate.go new file mode 100644 index 00000000000..d647fe67948 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/method_createorupdate.go @@ -0,0 +1,75 @@ +package accessconnector + +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 *AccessConnector +} + +// CreateOrUpdate ... +func (c AccessConnectorClient) CreateOrUpdate(ctx context.Context, id AccessConnectorId, input AccessConnector) (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 AccessConnectorClient) CreateOrUpdateThenPoll(ctx context.Context, id AccessConnectorId, input AccessConnector) 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/resource-manager/databricks/2026-01-01/accessconnector/method_delete.go b/resource-manager/databricks/2026-01-01/accessconnector/method_delete.go new file mode 100644 index 00000000000..3a9ab55cbb4 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/method_delete.go @@ -0,0 +1,71 @@ +package accessconnector + +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 AccessConnectorClient) Delete(ctx context.Context, id AccessConnectorId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AccessConnectorClient) DeleteThenPoll(ctx context.Context, id AccessConnectorId) 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/resource-manager/databricks/2026-01-01/accessconnector/method_get.go b/resource-manager/databricks/2026-01-01/accessconnector/method_get.go new file mode 100644 index 00000000000..2337dc50e6e --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/method_get.go @@ -0,0 +1,53 @@ +package accessconnector + +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 *AccessConnector +} + +// Get ... +func (c AccessConnectorClient) Get(ctx context.Context, id AccessConnectorId) (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 AccessConnector + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/databricks/2026-01-01/accessconnector/method_listbyresourcegroup.go b/resource-manager/databricks/2026-01-01/accessconnector/method_listbyresourcegroup.go new file mode 100644 index 00000000000..a31fa4139d0 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package accessconnector + +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 *[]AccessConnector +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []AccessConnector +} + +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 AccessConnectorClient) 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.Databricks/accessConnectors", 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 *[]AccessConnector `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 AccessConnectorClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, AccessConnectorOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AccessConnectorClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AccessConnectorOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]AccessConnector, 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/resource-manager/databricks/2026-01-01/accessconnector/method_listbysubscription.go b/resource-manager/databricks/2026-01-01/accessconnector/method_listbysubscription.go new file mode 100644 index 00000000000..762437794c8 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/method_listbysubscription.go @@ -0,0 +1,106 @@ +package accessconnector + +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 *[]AccessConnector +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []AccessConnector +} + +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 AccessConnectorClient) 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.Databricks/accessConnectors", 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 *[]AccessConnector `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 AccessConnectorClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, AccessConnectorOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AccessConnectorClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AccessConnectorOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]AccessConnector, 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/resource-manager/databricks/2026-01-01/accessconnector/method_update.go b/resource-manager/databricks/2026-01-01/accessconnector/method_update.go new file mode 100644 index 00000000000..da352c23cef --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/method_update.go @@ -0,0 +1,75 @@ +package accessconnector + +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 *AccessConnector +} + +// Update ... +func (c AccessConnectorClient) Update(ctx context.Context, id AccessConnectorId, input AccessConnectorUpdate) (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 AccessConnectorClient) UpdateThenPoll(ctx context.Context, id AccessConnectorId, input AccessConnectorUpdate) 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/resource-manager/databricks/2026-01-01/accessconnector/model_accessconnector.go b/resource-manager/databricks/2026-01-01/accessconnector/model_accessconnector.go new file mode 100644 index 00000000000..240dac9a90a --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/model_accessconnector.go @@ -0,0 +1,20 @@ +package accessconnector + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessConnector struct { + Id *string `json:"id,omitempty"` + Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *AccessConnectorProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/accessconnector/model_accessconnectorproperties.go b/resource-manager/databricks/2026-01-01/accessconnector/model_accessconnectorproperties.go new file mode 100644 index 00000000000..8078e3e644f --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/model_accessconnectorproperties.go @@ -0,0 +1,9 @@ +package accessconnector + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessConnectorProperties struct { + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ReferedBy *[]string `json:"referedBy,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/accessconnector/model_accessconnectorupdate.go b/resource-manager/databricks/2026-01-01/accessconnector/model_accessconnectorupdate.go new file mode 100644 index 00000000000..68344d3a48c --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/model_accessconnectorupdate.go @@ -0,0 +1,13 @@ +package accessconnector + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessConnectorUpdate struct { + Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/accessconnector/predicates.go b/resource-manager/databricks/2026-01-01/accessconnector/predicates.go new file mode 100644 index 00000000000..4d1f4082039 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/predicates.go @@ -0,0 +1,32 @@ +package accessconnector + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessConnectorOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AccessConnectorOperationPredicate) Matches(input AccessConnector) 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/resource-manager/databricks/2026-01-01/accessconnector/version.go b/resource-manager/databricks/2026-01-01/accessconnector/version.go new file mode 100644 index 00000000000..ff337f2637c --- /dev/null +++ b/resource-manager/databricks/2026-01-01/accessconnector/version.go @@ -0,0 +1,10 @@ +package accessconnector + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2026-01-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/accessconnector/2026-01-01" +} diff --git a/resource-manager/databricks/2026-01-01/client.go b/resource-manager/databricks/2026-01-01/client.go new file mode 100644 index 00000000000..dd8e8dcdaef --- /dev/null +++ b/resource-manager/databricks/2026-01-01/client.go @@ -0,0 +1,91 @@ +package v2026_01_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/accessconnector" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/delete" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/privateendpointconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/privatelinkresources" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/put" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/vnetpeering" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/workspaces" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AccessConnector *accessconnector.AccessConnectorClient + DELETE *delete.DELETEClient + OutboundNetworkDependenciesEndpoints *outboundnetworkdependenciesendpoints.OutboundNetworkDependenciesEndpointsClient + PUT *put.PUTClient + PrivateEndpointConnections *privateendpointconnections.PrivateEndpointConnectionsClient + PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient + VNetPeering *vnetpeering.VNetPeeringClient + Workspaces *workspaces.WorkspacesClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + accessConnectorClient, err := accessconnector.NewAccessConnectorClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AccessConnector client: %+v", err) + } + configureFunc(accessConnectorClient.Client) + + dELETEClient, err := delete.NewDELETEClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DELETE client: %+v", err) + } + configureFunc(dELETEClient.Client) + + outboundNetworkDependenciesEndpointsClient, err := outboundnetworkdependenciesendpoints.NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building OutboundNetworkDependenciesEndpoints client: %+v", err) + } + configureFunc(outboundNetworkDependenciesEndpointsClient.Client) + + pUTClient, err := put.NewPUTClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PUT client: %+v", err) + } + configureFunc(pUTClient.Client) + + privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err) + } + configureFunc(privateEndpointConnectionsClient.Client) + + privateLinkResourcesClient, err := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateLinkResources client: %+v", err) + } + configureFunc(privateLinkResourcesClient.Client) + + vNetPeeringClient, err := vnetpeering.NewVNetPeeringClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VNetPeering client: %+v", err) + } + configureFunc(vNetPeeringClient.Client) + + workspacesClient, err := workspaces.NewWorkspacesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Workspaces client: %+v", err) + } + configureFunc(workspacesClient.Client) + + return &Client{ + AccessConnector: accessConnectorClient, + DELETE: dELETEClient, + OutboundNetworkDependenciesEndpoints: outboundNetworkDependenciesEndpointsClient, + PUT: pUTClient, + PrivateEndpointConnections: privateEndpointConnectionsClient, + PrivateLinkResources: privateLinkResourcesClient, + VNetPeering: vNetPeeringClient, + Workspaces: workspacesClient, + }, nil +} diff --git a/resource-manager/databricks/2026-01-01/delete/client.go b/resource-manager/databricks/2026-01-01/delete/client.go new file mode 100644 index 00000000000..a151c0362da --- /dev/null +++ b/resource-manager/databricks/2026-01-01/delete/client.go @@ -0,0 +1,26 @@ +package delete + +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 DELETEClient struct { + Client *resourcemanager.Client +} + +func NewDELETEClientWithBaseURI(sdkApi sdkEnv.Api) (*DELETEClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "delete", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DELETEClient: %+v", err) + } + + return &DELETEClient{ + Client: client, + }, nil +} diff --git a/resource-manager/databricks/2026-01-01/delete/id_privateendpointconnection.go b/resource-manager/databricks/2026-01-01/delete/id_privateendpointconnection.go new file mode 100644 index 00000000000..ed101cb7515 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/delete/id_privateendpointconnection.go @@ -0,0 +1,139 @@ +package delete + +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(&PrivateEndpointConnectionId{}) +} + +var _ resourceids.ResourceId = &PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) + } + + return nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionName"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/delete/id_privateendpointconnection_test.go b/resource-manager/databricks/2026-01-01/delete/id_privateendpointconnection_test.go new file mode 100644 index 00000000000..5e446c49ba5 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/delete/id_privateendpointconnection_test.go @@ -0,0 +1,327 @@ +package delete + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &PrivateEndpointConnectionId{} + +func TestNewPrivateEndpointConnectionID(t *testing.T) { + id := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } + + if id.PrivateEndpointConnectionName != "privateEndpointConnectionName" { + t.Fatalf("Expected %q but got %q for Segment 'PrivateEndpointConnectionName'", id.PrivateEndpointConnectionName, "privateEndpointConnectionName") + } +} + +func TestFormatPrivateEndpointConnectionID(t *testing.T) { + actual := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePrivateEndpointConnectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestParsePrivateEndpointConnectionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + PrivateEndpointConnectionName: "pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestSegmentsForPrivateEndpointConnectionId(t *testing.T) { + segments := PrivateEndpointConnectionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PrivateEndpointConnectionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/delete/method_privateendpointconnectionsdelete.go b/resource-manager/databricks/2026-01-01/delete/method_privateendpointconnectionsdelete.go new file mode 100644 index 00000000000..06e5dcfc4b2 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/delete/method_privateendpointconnectionsdelete.go @@ -0,0 +1,71 @@ +package delete + +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 PrivateEndpointConnectionsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PrivateEndpointConnectionsDelete ... +func (c DELETEClient) PrivateEndpointConnectionsDelete(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PrivateEndpointConnectionsDeleteThenPoll performs PrivateEndpointConnectionsDelete then polls until it's completed +func (c DELETEClient) PrivateEndpointConnectionsDeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.PrivateEndpointConnectionsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing PrivateEndpointConnectionsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PrivateEndpointConnectionsDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/databricks/2026-01-01/delete/version.go b/resource-manager/databricks/2026-01-01/delete/version.go new file mode 100644 index 00000000000..ee0c0f799a0 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/delete/version.go @@ -0,0 +1,10 @@ +package delete + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2026-01-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/delete/2026-01-01" +} diff --git a/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/README.md b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/README.md new file mode 100644 index 00000000000..0447e489172 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints` Documentation + +The `outboundnetworkdependenciesendpoints` SDK allows for interaction with Azure Resource Manager `databricks` (API Version `2026-01-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/databricks/2026-01-01/outboundnetworkdependenciesendpoints" +``` + + +### Client Initialization + +```go +client := outboundnetworkdependenciesendpoints.NewOutboundNetworkDependenciesEndpointsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `OutboundNetworkDependenciesEndpointsClient.List` + +```go +ctx := context.TODO() +id := outboundnetworkdependenciesendpoints.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/client.go b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/client.go new file mode 100644 index 00000000000..a8a36d8265e --- /dev/null +++ b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/client.go @@ -0,0 +1,26 @@ +package outboundnetworkdependenciesendpoints + +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 OutboundNetworkDependenciesEndpointsClient struct { + Client *resourcemanager.Client +} + +func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(sdkApi sdkEnv.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "outboundnetworkdependenciesendpoints", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OutboundNetworkDependenciesEndpointsClient: %+v", err) + } + + return &OutboundNetworkDependenciesEndpointsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/id_workspace.go b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/id_workspace.go new file mode 100644 index 00000000000..c5e2eaaa840 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/id_workspace.go @@ -0,0 +1,130 @@ +package outboundnetworkdependenciesendpoints + +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(&WorkspaceId{}) +} + +var _ resourceids.ResourceId = &WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + return nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(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 := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/id_workspace_test.go b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/id_workspace_test.go new file mode 100644 index 00000000000..7f8298365e4 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/id_workspace_test.go @@ -0,0 +1,282 @@ +package outboundnetworkdependenciesendpoints + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &WorkspaceId{} + +func TestNewWorkspaceID(t *testing.T) { + id := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } +} + +func TestFormatWorkspaceID(t *testing.T) { + actual := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseWorkspaceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestParseWorkspaceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestSegmentsForWorkspaceId(t *testing.T) { + segments := WorkspaceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("WorkspaceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/method_list.go b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/method_list.go new file mode 100644 index 00000000000..4a52b5e24c0 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/method_list.go @@ -0,0 +1,54 @@ +package outboundnetworkdependenciesendpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OutboundEnvironmentEndpoint +} + +// List ... +func (c OutboundNetworkDependenciesEndpointsClient) List(ctx context.Context, id WorkspaceId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", 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 []OutboundEnvironmentEndpoint + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/model_endpointdependency.go b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/model_endpointdependency.go new file mode 100644 index 00000000000..81feeb21f76 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/model_endpointdependency.go @@ -0,0 +1,9 @@ +package outboundnetworkdependenciesendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDependency struct { + DomainName *string `json:"domainName,omitempty"` + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/model_endpointdetail.go b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/model_endpointdetail.go new file mode 100644 index 00000000000..73ae63ea3b9 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/model_endpointdetail.go @@ -0,0 +1,11 @@ +package outboundnetworkdependenciesendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDetail struct { + IPAddress *string `json:"ipAddress,omitempty"` + IsAccessible *bool `json:"isAccessible,omitempty"` + Latency *float64 `json:"latency,omitempty"` + Port *int64 `json:"port,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/model_outboundenvironmentendpoint.go b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/model_outboundenvironmentendpoint.go new file mode 100644 index 00000000000..d481f55194e --- /dev/null +++ b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/model_outboundenvironmentendpoint.go @@ -0,0 +1,9 @@ +package outboundnetworkdependenciesendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OutboundEnvironmentEndpoint struct { + Category *string `json:"category,omitempty"` + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/version.go b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/version.go new file mode 100644 index 00000000000..d00cd4ea5ba --- /dev/null +++ b/resource-manager/databricks/2026-01-01/outboundnetworkdependenciesendpoints/version.go @@ -0,0 +1,10 @@ +package outboundnetworkdependenciesendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2026-01-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/outboundnetworkdependenciesendpoints/2026-01-01" +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/README.md b/resource-manager/databricks/2026-01-01/privateendpointconnections/README.md new file mode 100644 index 00000000000..cfe16e88f39 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/privateendpointconnections` Documentation + +The `privateendpointconnections` SDK allows for interaction with Azure Resource Manager `databricks` (API Version `2026-01-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/databricks/2026-01-01/privateendpointconnections" +``` + + +### Client Initialization + +```go +client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Create` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName") + +payload := privateendpointconnections.PrivateEndpointConnection{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName") + +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: `PrivateEndpointConnectionsClient.List` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/client.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/client.go new file mode 100644 index 00000000000..50eaf09dcce --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/client.go @@ -0,0 +1,26 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionsClient struct { + Client *resourcemanager.Client +} + +func NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "privateendpointconnections", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) + } + + return &PrivateEndpointConnectionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/constants.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/constants.go new file mode 100644 index 00000000000..2ee84b1650f --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/constants.go @@ -0,0 +1,107 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + string(PrivateEndpointConnectionProvisioningStateUpdating), + } +} + +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + "updating": PrivateEndpointConnectionProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func (s *PrivateLinkServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateLinkServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/id_privateendpointconnection.go new file mode 100644 index 00000000000..ed58d5ac36b --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/id_privateendpointconnection.go @@ -0,0 +1,139 @@ +package privateendpointconnections + +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(&PrivateEndpointConnectionId{}) +} + +var _ resourceids.ResourceId = &PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) + } + + return nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionName"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/id_privateendpointconnection_test.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/id_privateendpointconnection_test.go new file mode 100644 index 00000000000..62ca8fa4da9 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/id_privateendpointconnection_test.go @@ -0,0 +1,327 @@ +package privateendpointconnections + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &PrivateEndpointConnectionId{} + +func TestNewPrivateEndpointConnectionID(t *testing.T) { + id := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } + + if id.PrivateEndpointConnectionName != "privateEndpointConnectionName" { + t.Fatalf("Expected %q but got %q for Segment 'PrivateEndpointConnectionName'", id.PrivateEndpointConnectionName, "privateEndpointConnectionName") + } +} + +func TestFormatPrivateEndpointConnectionID(t *testing.T) { + actual := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePrivateEndpointConnectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestParsePrivateEndpointConnectionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + PrivateEndpointConnectionName: "pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestSegmentsForPrivateEndpointConnectionId(t *testing.T) { + segments := PrivateEndpointConnectionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PrivateEndpointConnectionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/id_workspace.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/id_workspace.go new file mode 100644 index 00000000000..347504005d8 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/id_workspace.go @@ -0,0 +1,130 @@ +package privateendpointconnections + +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(&WorkspaceId{}) +} + +var _ resourceids.ResourceId = &WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + return nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(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 := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/id_workspace_test.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/id_workspace_test.go new file mode 100644 index 00000000000..11f78d07bf6 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/id_workspace_test.go @@ -0,0 +1,282 @@ +package privateendpointconnections + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &WorkspaceId{} + +func TestNewWorkspaceID(t *testing.T) { + id := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } +} + +func TestFormatWorkspaceID(t *testing.T) { + actual := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseWorkspaceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestParseWorkspaceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestSegmentsForWorkspaceId(t *testing.T) { + segments := WorkspaceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("WorkspaceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/method_create.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/method_create.go new file mode 100644 index 00000000000..8e4db5501ac --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/method_create.go @@ -0,0 +1,75 @@ +package privateendpointconnections + +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 CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnection +} + +// Create ... +func (c PrivateEndpointConnectionsClient) Create(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 +} + +// CreateThenPoll performs Create then polls until it's completed +func (c PrivateEndpointConnectionsClient) CreateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/method_delete.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/method_delete.go new file mode 100644 index 00000000000..63c26e8f27f --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/method_delete.go @@ -0,0 +1,71 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateEndpointConnectionsClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) 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/resource-manager/databricks/2026-01-01/privateendpointconnections/method_get.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/method_get.go new file mode 100644 index 00000000000..351242746d4 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/method_get.go @@ -0,0 +1,53 @@ +package privateendpointconnections + +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 *PrivateEndpointConnection +} + +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (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 PrivateEndpointConnection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/method_list.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/method_list.go new file mode 100644 index 00000000000..bcf36ce4c39 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/method_list.go @@ -0,0 +1,105 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PrivateEndpointConnection +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []PrivateEndpointConnection +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c PrivateEndpointConnectionsClient) List(ctx context.Context, id WorkspaceId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/privateEndpointConnections", 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 *[]PrivateEndpointConnection `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, id WorkspaceId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, PrivateEndpointConnectionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PrivateEndpointConnectionsClient) ListCompleteMatchingPredicate(ctx context.Context, id WorkspaceId, predicate PrivateEndpointConnectionOperationPredicate) (result ListCompleteResult, err error) { + items := make([]PrivateEndpointConnection, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privateendpoint.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privateendpoint.go new file mode 100644 index 00000000000..1bc8cf2a97c --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privateendpoint.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privateendpointconnection.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privateendpointconnection.go new file mode 100644 index 00000000000..a00059f768e --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties PrivateEndpointConnectionProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privateendpointconnectionproperties.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..fb540c904b6 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..d7ae83ad4d8 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status PrivateLinkServiceConnectionStatus `json:"status"` +} diff --git a/resource-manager/databricks/2026-01-01/privateendpointconnections/predicates.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/predicates.go new file mode 100644 index 00000000000..4a03a91ce52 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/predicates.go @@ -0,0 +1,27 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateEndpointConnectionOperationPredicate) Matches(input PrivateEndpointConnection) 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/resource-manager/databricks/2026-01-01/privateendpointconnections/version.go b/resource-manager/databricks/2026-01-01/privateendpointconnections/version.go new file mode 100644 index 00000000000..f7a91fb27fd --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privateendpointconnections/version.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2026-01-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/privateendpointconnections/2026-01-01" +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/README.md b/resource-manager/databricks/2026-01-01/privatelinkresources/README.md new file mode 100644 index 00000000000..71840738d1a --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/privatelinkresources` Documentation + +The `privatelinkresources` SDK allows for interaction with Azure Resource Manager `databricks` (API Version `2026-01-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/databricks/2026-01-01/privatelinkresources" +``` + + +### Client Initialization + +```go +client := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateLinkResourcesClient.Get` + +```go +ctx := context.TODO() +id := privatelinkresources.NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "groupId") + +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: `PrivateLinkResourcesClient.List` + +```go +ctx := context.TODO() +id := privatelinkresources.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/client.go b/resource-manager/databricks/2026-01-01/privatelinkresources/client.go new file mode 100644 index 00000000000..28c00b21f03 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/client.go @@ -0,0 +1,26 @@ +package privatelinkresources + +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 PrivateLinkResourcesClient struct { + Client *resourcemanager.Client +} + +func NewPrivateLinkResourcesClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateLinkResourcesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "privatelinkresources", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) + } + + return &PrivateLinkResourcesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/databricks/2026-01-01/privatelinkresources/id_privatelinkresource.go new file mode 100644 index 00000000000..653caccb82b --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/id_privatelinkresource.go @@ -0,0 +1,139 @@ +package privatelinkresources + +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(&PrivateLinkResourceId{}) +} + +var _ resourceids.ResourceId = &PrivateLinkResourceId{} + +// PrivateLinkResourceId is a struct representing the Resource ID for a Private Link Resource +type PrivateLinkResourceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + GroupId string +} + +// NewPrivateLinkResourceID returns a new PrivateLinkResourceId struct +func NewPrivateLinkResourceID(subscriptionId string, resourceGroupName string, workspaceName string, groupId string) PrivateLinkResourceId { + return PrivateLinkResourceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + GroupId: groupId, + } +} + +// ParsePrivateLinkResourceID parses 'input' into a PrivateLinkResourceId +func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateLinkResourceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateLinkResourceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePrivateLinkResourceIDInsensitively parses 'input' case-insensitively into a PrivateLinkResourceId +// note: this method should only be used for API response data and not user input +func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateLinkResourceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateLinkResourceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) + } + + return nil +} + +// ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID +func ValidatePrivateLinkResourceID(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 := ParsePrivateLinkResourceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Link Resource ID +func (id PrivateLinkResourceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s/privateLinkResources/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.GroupId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Link Resource ID +func (id PrivateLinkResourceId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + resourceids.StaticSegment("staticPrivateLinkResources", "privateLinkResources", "privateLinkResources"), + resourceids.UserSpecifiedSegment("groupId", "groupId"), + } +} + +// String returns a human-readable description of this Private Link Resource ID +func (id PrivateLinkResourceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Group: %q", id.GroupId), + } + return fmt.Sprintf("Private Link Resource (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/id_privatelinkresource_test.go b/resource-manager/databricks/2026-01-01/privatelinkresources/id_privatelinkresource_test.go new file mode 100644 index 00000000000..9ed0158c77c --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/id_privatelinkresource_test.go @@ -0,0 +1,327 @@ +package privatelinkresources + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &PrivateLinkResourceId{} + +func TestNewPrivateLinkResourceID(t *testing.T) { + id := NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "groupId") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } + + if id.GroupId != "groupId" { + t.Fatalf("Expected %q but got %q for Segment 'GroupId'", id.GroupId, "groupId") + } +} + +func TestFormatPrivateLinkResourceID(t *testing.T) { + actual := NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "groupId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateLinkResources/groupId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePrivateLinkResourceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateLinkResourceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateLinkResources", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateLinkResources/groupId", + Expected: &PrivateLinkResourceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + GroupId: "groupId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateLinkResources/groupId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateLinkResourceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.GroupId != v.Expected.GroupId { + t.Fatalf("Expected %q but got %q for GroupId", v.Expected.GroupId, actual.GroupId) + } + + } +} + +func TestParsePrivateLinkResourceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateLinkResourceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateLinkResources", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeLiNkReSoUrCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateLinkResources/groupId", + Expected: &PrivateLinkResourceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + GroupId: "groupId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateLinkResources/groupId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeLiNkReSoUrCeS/gRoUpId", + Expected: &PrivateLinkResourceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + GroupId: "gRoUpId", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeLiNkReSoUrCeS/gRoUpId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateLinkResourceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.GroupId != v.Expected.GroupId { + t.Fatalf("Expected %q but got %q for GroupId", v.Expected.GroupId, actual.GroupId) + } + + } +} + +func TestSegmentsForPrivateLinkResourceId(t *testing.T) { + segments := PrivateLinkResourceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PrivateLinkResourceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/id_workspace.go b/resource-manager/databricks/2026-01-01/privatelinkresources/id_workspace.go new file mode 100644 index 00000000000..6ff002006e1 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/id_workspace.go @@ -0,0 +1,130 @@ +package privatelinkresources + +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(&WorkspaceId{}) +} + +var _ resourceids.ResourceId = &WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + return nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(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 := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/id_workspace_test.go b/resource-manager/databricks/2026-01-01/privatelinkresources/id_workspace_test.go new file mode 100644 index 00000000000..5e0f5019aca --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/id_workspace_test.go @@ -0,0 +1,282 @@ +package privatelinkresources + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &WorkspaceId{} + +func TestNewWorkspaceID(t *testing.T) { + id := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } +} + +func TestFormatWorkspaceID(t *testing.T) { + actual := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseWorkspaceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestParseWorkspaceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestSegmentsForWorkspaceId(t *testing.T) { + segments := WorkspaceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("WorkspaceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/method_get.go b/resource-manager/databricks/2026-01-01/privatelinkresources/method_get.go new file mode 100644 index 00000000000..befd7af3800 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/method_get.go @@ -0,0 +1,53 @@ +package privatelinkresources + +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 *GroupIdInformation +} + +// Get ... +func (c PrivateLinkResourcesClient) Get(ctx context.Context, id PrivateLinkResourceId) (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 GroupIdInformation + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/method_list.go b/resource-manager/databricks/2026-01-01/privatelinkresources/method_list.go new file mode 100644 index 00000000000..51b395e5785 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/method_list.go @@ -0,0 +1,105 @@ +package privatelinkresources + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GroupIdInformation +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []GroupIdInformation +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c PrivateLinkResourcesClient) List(ctx context.Context, id WorkspaceId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/privateLinkResources", 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 *[]GroupIdInformation `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c PrivateLinkResourcesClient) ListComplete(ctx context.Context, id WorkspaceId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, GroupIdInformationOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PrivateLinkResourcesClient) ListCompleteMatchingPredicate(ctx context.Context, id WorkspaceId, predicate GroupIdInformationOperationPredicate) (result ListCompleteResult, err error) { + items := make([]GroupIdInformation, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/model_groupidinformation.go b/resource-manager/databricks/2026-01-01/privatelinkresources/model_groupidinformation.go new file mode 100644 index 00000000000..c095eca2f2a --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/model_groupidinformation.go @@ -0,0 +1,11 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupIdInformation struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties GroupIdInformationProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/model_groupidinformationproperties.go b/resource-manager/databricks/2026-01-01/privatelinkresources/model_groupidinformationproperties.go new file mode 100644 index 00000000000..c18b94190af --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/model_groupidinformationproperties.go @@ -0,0 +1,10 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupIdInformationProperties struct { + GroupId *string `json:"groupId,omitempty"` + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/privatelinkresources/predicates.go b/resource-manager/databricks/2026-01-01/privatelinkresources/predicates.go new file mode 100644 index 00000000000..16f1098713f --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/predicates.go @@ -0,0 +1,27 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupIdInformationOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GroupIdInformationOperationPredicate) Matches(input GroupIdInformation) 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/resource-manager/databricks/2026-01-01/privatelinkresources/version.go b/resource-manager/databricks/2026-01-01/privatelinkresources/version.go new file mode 100644 index 00000000000..1713e46c5d7 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/privatelinkresources/version.go @@ -0,0 +1,10 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2026-01-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/privatelinkresources/2026-01-01" +} diff --git a/resource-manager/databricks/2026-01-01/put/README.md b/resource-manager/databricks/2026-01-01/put/README.md new file mode 100644 index 00000000000..0229a841f35 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/README.md @@ -0,0 +1,37 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/put` Documentation + +The `put` SDK allows for interaction with Azure Resource Manager `databricks` (API Version `2026-01-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/databricks/2026-01-01/put" +``` + + +### Client Initialization + +```go +client := put.NewPUTClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PUTClient.PrivateEndpointConnectionsCreate` + +```go +ctx := context.TODO() +id := put.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName") + +payload := put.PrivateEndpointConnection{ + // ... +} + + +if err := client.PrivateEndpointConnectionsCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/databricks/2026-01-01/put/client.go b/resource-manager/databricks/2026-01-01/put/client.go new file mode 100644 index 00000000000..54fb640a8e1 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/client.go @@ -0,0 +1,26 @@ +package put + +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 PUTClient struct { + Client *resourcemanager.Client +} + +func NewPUTClientWithBaseURI(sdkApi sdkEnv.Api) (*PUTClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "put", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PUTClient: %+v", err) + } + + return &PUTClient{ + Client: client, + }, nil +} diff --git a/resource-manager/databricks/2026-01-01/put/constants.go b/resource-manager/databricks/2026-01-01/put/constants.go new file mode 100644 index 00000000000..8e62f1de14b --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/constants.go @@ -0,0 +1,107 @@ +package put + +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 PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + string(PrivateEndpointConnectionProvisioningStateUpdating), + } +} + +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + "updating": PrivateEndpointConnectionProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func (s *PrivateLinkServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateLinkServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} diff --git a/resource-manager/databricks/2026-01-01/put/id_privateendpointconnection.go b/resource-manager/databricks/2026-01-01/put/id_privateendpointconnection.go new file mode 100644 index 00000000000..24ef764cc11 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/id_privateendpointconnection.go @@ -0,0 +1,139 @@ +package put + +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(&PrivateEndpointConnectionId{}) +} + +var _ resourceids.ResourceId = &PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) + } + + return nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionName"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/put/id_privateendpointconnection_test.go b/resource-manager/databricks/2026-01-01/put/id_privateendpointconnection_test.go new file mode 100644 index 00000000000..840f414901d --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/id_privateendpointconnection_test.go @@ -0,0 +1,327 @@ +package put + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &PrivateEndpointConnectionId{} + +func TestNewPrivateEndpointConnectionID(t *testing.T) { + id := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } + + if id.PrivateEndpointConnectionName != "privateEndpointConnectionName" { + t.Fatalf("Expected %q but got %q for Segment 'PrivateEndpointConnectionName'", id.PrivateEndpointConnectionName, "privateEndpointConnectionName") + } +} + +func TestFormatPrivateEndpointConnectionID(t *testing.T) { + actual := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "privateEndpointConnectionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePrivateEndpointConnectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestParsePrivateEndpointConnectionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + PrivateEndpointConnectionName: "pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestSegmentsForPrivateEndpointConnectionId(t *testing.T) { + segments := PrivateEndpointConnectionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PrivateEndpointConnectionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/put/method_privateendpointconnectionscreate.go b/resource-manager/databricks/2026-01-01/put/method_privateendpointconnectionscreate.go new file mode 100644 index 00000000000..90ec8cc9734 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/method_privateendpointconnectionscreate.go @@ -0,0 +1,75 @@ +package put + +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 PrivateEndpointConnectionsCreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnection +} + +// PrivateEndpointConnectionsCreate ... +func (c PUTClient) PrivateEndpointConnectionsCreate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 +} + +// PrivateEndpointConnectionsCreateThenPoll performs PrivateEndpointConnectionsCreate then polls until it's completed +func (c PUTClient) PrivateEndpointConnectionsCreateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.PrivateEndpointConnectionsCreate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PrivateEndpointConnectionsCreate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PrivateEndpointConnectionsCreate: %+v", err) + } + + return nil +} diff --git a/resource-manager/databricks/2026-01-01/put/model_privateendpoint.go b/resource-manager/databricks/2026-01-01/put/model_privateendpoint.go new file mode 100644 index 00000000000..9debd27fc1a --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/model_privateendpoint.go @@ -0,0 +1,8 @@ +package put + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/put/model_privateendpointconnection.go b/resource-manager/databricks/2026-01-01/put/model_privateendpointconnection.go new file mode 100644 index 00000000000..3c18d762a91 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package put + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties PrivateEndpointConnectionProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/put/model_privateendpointconnectionproperties.go b/resource-manager/databricks/2026-01-01/put/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..a3aa6bead7c --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package put + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/put/model_privatelinkserviceconnectionstate.go b/resource-manager/databricks/2026-01-01/put/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..ecc66b980fb --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package put + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status PrivateLinkServiceConnectionStatus `json:"status"` +} diff --git a/resource-manager/databricks/2026-01-01/put/version.go b/resource-manager/databricks/2026-01-01/put/version.go new file mode 100644 index 00000000000..aa75b6c0db5 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/put/version.go @@ -0,0 +1,10 @@ +package put + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2026-01-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/put/2026-01-01" +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/README.md b/resource-manager/databricks/2026-01-01/vnetpeering/README.md new file mode 100644 index 00000000000..500e9ab758d --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/vnetpeering` Documentation + +The `vnetpeering` SDK allows for interaction with Azure Resource Manager `databricks` (API Version `2026-01-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/databricks/2026-01-01/vnetpeering" +``` + + +### Client Initialization + +```go +client := vnetpeering.NewVNetPeeringClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VNetPeeringClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := vnetpeering.NewVirtualNetworkPeeringID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "virtualNetworkPeeringName") + +payload := vnetpeering.VirtualNetworkPeering{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VNetPeeringClient.Delete` + +```go +ctx := context.TODO() +id := vnetpeering.NewVirtualNetworkPeeringID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "virtualNetworkPeeringName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VNetPeeringClient.Get` + +```go +ctx := context.TODO() +id := vnetpeering.NewVirtualNetworkPeeringID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "virtualNetworkPeeringName") + +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: `VNetPeeringClient.ListByWorkspace` + +```go +ctx := context.TODO() +id := vnetpeering.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + +// alternatively `client.ListByWorkspace(ctx, id)` can be used to do batched pagination +items, err := client.ListByWorkspaceComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/client.go b/resource-manager/databricks/2026-01-01/vnetpeering/client.go new file mode 100644 index 00000000000..5b85b9745b0 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/client.go @@ -0,0 +1,26 @@ +package vnetpeering + +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 VNetPeeringClient struct { + Client *resourcemanager.Client +} + +func NewVNetPeeringClientWithBaseURI(sdkApi sdkEnv.Api) (*VNetPeeringClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "vnetpeering", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VNetPeeringClient: %+v", err) + } + + return &VNetPeeringClient{ + Client: client, + }, nil +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/constants.go b/resource-manager/databricks/2026-01-01/vnetpeering/constants.go new file mode 100644 index 00000000000..f8ec6f58c22 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/constants.go @@ -0,0 +1,101 @@ +package vnetpeering + +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 PeeringProvisioningState string + +const ( + PeeringProvisioningStateDeleting PeeringProvisioningState = "Deleting" + PeeringProvisioningStateFailed PeeringProvisioningState = "Failed" + PeeringProvisioningStateSucceeded PeeringProvisioningState = "Succeeded" + PeeringProvisioningStateUpdating PeeringProvisioningState = "Updating" +) + +func PossibleValuesForPeeringProvisioningState() []string { + return []string{ + string(PeeringProvisioningStateDeleting), + string(PeeringProvisioningStateFailed), + string(PeeringProvisioningStateSucceeded), + string(PeeringProvisioningStateUpdating), + } +} + +func (s *PeeringProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePeeringProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePeeringProvisioningState(input string) (*PeeringProvisioningState, error) { + vals := map[string]PeeringProvisioningState{ + "deleting": PeeringProvisioningStateDeleting, + "failed": PeeringProvisioningStateFailed, + "succeeded": PeeringProvisioningStateSucceeded, + "updating": PeeringProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PeeringProvisioningState(input) + return &out, nil +} + +type PeeringState string + +const ( + PeeringStateConnected PeeringState = "Connected" + PeeringStateDisconnected PeeringState = "Disconnected" + PeeringStateInitiated PeeringState = "Initiated" +) + +func PossibleValuesForPeeringState() []string { + return []string{ + string(PeeringStateConnected), + string(PeeringStateDisconnected), + string(PeeringStateInitiated), + } +} + +func (s *PeeringState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePeeringState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePeeringState(input string) (*PeeringState, error) { + vals := map[string]PeeringState{ + "connected": PeeringStateConnected, + "disconnected": PeeringStateDisconnected, + "initiated": PeeringStateInitiated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PeeringState(input) + return &out, nil +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/id_virtualnetworkpeering.go b/resource-manager/databricks/2026-01-01/vnetpeering/id_virtualnetworkpeering.go new file mode 100644 index 00000000000..5e8f7275ac1 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/id_virtualnetworkpeering.go @@ -0,0 +1,139 @@ +package vnetpeering + +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(&VirtualNetworkPeeringId{}) +} + +var _ resourceids.ResourceId = &VirtualNetworkPeeringId{} + +// VirtualNetworkPeeringId is a struct representing the Resource ID for a Virtual Network Peering +type VirtualNetworkPeeringId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + VirtualNetworkPeeringName string +} + +// NewVirtualNetworkPeeringID returns a new VirtualNetworkPeeringId struct +func NewVirtualNetworkPeeringID(subscriptionId string, resourceGroupName string, workspaceName string, virtualNetworkPeeringName string) VirtualNetworkPeeringId { + return VirtualNetworkPeeringId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + VirtualNetworkPeeringName: virtualNetworkPeeringName, + } +} + +// ParseVirtualNetworkPeeringID parses 'input' into a VirtualNetworkPeeringId +func ParseVirtualNetworkPeeringID(input string) (*VirtualNetworkPeeringId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualNetworkPeeringId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualNetworkPeeringId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualNetworkPeeringIDInsensitively parses 'input' case-insensitively into a VirtualNetworkPeeringId +// note: this method should only be used for API response data and not user input +func ParseVirtualNetworkPeeringIDInsensitively(input string) (*VirtualNetworkPeeringId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualNetworkPeeringId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualNetworkPeeringId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkPeeringId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + if id.VirtualNetworkPeeringName, ok = input.Parsed["virtualNetworkPeeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", input) + } + + return nil +} + +// ValidateVirtualNetworkPeeringID checks that 'input' can be parsed as a Virtual Network Peering ID +func ValidateVirtualNetworkPeeringID(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 := ParseVirtualNetworkPeeringID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Network Peering ID +func (id VirtualNetworkPeeringId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s/virtualNetworkPeerings/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.VirtualNetworkPeeringName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Network Peering ID +func (id VirtualNetworkPeeringId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + resourceids.StaticSegment("staticVirtualNetworkPeerings", "virtualNetworkPeerings", "virtualNetworkPeerings"), + resourceids.UserSpecifiedSegment("virtualNetworkPeeringName", "virtualNetworkPeeringName"), + } +} + +// String returns a human-readable description of this Virtual Network Peering ID +func (id VirtualNetworkPeeringId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Virtual Network Peering Name: %q", id.VirtualNetworkPeeringName), + } + return fmt.Sprintf("Virtual Network Peering (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/id_virtualnetworkpeering_test.go b/resource-manager/databricks/2026-01-01/vnetpeering/id_virtualnetworkpeering_test.go new file mode 100644 index 00000000000..fd5bf6ffdc1 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/id_virtualnetworkpeering_test.go @@ -0,0 +1,327 @@ +package vnetpeering + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualNetworkPeeringId{} + +func TestNewVirtualNetworkPeeringID(t *testing.T) { + id := NewVirtualNetworkPeeringID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "virtualNetworkPeeringName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } + + if id.VirtualNetworkPeeringName != "virtualNetworkPeeringName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualNetworkPeeringName'", id.VirtualNetworkPeeringName, "virtualNetworkPeeringName") + } +} + +func TestFormatVirtualNetworkPeeringID(t *testing.T) { + actual := NewVirtualNetworkPeeringID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName", "virtualNetworkPeeringName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/virtualNetworkPeerings/virtualNetworkPeeringName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualNetworkPeeringID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualNetworkPeeringId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/virtualNetworkPeerings", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/virtualNetworkPeerings/virtualNetworkPeeringName", + Expected: &VirtualNetworkPeeringId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + VirtualNetworkPeeringName: "virtualNetworkPeeringName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/virtualNetworkPeerings/virtualNetworkPeeringName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualNetworkPeeringID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.VirtualNetworkPeeringName != v.Expected.VirtualNetworkPeeringName { + t.Fatalf("Expected %q but got %q for VirtualNetworkPeeringName", v.Expected.VirtualNetworkPeeringName, actual.VirtualNetworkPeeringName) + } + + } +} + +func TestParseVirtualNetworkPeeringIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualNetworkPeeringId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/virtualNetworkPeerings", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/vIrTuAlNeTwOrKpEeRiNgS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/virtualNetworkPeerings/virtualNetworkPeeringName", + Expected: &VirtualNetworkPeeringId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + VirtualNetworkPeeringName: "virtualNetworkPeeringName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/virtualNetworkPeerings/virtualNetworkPeeringName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/vIrTuAlNeTwOrKpEeRiNgS/vIrTuAlNeTwOrKpEeRiNgNaMe", + Expected: &VirtualNetworkPeeringId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + VirtualNetworkPeeringName: "vIrTuAlNeTwOrKpEeRiNgNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/vIrTuAlNeTwOrKpEeRiNgS/vIrTuAlNeTwOrKpEeRiNgNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualNetworkPeeringIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + if actual.VirtualNetworkPeeringName != v.Expected.VirtualNetworkPeeringName { + t.Fatalf("Expected %q but got %q for VirtualNetworkPeeringName", v.Expected.VirtualNetworkPeeringName, actual.VirtualNetworkPeeringName) + } + + } +} + +func TestSegmentsForVirtualNetworkPeeringId(t *testing.T) { + segments := VirtualNetworkPeeringId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualNetworkPeeringId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/id_workspace.go b/resource-manager/databricks/2026-01-01/vnetpeering/id_workspace.go new file mode 100644 index 00000000000..1b50a048f4f --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/id_workspace.go @@ -0,0 +1,130 @@ +package vnetpeering + +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(&WorkspaceId{}) +} + +var _ resourceids.ResourceId = &WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + return nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(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 := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/id_workspace_test.go b/resource-manager/databricks/2026-01-01/vnetpeering/id_workspace_test.go new file mode 100644 index 00000000000..57417ed9bb7 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/id_workspace_test.go @@ -0,0 +1,282 @@ +package vnetpeering + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &WorkspaceId{} + +func TestNewWorkspaceID(t *testing.T) { + id := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } +} + +func TestFormatWorkspaceID(t *testing.T) { + actual := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseWorkspaceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestParseWorkspaceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestSegmentsForWorkspaceId(t *testing.T) { + segments := WorkspaceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("WorkspaceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/method_createorupdate.go b/resource-manager/databricks/2026-01-01/vnetpeering/method_createorupdate.go new file mode 100644 index 00000000000..ae8ea15c159 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/method_createorupdate.go @@ -0,0 +1,75 @@ +package vnetpeering + +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 *VirtualNetworkPeering +} + +// CreateOrUpdate ... +func (c VNetPeeringClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkPeeringId, input VirtualNetworkPeering) (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 VNetPeeringClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkPeeringId, input VirtualNetworkPeering) 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/resource-manager/databricks/2026-01-01/vnetpeering/method_delete.go b/resource-manager/databricks/2026-01-01/vnetpeering/method_delete.go new file mode 100644 index 00000000000..8c95c41e46b --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/method_delete.go @@ -0,0 +1,71 @@ +package vnetpeering + +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 VNetPeeringClient) Delete(ctx context.Context, id VirtualNetworkPeeringId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VNetPeeringClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkPeeringId) 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/resource-manager/databricks/2026-01-01/vnetpeering/method_get.go b/resource-manager/databricks/2026-01-01/vnetpeering/method_get.go new file mode 100644 index 00000000000..af52e4b4637 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/method_get.go @@ -0,0 +1,54 @@ +package vnetpeering + +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 *VirtualNetworkPeering +} + +// Get ... +func (c VNetPeeringClient) Get(ctx context.Context, id VirtualNetworkPeeringId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + 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 VirtualNetworkPeering + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/method_listbyworkspace.go b/resource-manager/databricks/2026-01-01/vnetpeering/method_listbyworkspace.go new file mode 100644 index 00000000000..2d4acc8732b --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/method_listbyworkspace.go @@ -0,0 +1,105 @@ +package vnetpeering + +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 ListByWorkspaceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualNetworkPeering +} + +type ListByWorkspaceCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualNetworkPeering +} + +type ListByWorkspaceCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByWorkspaceCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByWorkspace ... +func (c VNetPeeringClient) ListByWorkspace(ctx context.Context, id WorkspaceId) (result ListByWorkspaceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByWorkspaceCustomPager{}, + Path: fmt.Sprintf("%s/virtualNetworkPeerings", 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 *[]VirtualNetworkPeering `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByWorkspaceComplete retrieves all the results into a single object +func (c VNetPeeringClient) ListByWorkspaceComplete(ctx context.Context, id WorkspaceId) (ListByWorkspaceCompleteResult, error) { + return c.ListByWorkspaceCompleteMatchingPredicate(ctx, id, VirtualNetworkPeeringOperationPredicate{}) +} + +// ListByWorkspaceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VNetPeeringClient) ListByWorkspaceCompleteMatchingPredicate(ctx context.Context, id WorkspaceId, predicate VirtualNetworkPeeringOperationPredicate) (result ListByWorkspaceCompleteResult, err error) { + items := make([]VirtualNetworkPeering, 0) + + resp, err := c.ListByWorkspace(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 = ListByWorkspaceCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/model_addressspace.go b/resource-manager/databricks/2026-01-01/vnetpeering/model_addressspace.go new file mode 100644 index 00000000000..a0274d74e9c --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/model_addressspace.go @@ -0,0 +1,8 @@ +package vnetpeering + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddressSpace struct { + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeering.go b/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeering.go new file mode 100644 index 00000000000..dfb94487771 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeering.go @@ -0,0 +1,11 @@ +package vnetpeering + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPeering struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties VirtualNetworkPeeringPropertiesFormat `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeeringpropertiesformat.go b/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeeringpropertiesformat.go new file mode 100644 index 00000000000..3be4e60e0be --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeeringpropertiesformat.go @@ -0,0 +1,17 @@ +package vnetpeering + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPeeringPropertiesFormat struct { + AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` + AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` + AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` + DatabricksAddressSpace *AddressSpace `json:"databricksAddressSpace,omitempty"` + DatabricksVirtualNetwork *VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork `json:"databricksVirtualNetwork,omitempty"` + PeeringState *PeeringState `json:"peeringState,omitempty"` + ProvisioningState *PeeringProvisioningState `json:"provisioningState,omitempty"` + RemoteAddressSpace *AddressSpace `json:"remoteAddressSpace,omitempty"` + RemoteVirtualNetwork VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork `json:"remoteVirtualNetwork"` + UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeeringpropertiesformatdatabricksvirtualnetwork.go b/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeeringpropertiesformatdatabricksvirtualnetwork.go new file mode 100644 index 00000000000..a9cd8bd10ff --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeeringpropertiesformatdatabricksvirtualnetwork.go @@ -0,0 +1,8 @@ +package vnetpeering + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeeringpropertiesformatremotevirtualnetwork.go b/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeeringpropertiesformatremotevirtualnetwork.go new file mode 100644 index 00000000000..117a1334c29 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/model_virtualnetworkpeeringpropertiesformatremotevirtualnetwork.go @@ -0,0 +1,8 @@ +package vnetpeering + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/vnetpeering/predicates.go b/resource-manager/databricks/2026-01-01/vnetpeering/predicates.go new file mode 100644 index 00000000000..bfbfcde0b68 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/predicates.go @@ -0,0 +1,27 @@ +package vnetpeering + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkPeeringOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VirtualNetworkPeeringOperationPredicate) Matches(input VirtualNetworkPeering) 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/resource-manager/databricks/2026-01-01/vnetpeering/version.go b/resource-manager/databricks/2026-01-01/vnetpeering/version.go new file mode 100644 index 00000000000..09185bc448a --- /dev/null +++ b/resource-manager/databricks/2026-01-01/vnetpeering/version.go @@ -0,0 +1,10 @@ +package vnetpeering + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2026-01-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/vnetpeering/2026-01-01" +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/README.md b/resource-manager/databricks/2026-01-01/workspaces/README.md new file mode 100644 index 00000000000..5e1503cb2d7 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2026-01-01/workspaces` Documentation + +The `workspaces` SDK allows for interaction with Azure Resource Manager `databricks` (API Version `2026-01-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/databricks/2026-01-01/workspaces" +``` + + +### Client Initialization + +```go +client := workspaces.NewWorkspacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkspacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + +payload := workspaces.Workspace{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `WorkspacesClient.Delete` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + +if err := client.DeleteThenPoll(ctx, id, workspaces.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `WorkspacesClient.Get` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + +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: `WorkspacesClient.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: `WorkspacesClient.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: `WorkspacesClient.Update` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + +payload := workspaces.WorkspaceUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/databricks/2026-01-01/workspaces/client.go b/resource-manager/databricks/2026-01-01/workspaces/client.go new file mode 100644 index 00000000000..c6ef3485d22 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/client.go @@ -0,0 +1,26 @@ +package workspaces + +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 WorkspacesClient struct { + Client *resourcemanager.Client +} + +func NewWorkspacesClientWithBaseURI(sdkApi sdkEnv.Api) (*WorkspacesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "workspaces", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating WorkspacesClient: %+v", err) + } + + return &WorkspacesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/constants.go b/resource-manager/databricks/2026-01-01/workspaces/constants.go new file mode 100644 index 00000000000..2df6d2702fb --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/constants.go @@ -0,0 +1,670 @@ +package workspaces + +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 AutomaticClusterUpdateValue string + +const ( + AutomaticClusterUpdateValueDisabled AutomaticClusterUpdateValue = "Disabled" + AutomaticClusterUpdateValueEnabled AutomaticClusterUpdateValue = "Enabled" +) + +func PossibleValuesForAutomaticClusterUpdateValue() []string { + return []string{ + string(AutomaticClusterUpdateValueDisabled), + string(AutomaticClusterUpdateValueEnabled), + } +} + +func (s *AutomaticClusterUpdateValue) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAutomaticClusterUpdateValue(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAutomaticClusterUpdateValue(input string) (*AutomaticClusterUpdateValue, error) { + vals := map[string]AutomaticClusterUpdateValue{ + "disabled": AutomaticClusterUpdateValueDisabled, + "enabled": AutomaticClusterUpdateValueEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomaticClusterUpdateValue(input) + return &out, nil +} + +type ComplianceSecurityProfileValue string + +const ( + ComplianceSecurityProfileValueDisabled ComplianceSecurityProfileValue = "Disabled" + ComplianceSecurityProfileValueEnabled ComplianceSecurityProfileValue = "Enabled" +) + +func PossibleValuesForComplianceSecurityProfileValue() []string { + return []string{ + string(ComplianceSecurityProfileValueDisabled), + string(ComplianceSecurityProfileValueEnabled), + } +} + +func (s *ComplianceSecurityProfileValue) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComplianceSecurityProfileValue(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComplianceSecurityProfileValue(input string) (*ComplianceSecurityProfileValue, error) { + vals := map[string]ComplianceSecurityProfileValue{ + "disabled": ComplianceSecurityProfileValueDisabled, + "enabled": ComplianceSecurityProfileValueEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComplianceSecurityProfileValue(input) + return &out, nil +} + +type ComputeMode string + +const ( + ComputeModeHybrid ComputeMode = "Hybrid" + ComputeModeServerless ComputeMode = "Serverless" +) + +func PossibleValuesForComputeMode() []string { + return []string{ + string(ComputeModeHybrid), + string(ComputeModeServerless), + } +} + +func (s *ComputeMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComputeMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComputeMode(input string) (*ComputeMode, error) { + vals := map[string]ComputeMode{ + "hybrid": ComputeModeHybrid, + "serverless": ComputeModeServerless, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeMode(input) + return &out, nil +} + +type CustomParameterType string + +const ( + CustomParameterTypeBool CustomParameterType = "Bool" + CustomParameterTypeObject CustomParameterType = "Object" + CustomParameterTypeString CustomParameterType = "String" +) + +func PossibleValuesForCustomParameterType() []string { + return []string{ + string(CustomParameterTypeBool), + string(CustomParameterTypeObject), + string(CustomParameterTypeString), + } +} + +func (s *CustomParameterType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCustomParameterType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCustomParameterType(input string) (*CustomParameterType, error) { + vals := map[string]CustomParameterType{ + "bool": CustomParameterTypeBool, + "object": CustomParameterTypeObject, + "string": CustomParameterTypeString, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomParameterType(input) + return &out, nil +} + +type DefaultStorageFirewall string + +const ( + DefaultStorageFirewallDisabled DefaultStorageFirewall = "Disabled" + DefaultStorageFirewallEnabled DefaultStorageFirewall = "Enabled" +) + +func PossibleValuesForDefaultStorageFirewall() []string { + return []string{ + string(DefaultStorageFirewallDisabled), + string(DefaultStorageFirewallEnabled), + } +} + +func (s *DefaultStorageFirewall) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDefaultStorageFirewall(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDefaultStorageFirewall(input string) (*DefaultStorageFirewall, error) { + vals := map[string]DefaultStorageFirewall{ + "disabled": DefaultStorageFirewallDisabled, + "enabled": DefaultStorageFirewallEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DefaultStorageFirewall(input) + return &out, nil +} + +type EncryptionKeySource string + +const ( + EncryptionKeySourceMicrosoftPointKeyvault EncryptionKeySource = "Microsoft.Keyvault" +) + +func PossibleValuesForEncryptionKeySource() []string { + return []string{ + string(EncryptionKeySourceMicrosoftPointKeyvault), + } +} + +func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEncryptionKeySource(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { + vals := map[string]EncryptionKeySource{ + "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyvault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EncryptionKeySource(input) + return &out, nil +} + +type EnhancedSecurityMonitoringValue string + +const ( + EnhancedSecurityMonitoringValueDisabled EnhancedSecurityMonitoringValue = "Disabled" + EnhancedSecurityMonitoringValueEnabled EnhancedSecurityMonitoringValue = "Enabled" +) + +func PossibleValuesForEnhancedSecurityMonitoringValue() []string { + return []string{ + string(EnhancedSecurityMonitoringValueDisabled), + string(EnhancedSecurityMonitoringValueEnabled), + } +} + +func (s *EnhancedSecurityMonitoringValue) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEnhancedSecurityMonitoringValue(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEnhancedSecurityMonitoringValue(input string) (*EnhancedSecurityMonitoringValue, error) { + vals := map[string]EnhancedSecurityMonitoringValue{ + "disabled": EnhancedSecurityMonitoringValueDisabled, + "enabled": EnhancedSecurityMonitoringValueEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnhancedSecurityMonitoringValue(input) + return &out, nil +} + +type IdentityType string + +const ( + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +func PossibleValuesForIdentityType() []string { + return []string{ + string(IdentityTypeSystemAssigned), + string(IdentityTypeUserAssigned), + } +} + +func (s *IdentityType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIdentityType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIdentityType(input string) (*IdentityType, error) { + vals := map[string]IdentityType{ + "systemassigned": IdentityTypeSystemAssigned, + "userassigned": IdentityTypeUserAssigned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IdentityType(input) + return &out, nil +} + +type InitialType string + +const ( + InitialTypeHiveMetastore InitialType = "HiveMetastore" + InitialTypeUnityCatalog InitialType = "UnityCatalog" +) + +func PossibleValuesForInitialType() []string { + return []string{ + string(InitialTypeHiveMetastore), + string(InitialTypeUnityCatalog), + } +} + +func (s *InitialType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInitialType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInitialType(input string) (*InitialType, error) { + vals := map[string]InitialType{ + "hivemetastore": InitialTypeHiveMetastore, + "unitycatalog": InitialTypeUnityCatalog, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InitialType(input) + return &out, nil +} + +type KeySource string + +const ( + KeySourceDefault KeySource = "Default" + KeySourceMicrosoftPointKeyvault KeySource = "Microsoft.Keyvault" +) + +func PossibleValuesForKeySource() []string { + return []string{ + string(KeySourceDefault), + string(KeySourceMicrosoftPointKeyvault), + } +} + +func (s *KeySource) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeySource(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseKeySource(input string) (*KeySource, error) { + vals := map[string]KeySource{ + "default": KeySourceDefault, + "microsoft.keyvault": KeySourceMicrosoftPointKeyvault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeySource(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + string(PrivateEndpointConnectionProvisioningStateUpdating), + } +} + +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + "updating": PrivateEndpointConnectionProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func (s *PrivateLinkServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateLinkServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateReady ProvisioningState = "Ready" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateReady), + string(ProvisioningStateRunning), + 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, + "created": ProvisioningStateCreated, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "ready": ProvisioningStateReady, + "running": ProvisioningStateRunning, + "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 PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type RequiredNsgRules string + +const ( + RequiredNsgRulesAllRules RequiredNsgRules = "AllRules" + RequiredNsgRulesNoAzureDatabricksRules RequiredNsgRules = "NoAzureDatabricksRules" + RequiredNsgRulesNoAzureServiceRules RequiredNsgRules = "NoAzureServiceRules" +) + +func PossibleValuesForRequiredNsgRules() []string { + return []string{ + string(RequiredNsgRulesAllRules), + string(RequiredNsgRulesNoAzureDatabricksRules), + string(RequiredNsgRulesNoAzureServiceRules), + } +} + +func (s *RequiredNsgRules) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRequiredNsgRules(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRequiredNsgRules(input string) (*RequiredNsgRules, error) { + vals := map[string]RequiredNsgRules{ + "allrules": RequiredNsgRulesAllRules, + "noazuredatabricksrules": RequiredNsgRulesNoAzureDatabricksRules, + "noazureservicerules": RequiredNsgRulesNoAzureServiceRules, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequiredNsgRules(input) + return &out, nil +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/id_workspace.go b/resource-manager/databricks/2026-01-01/workspaces/id_workspace.go new file mode 100644 index 00000000000..acd354f62e2 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/id_workspace.go @@ -0,0 +1,130 @@ +package workspaces + +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(&WorkspaceId{}) +} + +var _ resourceids.ResourceId = &WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := WorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) 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.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) + } + + return nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(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 := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceName"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/id_workspace_test.go b/resource-manager/databricks/2026-01-01/workspaces/id_workspace_test.go new file mode 100644 index 00000000000..f34e9d7a09c --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/id_workspace_test.go @@ -0,0 +1,282 @@ +package workspaces + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &WorkspaceId{} + +func TestNewWorkspaceID(t *testing.T) { + id := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.WorkspaceName != "workspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'WorkspaceName'", id.WorkspaceName, "workspaceName") + } +} + +func TestFormatWorkspaceID(t *testing.T) { + actual := NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseWorkspaceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestParseWorkspaceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *WorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + WorkspaceName: "workspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Databricks/workspaces/workspaceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe", + Expected: &WorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + WorkspaceName: "wOrKsPaCeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.dAtAbRiCkS/wOrKsPaCeS/wOrKsPaCeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseWorkspaceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.WorkspaceName != v.Expected.WorkspaceName { + t.Fatalf("Expected %q but got %q for WorkspaceName", v.Expected.WorkspaceName, actual.WorkspaceName) + } + + } +} + +func TestSegmentsForWorkspaceId(t *testing.T) { + segments := WorkspaceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("WorkspaceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/method_createorupdate.go b/resource-manager/databricks/2026-01-01/workspaces/method_createorupdate.go new file mode 100644 index 00000000000..cc4deaa2566 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/method_createorupdate.go @@ -0,0 +1,75 @@ +package workspaces + +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 *Workspace +} + +// CreateOrUpdate ... +func (c WorkspacesClient) CreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (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 WorkspacesClient) CreateOrUpdateThenPoll(ctx context.Context, id WorkspaceId, input Workspace) 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/resource-manager/databricks/2026-01-01/workspaces/method_delete.go b/resource-manager/databricks/2026-01-01/workspaces/method_delete.go new file mode 100644 index 00000000000..a5714b20575 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/method_delete.go @@ -0,0 +1,100 @@ +package workspaces + +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 +} + +type DeleteOperationOptions struct { + ForceDeletion *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ForceDeletion != nil { + out.Append("forceDeletion", fmt.Sprintf("%v", *o.ForceDeletion)) + } + return &out +} + +// Delete ... +func (c WorkspacesClient) Delete(ctx context.Context, id WorkspaceId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + OptionsObject: options, + 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 WorkspacesClient) DeleteThenPoll(ctx context.Context, id WorkspaceId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/resource-manager/databricks/2026-01-01/workspaces/method_get.go b/resource-manager/databricks/2026-01-01/workspaces/method_get.go new file mode 100644 index 00000000000..532c4ea30f7 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/method_get.go @@ -0,0 +1,53 @@ +package workspaces + +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 *Workspace +} + +// Get ... +func (c WorkspacesClient) Get(ctx context.Context, id WorkspaceId) (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 Workspace + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/method_listbyresourcegroup.go b/resource-manager/databricks/2026-01-01/workspaces/method_listbyresourcegroup.go new file mode 100644 index 00000000000..945d99c9cf5 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package workspaces + +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 *[]Workspace +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Workspace +} + +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 WorkspacesClient) 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.Databricks/workspaces", 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 *[]Workspace `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 WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c WorkspacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate WorkspaceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Workspace, 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/resource-manager/databricks/2026-01-01/workspaces/method_listbysubscription.go b/resource-manager/databricks/2026-01-01/workspaces/method_listbysubscription.go new file mode 100644 index 00000000000..a5acc65e357 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/method_listbysubscription.go @@ -0,0 +1,106 @@ +package workspaces + +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 *[]Workspace +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []Workspace +} + +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 WorkspacesClient) 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.Databricks/workspaces", 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 *[]Workspace `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 WorkspacesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c WorkspacesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate WorkspaceOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]Workspace, 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/resource-manager/databricks/2026-01-01/workspaces/method_update.go b/resource-manager/databricks/2026-01-01/workspaces/method_update.go new file mode 100644 index 00000000000..2065fc03b6c --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/method_update.go @@ -0,0 +1,75 @@ +package workspaces + +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 *Workspace +} + +// Update ... +func (c WorkspacesClient) Update(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) (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 WorkspacesClient) UpdateThenPoll(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) 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/resource-manager/databricks/2026-01-01/workspaces/model_automaticclusterupdatedefinition.go b/resource-manager/databricks/2026-01-01/workspaces/model_automaticclusterupdatedefinition.go new file mode 100644 index 00000000000..155168bd980 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_automaticclusterupdatedefinition.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticClusterUpdateDefinition struct { + Value *AutomaticClusterUpdateValue `json:"value,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_compliancesecurityprofiledefinition.go b/resource-manager/databricks/2026-01-01/workspaces/model_compliancesecurityprofiledefinition.go new file mode 100644 index 00000000000..62ebadea739 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_compliancesecurityprofiledefinition.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComplianceSecurityProfileDefinition struct { + ComplianceStandards *[]string `json:"complianceStandards,omitempty"` + Value *ComplianceSecurityProfileValue `json:"value,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_createdby.go b/resource-manager/databricks/2026-01-01/workspaces/model_createdby.go new file mode 100644 index 00000000000..fa06a35a393 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_createdby.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreatedBy struct { + ApplicationId *string `json:"applicationId,omitempty"` + Oid *string `json:"oid,omitempty"` + Puid *string `json:"puid,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_defaultcatalogproperties.go b/resource-manager/databricks/2026-01-01/workspaces/model_defaultcatalogproperties.go new file mode 100644 index 00000000000..511ef1ad94c --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_defaultcatalogproperties.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DefaultCatalogProperties struct { + InitialName *string `json:"initialName,omitempty"` + InitialType *InitialType `json:"initialType,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_encryption.go b/resource-manager/databricks/2026-01-01/workspaces/model_encryption.go new file mode 100644 index 00000000000..3d37fddd7e5 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_encryption.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Encryption struct { + KeyName *string `json:"KeyName,omitempty"` + KeySource *KeySource `json:"keySource,omitempty"` + Keyvaulturi *string `json:"keyvaulturi,omitempty"` + Keyversion *string `json:"keyversion,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_encryptionentitiesdefinition.go b/resource-manager/databricks/2026-01-01/workspaces/model_encryptionentitiesdefinition.go new file mode 100644 index 00000000000..df2cae1410b --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_encryptionentitiesdefinition.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionEntitiesDefinition struct { + ManagedDisk *ManagedDiskEncryption `json:"managedDisk,omitempty"` + ManagedServices *EncryptionV2 `json:"managedServices,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_encryptionv2.go b/resource-manager/databricks/2026-01-01/workspaces/model_encryptionv2.go new file mode 100644 index 00000000000..1569f86ef50 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_encryptionv2.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionV2 struct { + KeySource EncryptionKeySource `json:"keySource"` + KeyVaultProperties *EncryptionV2KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_encryptionv2keyvaultproperties.go b/resource-manager/databricks/2026-01-01/workspaces/model_encryptionv2keyvaultproperties.go new file mode 100644 index 00000000000..86adbd8c6a5 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_encryptionv2keyvaultproperties.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionV2KeyVaultProperties struct { + KeyName string `json:"keyName"` + KeyVaultUri string `json:"keyVaultUri"` + KeyVersion string `json:"keyVersion"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_enhancedsecuritycompliancedefinition.go b/resource-manager/databricks/2026-01-01/workspaces/model_enhancedsecuritycompliancedefinition.go new file mode 100644 index 00000000000..dad47ecca29 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_enhancedsecuritycompliancedefinition.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnhancedSecurityComplianceDefinition struct { + AutomaticClusterUpdate *AutomaticClusterUpdateDefinition `json:"automaticClusterUpdate,omitempty"` + ComplianceSecurityProfile *ComplianceSecurityProfileDefinition `json:"complianceSecurityProfile,omitempty"` + EnhancedSecurityMonitoring *EnhancedSecurityMonitoringDefinition `json:"enhancedSecurityMonitoring,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_enhancedsecuritymonitoringdefinition.go b/resource-manager/databricks/2026-01-01/workspaces/model_enhancedsecuritymonitoringdefinition.go new file mode 100644 index 00000000000..e5685c4a698 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_enhancedsecuritymonitoringdefinition.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnhancedSecurityMonitoringDefinition struct { + Value *EnhancedSecurityMonitoringValue `json:"value,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_manageddiskencryption.go b/resource-manager/databricks/2026-01-01/workspaces/model_manageddiskencryption.go new file mode 100644 index 00000000000..0374f44bdc3 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_manageddiskencryption.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskEncryption struct { + KeySource EncryptionKeySource `json:"keySource"` + KeyVaultProperties ManagedDiskEncryptionKeyVaultProperties `json:"keyVaultProperties"` + RotationToLatestKeyVersionEnabled *bool `json:"rotationToLatestKeyVersionEnabled,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_manageddiskencryptionkeyvaultproperties.go b/resource-manager/databricks/2026-01-01/workspaces/model_manageddiskencryptionkeyvaultproperties.go new file mode 100644 index 00000000000..a82d0ea2aa4 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_manageddiskencryptionkeyvaultproperties.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskEncryptionKeyVaultProperties struct { + KeyName string `json:"keyName"` + KeyVaultUri string `json:"keyVaultUri"` + KeyVersion string `json:"keyVersion"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_managedidentityconfiguration.go b/resource-manager/databricks/2026-01-01/workspaces/model_managedidentityconfiguration.go new file mode 100644 index 00000000000..aeea7f937c8 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_managedidentityconfiguration.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedIdentityConfiguration struct { + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_privateendpoint.go b/resource-manager/databricks/2026-01-01/workspaces/model_privateendpoint.go new file mode 100644 index 00000000000..9f81ff8b836 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_privateendpoint.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_privateendpointconnection.go b/resource-manager/databricks/2026-01-01/workspaces/model_privateendpointconnection.go new file mode 100644 index 00000000000..aee2db4a4b3 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties PrivateEndpointConnectionProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_privateendpointconnectionproperties.go b/resource-manager/databricks/2026-01-01/workspaces/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..f84ae62a2e0 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_privatelinkserviceconnectionstate.go b/resource-manager/databricks/2026-01-01/workspaces/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..e56c0b779bd --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status PrivateLinkServiceConnectionStatus `json:"status"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_sku.go b/resource-manager/databricks/2026-01-01/workspaces/model_sku.go new file mode 100644 index 00000000000..e5316e27b30 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_sku.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name string `json:"name"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspace.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspace.go new file mode 100644 index 00000000000..2a205ac1902 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspace.go @@ -0,0 +1,19 @@ +package workspaces + +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 Workspace struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties WorkspaceProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustombooleanparameter.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustombooleanparameter.go new file mode 100644 index 00000000000..a2e256bd2f0 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustombooleanparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomBooleanParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value bool `json:"value"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustomobjectparameter.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustomobjectparameter.go new file mode 100644 index 00000000000..85cfe098391 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustomobjectparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomObjectParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value interface{} `json:"value"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustomparameters.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustomparameters.go new file mode 100644 index 00000000000..3a48c1320d0 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustomparameters.go @@ -0,0 +1,23 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomParameters struct { + AmlWorkspaceId *WorkspaceCustomStringParameter `json:"amlWorkspaceId,omitempty"` + CustomPrivateSubnetName *WorkspaceCustomStringParameter `json:"customPrivateSubnetName,omitempty"` + CustomPublicSubnetName *WorkspaceCustomStringParameter `json:"customPublicSubnetName,omitempty"` + CustomVirtualNetworkId *WorkspaceCustomStringParameter `json:"customVirtualNetworkId,omitempty"` + EnableNoPublicIP *WorkspaceNoPublicIPBooleanParameter `json:"enableNoPublicIp,omitempty"` + Encryption *WorkspaceEncryptionParameter `json:"encryption,omitempty"` + LoadBalancerBackendPoolName *WorkspaceCustomStringParameter `json:"loadBalancerBackendPoolName,omitempty"` + LoadBalancerId *WorkspaceCustomStringParameter `json:"loadBalancerId,omitempty"` + NatGatewayName *WorkspaceCustomStringParameter `json:"natGatewayName,omitempty"` + PrepareEncryption *WorkspaceCustomBooleanParameter `json:"prepareEncryption,omitempty"` + PublicIPName *WorkspaceCustomStringParameter `json:"publicIpName,omitempty"` + RequireInfrastructureEncryption *WorkspaceCustomBooleanParameter `json:"requireInfrastructureEncryption,omitempty"` + ResourceTags *WorkspaceCustomObjectParameter `json:"resourceTags,omitempty"` + StorageAccountName *WorkspaceCustomStringParameter `json:"storageAccountName,omitempty"` + StorageAccountSkuName *WorkspaceCustomStringParameter `json:"storageAccountSkuName,omitempty"` + VnetAddressPrefix *WorkspaceCustomStringParameter `json:"vnetAddressPrefix,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustomstringparameter.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustomstringparameter.go new file mode 100644 index 00000000000..c983ffae968 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspacecustomstringparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomStringParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value string `json:"value"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspaceencryptionparameter.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspaceencryptionparameter.go new file mode 100644 index 00000000000..551ca748c04 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspaceencryptionparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceEncryptionParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value *Encryption `json:"value,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspacenopublicipbooleanparameter.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspacenopublicipbooleanparameter.go new file mode 100644 index 00000000000..67ec96998d6 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspacenopublicipbooleanparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceNoPublicIPBooleanParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value bool `json:"value"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspaceproperties.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspaceproperties.go new file mode 100644 index 00000000000..8770dbe68bb --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspaceproperties.go @@ -0,0 +1,48 @@ +package workspaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceProperties struct { + AccessConnector *WorkspacePropertiesAccessConnector `json:"accessConnector,omitempty"` + Authorizations *[]WorkspaceProviderAuthorization `json:"authorizations,omitempty"` + ComputeMode ComputeMode `json:"computeMode"` + CreatedBy *CreatedBy `json:"createdBy,omitempty"` + CreatedDateTime *string `json:"createdDateTime,omitempty"` + DefaultCatalog *DefaultCatalogProperties `json:"defaultCatalog,omitempty"` + DefaultStorageFirewall *DefaultStorageFirewall `json:"defaultStorageFirewall,omitempty"` + DiskEncryptionSetId *string `json:"diskEncryptionSetId,omitempty"` + Encryption *WorkspacePropertiesEncryption `json:"encryption,omitempty"` + EnhancedSecurityCompliance *EnhancedSecurityComplianceDefinition `json:"enhancedSecurityCompliance,omitempty"` + IsUcEnabled *bool `json:"isUcEnabled,omitempty"` + ManagedDiskIdentity *ManagedIdentityConfiguration `json:"managedDiskIdentity,omitempty"` + ManagedResourceGroupId *string `json:"managedResourceGroupId,omitempty"` + Parameters *WorkspaceCustomParameters `json:"parameters,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RequiredNsgRules *RequiredNsgRules `json:"requiredNsgRules,omitempty"` + StorageAccountIdentity *ManagedIdentityConfiguration `json:"storageAccountIdentity,omitempty"` + UiDefinitionUri *string `json:"uiDefinitionUri,omitempty"` + UpdatedBy *CreatedBy `json:"updatedBy,omitempty"` + WorkspaceId *string `json:"workspaceId,omitempty"` + WorkspaceURL *string `json:"workspaceUrl,omitempty"` +} + +func (o *WorkspaceProperties) GetCreatedDateTimeAsTime() (*time.Time, error) { + if o.CreatedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkspaceProperties) SetCreatedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDateTime = &formatted +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspacepropertiesaccessconnector.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspacepropertiesaccessconnector.go new file mode 100644 index 00000000000..e7f2faeb9a8 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspacepropertiesaccessconnector.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePropertiesAccessConnector struct { + Id string `json:"id"` + IdentityType IdentityType `json:"identityType"` + UserAssignedIdentityId *string `json:"userAssignedIdentityId,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspacepropertiesencryption.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspacepropertiesencryption.go new file mode 100644 index 00000000000..ddb3625ee74 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspacepropertiesencryption.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePropertiesEncryption struct { + Entities EncryptionEntitiesDefinition `json:"entities"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspaceproviderauthorization.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspaceproviderauthorization.go new file mode 100644 index 00000000000..98d6f732126 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspaceproviderauthorization.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceProviderAuthorization struct { + PrincipalId string `json:"principalId"` + RoleDefinitionId string `json:"roleDefinitionId"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/model_workspaceupdate.go b/resource-manager/databricks/2026-01-01/workspaces/model_workspaceupdate.go new file mode 100644 index 00000000000..079a43eda11 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/model_workspaceupdate.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/databricks/2026-01-01/workspaces/predicates.go b/resource-manager/databricks/2026-01-01/workspaces/predicates.go new file mode 100644 index 00000000000..487159d40b2 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/predicates.go @@ -0,0 +1,32 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p WorkspaceOperationPredicate) Matches(input Workspace) 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/resource-manager/databricks/2026-01-01/workspaces/version.go b/resource-manager/databricks/2026-01-01/workspaces/version.go new file mode 100644 index 00000000000..aab68cff367 --- /dev/null +++ b/resource-manager/databricks/2026-01-01/workspaces/version.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2026-01-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/workspaces/2026-01-01" +} diff --git a/resource-manager/datamigration/2025-06-30/customoperation/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/customoperation/model_connectioninfo.go index 1e62657e3a1..b900b18932b 100644 --- a/resource-manager/datamigration/2025-06-30/customoperation/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/customoperation/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/customoperation/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/customoperation/model_mongodbconnectioninfo.go index 06754bb9de4..6183bc078d8 100644 --- a/resource-manager/datamigration/2025-06-30/customoperation/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/customoperation/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go index 17449325861..7f4ef6edd53 100644 --- a/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go index 04df0597abd..f4b03f64482 100644 --- a/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/post/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/post/model_connectioninfo.go index 700e7f47af0..7669b6ae78d 100644 --- a/resource-manager/datamigration/2025-06-30/post/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/post/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/post/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/post/model_mongodbconnectioninfo.go index ab557aada0c..a400b59b083 100644 --- a/resource-manager/datamigration/2025-06-30/post/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/post/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/serviceresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/serviceresource/model_connectioninfo.go index 3047b7e0a50..6e9f1a364e2 100644 --- a/resource-manager/datamigration/2025-06-30/serviceresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/serviceresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/serviceresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/serviceresource/model_mongodbconnectioninfo.go index 3a521195e00..767bc368136 100644 --- a/resource-manager/datamigration/2025-06-30/serviceresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/serviceresource/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go index ec590fac48b..a2c64b788f0 100644 --- a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go index 65db8947ef2..1e1be2df7fa 100644 --- a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/standardoperation/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/standardoperation/model_connectioninfo.go index a817745d831..ec4f109cdf0 100644 --- a/resource-manager/datamigration/2025-06-30/standardoperation/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/standardoperation/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/standardoperation/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/standardoperation/model_mongodbconnectioninfo.go index 9f647ecb19e..c218c28c2d8 100644 --- a/resource-manager/datamigration/2025-06-30/standardoperation/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/standardoperation/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go index 75a9f172f04..41c28de5b58 100644 --- a/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go index 7fcca941b2c..c54f00935ed 100644 --- a/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go b/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go index 9007e4a33df..caa8b3c8747 100644 --- a/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go +++ b/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go @@ -217,8 +217,6 @@ func parseIsGlobal(input string) (*IsGlobal, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -227,8 +225,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -251,8 +247,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go b/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go index 6dbd1e6db74..67086d778e3 100644 --- a/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go +++ b/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go @@ -138,8 +138,6 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -148,8 +146,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -172,8 +168,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go b/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go index c5bc0377dcd..aa292723727 100644 --- a/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go +++ b/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go @@ -340,8 +340,6 @@ func parsePeeringEnforcement(input string) (*PeeringEnforcement, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -350,8 +348,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -374,8 +370,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go b/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go index 6dbd1e6db74..67086d778e3 100644 --- a/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go +++ b/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go @@ -138,8 +138,6 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -148,8 +146,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -172,8 +168,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go b/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go index 793caeabedc..c9291fb2fab 100644 --- a/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go @@ -138,8 +138,6 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -148,8 +146,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -172,8 +168,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go b/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go index 451770f8cbb..8195863c49a 100644 --- a/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go @@ -340,8 +340,6 @@ func parsePeeringEnforcement(input string) (*PeeringEnforcement, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -350,8 +348,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -374,8 +370,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2025-01-01/networkmanageractiveconfigurations/constants.go b/resource-manager/network/2025-01-01/networkmanageractiveconfigurations/constants.go index c9291fb2fab..793caeabedc 100644 --- a/resource-manager/network/2025-01-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2025-01-01/networkmanageractiveconfigurations/constants.go @@ -138,6 +138,8 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -146,6 +148,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -168,6 +172,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2025-01-01/networkmanageractiveconnectivityconfigurations/constants.go b/resource-manager/network/2025-01-01/networkmanageractiveconnectivityconfigurations/constants.go index 8195863c49a..451770f8cbb 100644 --- a/resource-manager/network/2025-01-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2025-01-01/networkmanageractiveconnectivityconfigurations/constants.go @@ -340,6 +340,8 @@ func parsePeeringEnforcement(input string) (*PeeringEnforcement, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -348,6 +350,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -370,6 +374,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_errordetail.go index 58e05ea4f02..c55cc388bf9 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_errordetail.go @@ -4,9 +4,7 @@ package backupprotecteditems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` - Code *string `json:"code,omitempty"` - Details *[]ErrorDetail `json:"details,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_erroradditionalinfo.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_erroradditionalinfo.go similarity index 100% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_erroradditionalinfo.go rename to resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_erroradditionalinfo.go diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_errordetail.go index c55cc388bf9..58e05ea4f02 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_errordetail.go @@ -4,7 +4,9 @@ package backupprotecteditems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_erroradditionalinfo.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_erroradditionalinfo.go similarity index 88% rename from resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_erroradditionalinfo.go rename to resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_erroradditionalinfo.go index 8e707921e70..6d8100b64e9 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_erroradditionalinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_erroradditionalinfo.go @@ -1,4 +1,4 @@ -package protecteditems +package backupprotectioncontainers // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go index 86008b3edcb..01bc67ec3f4 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go @@ -4,7 +4,9 @@ package backupprotectioncontainers // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go index cbf15d6fb2c..e3fa04c50a3 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go @@ -4,9 +4,7 @@ package protecteditems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` - Code *string `json:"code,omitempty"` - Details *[]ErrorDetail `json:"details,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,omitempty"` } diff --git a/resource-manager/storagediscovery/2025-09-01/client.go b/resource-manager/storagediscovery/2025-09-01/client.go new file mode 100644 index 00000000000..381136250a8 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/client.go @@ -0,0 +1,37 @@ +package v2025_09_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/storagediscovery/2025-09-01/report" + "github.com/hashicorp/go-azure-sdk/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + Report *report.ReportClient + StorageDiscoveryWorkspaces *storagediscoveryworkspaces.StorageDiscoveryWorkspacesClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + reportClient, err := report.NewReportClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Report client: %+v", err) + } + configureFunc(reportClient.Client) + + storageDiscoveryWorkspacesClient, err := storagediscoveryworkspaces.NewStorageDiscoveryWorkspacesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building StorageDiscoveryWorkspaces client: %+v", err) + } + configureFunc(storageDiscoveryWorkspacesClient.Client) + + return &Client{ + Report: reportClient, + StorageDiscoveryWorkspaces: storageDiscoveryWorkspacesClient, + }, nil +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/README.md b/resource-manager/storagediscovery/2025-09-01/report/README.md new file mode 100644 index 00000000000..3523505b024 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/README.md @@ -0,0 +1,87 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/storagediscovery/2025-09-01/report` Documentation + +The `report` SDK allows for interaction with Azure Resource Manager `storagediscovery` (API Version `2025-09-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/storagediscovery/2025-09-01/report" +``` + + +### Client Initialization + +```go +client := report.NewReportClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ReportClient.GenerateReport` + +```go +ctx := context.TODO() +id := report.NewReportID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName", "reportName") + +payload := report.GetReportContent{ + // ... +} + + +if err := client.GenerateReportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ReportClient.Get` + +```go +ctx := context.TODO() +id := report.NewReportID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName", "reportName") + +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: `ReportClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := report.NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName") + +// 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: `ReportClient.ListBySubscription` + +```go +ctx := context.TODO() +id := report.NewStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "storageDiscoveryWorkspaceName") + +// 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 +} +``` diff --git a/resource-manager/storagediscovery/2025-09-01/report/client.go b/resource-manager/storagediscovery/2025-09-01/report/client.go new file mode 100644 index 00000000000..e57b8bd1cda --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/client.go @@ -0,0 +1,26 @@ +package report + +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 ReportClient struct { + Client *resourcemanager.Client +} + +func NewReportClientWithBaseURI(sdkApi sdkEnv.Api) (*ReportClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "report", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ReportClient: %+v", err) + } + + return &ReportClient{ + Client: client, + }, nil +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/constants.go b/resource-manager/storagediscovery/2025-09-01/report/constants.go new file mode 100644 index 00000000000..de3199f4153 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/constants.go @@ -0,0 +1,54 @@ +package report + +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 ResourceProvisioningState string + +const ( + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForResourceProvisioningState() []string { + return []string{ + string(ResourceProvisioningStateCanceled), + string(ResourceProvisioningStateFailed), + string(ResourceProvisioningStateSucceeded), + } +} + +func (s *ResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceProvisioningState(input string) (*ResourceProvisioningState, error) { + vals := map[string]ResourceProvisioningState{ + "canceled": ResourceProvisioningStateCanceled, + "failed": ResourceProvisioningStateFailed, + "succeeded": ResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/id_providerstoragediscoveryworkspace.go b/resource-manager/storagediscovery/2025-09-01/report/id_providerstoragediscoveryworkspace.go new file mode 100644 index 00000000000..ccc62b2492f --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/id_providerstoragediscoveryworkspace.go @@ -0,0 +1,130 @@ +package report + +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(&ProviderStorageDiscoveryWorkspaceId{}) +} + +var _ resourceids.ResourceId = &ProviderStorageDiscoveryWorkspaceId{} + +// ProviderStorageDiscoveryWorkspaceId is a struct representing the Resource ID for a Provider Storage Discovery Workspace +type ProviderStorageDiscoveryWorkspaceId struct { + SubscriptionId string + ResourceGroupName string + StorageDiscoveryWorkspaceName string +} + +// NewProviderStorageDiscoveryWorkspaceID returns a new ProviderStorageDiscoveryWorkspaceId struct +func NewProviderStorageDiscoveryWorkspaceID(subscriptionId string, resourceGroupName string, storageDiscoveryWorkspaceName string) ProviderStorageDiscoveryWorkspaceId { + return ProviderStorageDiscoveryWorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageDiscoveryWorkspaceName: storageDiscoveryWorkspaceName, + } +} + +// ParseProviderStorageDiscoveryWorkspaceID parses 'input' into a ProviderStorageDiscoveryWorkspaceId +func ParseProviderStorageDiscoveryWorkspaceID(input string) (*ProviderStorageDiscoveryWorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderStorageDiscoveryWorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderStorageDiscoveryWorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProviderStorageDiscoveryWorkspaceIDInsensitively parses 'input' case-insensitively into a ProviderStorageDiscoveryWorkspaceId +// note: this method should only be used for API response data and not user input +func ParseProviderStorageDiscoveryWorkspaceIDInsensitively(input string) (*ProviderStorageDiscoveryWorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderStorageDiscoveryWorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderStorageDiscoveryWorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderStorageDiscoveryWorkspaceId) 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.StorageDiscoveryWorkspaceName, ok = input.Parsed["storageDiscoveryWorkspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageDiscoveryWorkspaceName", input) + } + + return nil +} + +// ValidateProviderStorageDiscoveryWorkspaceID checks that 'input' can be parsed as a Provider Storage Discovery Workspace ID +func ValidateProviderStorageDiscoveryWorkspaceID(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 := ParseProviderStorageDiscoveryWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Storage Discovery Workspace ID +func (id ProviderStorageDiscoveryWorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageDiscoveryWorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Storage Discovery Workspace ID +func (id ProviderStorageDiscoveryWorkspaceId) 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("staticMicrosoftStorageDiscovery", "Microsoft.StorageDiscovery", "Microsoft.StorageDiscovery"), + resourceids.StaticSegment("staticStorageDiscoveryWorkspaces", "storageDiscoveryWorkspaces", "storageDiscoveryWorkspaces"), + resourceids.UserSpecifiedSegment("storageDiscoveryWorkspaceName", "storageDiscoveryWorkspaceName"), + } +} + +// String returns a human-readable description of this Provider Storage Discovery Workspace ID +func (id ProviderStorageDiscoveryWorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Storage Discovery Workspace Name: %q", id.StorageDiscoveryWorkspaceName), + } + return fmt.Sprintf("Provider Storage Discovery Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/id_providerstoragediscoveryworkspace_test.go b/resource-manager/storagediscovery/2025-09-01/report/id_providerstoragediscoveryworkspace_test.go new file mode 100644 index 00000000000..b5b69ce291d --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/id_providerstoragediscoveryworkspace_test.go @@ -0,0 +1,282 @@ +package report + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ProviderStorageDiscoveryWorkspaceId{} + +func TestNewProviderStorageDiscoveryWorkspaceID(t *testing.T) { + id := NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.StorageDiscoveryWorkspaceName != "storageDiscoveryWorkspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'StorageDiscoveryWorkspaceName'", id.StorageDiscoveryWorkspaceName, "storageDiscoveryWorkspaceName") + } +} + +func TestFormatProviderStorageDiscoveryWorkspaceID(t *testing.T) { + actual := NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseProviderStorageDiscoveryWorkspaceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProviderStorageDiscoveryWorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName", + Expected: &ProviderStorageDiscoveryWorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + StorageDiscoveryWorkspaceName: "storageDiscoveryWorkspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProviderStorageDiscoveryWorkspaceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.StorageDiscoveryWorkspaceName != v.Expected.StorageDiscoveryWorkspaceName { + t.Fatalf("Expected %q but got %q for StorageDiscoveryWorkspaceName", v.Expected.StorageDiscoveryWorkspaceName, actual.StorageDiscoveryWorkspaceName) + } + + } +} + +func TestParseProviderStorageDiscoveryWorkspaceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProviderStorageDiscoveryWorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName", + Expected: &ProviderStorageDiscoveryWorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + StorageDiscoveryWorkspaceName: "storageDiscoveryWorkspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe", + Expected: &ProviderStorageDiscoveryWorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + StorageDiscoveryWorkspaceName: "sToRaGeDiScOvErYwOrKsPaCeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProviderStorageDiscoveryWorkspaceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.StorageDiscoveryWorkspaceName != v.Expected.StorageDiscoveryWorkspaceName { + t.Fatalf("Expected %q but got %q for StorageDiscoveryWorkspaceName", v.Expected.StorageDiscoveryWorkspaceName, actual.StorageDiscoveryWorkspaceName) + } + + } +} + +func TestSegmentsForProviderStorageDiscoveryWorkspaceId(t *testing.T) { + segments := ProviderStorageDiscoveryWorkspaceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ProviderStorageDiscoveryWorkspaceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/id_report.go b/resource-manager/storagediscovery/2025-09-01/report/id_report.go new file mode 100644 index 00000000000..8ff108ebf38 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/id_report.go @@ -0,0 +1,139 @@ +package report + +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(&ReportId{}) +} + +var _ resourceids.ResourceId = &ReportId{} + +// ReportId is a struct representing the Resource ID for a Report +type ReportId struct { + SubscriptionId string + ResourceGroupName string + StorageDiscoveryWorkspaceName string + ReportName string +} + +// NewReportID returns a new ReportId struct +func NewReportID(subscriptionId string, resourceGroupName string, storageDiscoveryWorkspaceName string, reportName string) ReportId { + return ReportId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageDiscoveryWorkspaceName: storageDiscoveryWorkspaceName, + ReportName: reportName, + } +} + +// ParseReportID parses 'input' into a ReportId +func ParseReportID(input string) (*ReportId, error) { + parser := resourceids.NewParserFromResourceIdType(&ReportId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ReportId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseReportIDInsensitively parses 'input' case-insensitively into a ReportId +// note: this method should only be used for API response data and not user input +func ParseReportIDInsensitively(input string) (*ReportId, error) { + parser := resourceids.NewParserFromResourceIdType(&ReportId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ReportId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReportId) 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.StorageDiscoveryWorkspaceName, ok = input.Parsed["storageDiscoveryWorkspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageDiscoveryWorkspaceName", input) + } + + if id.ReportName, ok = input.Parsed["reportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportName", input) + } + + return nil +} + +// ValidateReportID checks that 'input' can be parsed as a Report ID +func ValidateReportID(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 := ParseReportID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Report ID +func (id ReportId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/%s/reports/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageDiscoveryWorkspaceName, id.ReportName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Report ID +func (id ReportId) 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("staticMicrosoftStorageDiscovery", "Microsoft.StorageDiscovery", "Microsoft.StorageDiscovery"), + resourceids.StaticSegment("staticStorageDiscoveryWorkspaces", "storageDiscoveryWorkspaces", "storageDiscoveryWorkspaces"), + resourceids.UserSpecifiedSegment("storageDiscoveryWorkspaceName", "storageDiscoveryWorkspaceName"), + resourceids.StaticSegment("staticReports", "reports", "reports"), + resourceids.UserSpecifiedSegment("reportName", "reportName"), + } +} + +// String returns a human-readable description of this Report ID +func (id ReportId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Storage Discovery Workspace Name: %q", id.StorageDiscoveryWorkspaceName), + fmt.Sprintf("Report Name: %q", id.ReportName), + } + return fmt.Sprintf("Report (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/id_report_test.go b/resource-manager/storagediscovery/2025-09-01/report/id_report_test.go new file mode 100644 index 00000000000..3da2878d3e8 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/id_report_test.go @@ -0,0 +1,327 @@ +package report + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ReportId{} + +func TestNewReportID(t *testing.T) { + id := NewReportID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName", "reportName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.StorageDiscoveryWorkspaceName != "storageDiscoveryWorkspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'StorageDiscoveryWorkspaceName'", id.StorageDiscoveryWorkspaceName, "storageDiscoveryWorkspaceName") + } + + if id.ReportName != "reportName" { + t.Fatalf("Expected %q but got %q for Segment 'ReportName'", id.ReportName, "reportName") + } +} + +func TestFormatReportID(t *testing.T) { + actual := NewReportID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName", "reportName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/reports/reportName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseReportID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ReportId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/reports", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/reports/reportName", + Expected: &ReportId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + StorageDiscoveryWorkspaceName: "storageDiscoveryWorkspaceName", + ReportName: "reportName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/reports/reportName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseReportID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.StorageDiscoveryWorkspaceName != v.Expected.StorageDiscoveryWorkspaceName { + t.Fatalf("Expected %q but got %q for StorageDiscoveryWorkspaceName", v.Expected.StorageDiscoveryWorkspaceName, actual.StorageDiscoveryWorkspaceName) + } + + if actual.ReportName != v.Expected.ReportName { + t.Fatalf("Expected %q but got %q for ReportName", v.Expected.ReportName, actual.ReportName) + } + + } +} + +func TestParseReportIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ReportId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/reports", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe/rEpOrTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/reports/reportName", + Expected: &ReportId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + StorageDiscoveryWorkspaceName: "storageDiscoveryWorkspaceName", + ReportName: "reportName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/reports/reportName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe/rEpOrTs/rEpOrTnAmE", + Expected: &ReportId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + StorageDiscoveryWorkspaceName: "sToRaGeDiScOvErYwOrKsPaCeNaMe", + ReportName: "rEpOrTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe/rEpOrTs/rEpOrTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseReportIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.StorageDiscoveryWorkspaceName != v.Expected.StorageDiscoveryWorkspaceName { + t.Fatalf("Expected %q but got %q for StorageDiscoveryWorkspaceName", v.Expected.StorageDiscoveryWorkspaceName, actual.StorageDiscoveryWorkspaceName) + } + + if actual.ReportName != v.Expected.ReportName { + t.Fatalf("Expected %q but got %q for ReportName", v.Expected.ReportName, actual.ReportName) + } + + } +} + +func TestSegmentsForReportId(t *testing.T) { + segments := ReportId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ReportId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/id_storagediscoveryworkspace.go b/resource-manager/storagediscovery/2025-09-01/report/id_storagediscoveryworkspace.go new file mode 100644 index 00000000000..0950163b8a3 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/id_storagediscoveryworkspace.go @@ -0,0 +1,121 @@ +package report + +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(&StorageDiscoveryWorkspaceId{}) +} + +var _ resourceids.ResourceId = &StorageDiscoveryWorkspaceId{} + +// StorageDiscoveryWorkspaceId is a struct representing the Resource ID for a Storage Discovery Workspace +type StorageDiscoveryWorkspaceId struct { + SubscriptionId string + StorageDiscoveryWorkspaceName string +} + +// NewStorageDiscoveryWorkspaceID returns a new StorageDiscoveryWorkspaceId struct +func NewStorageDiscoveryWorkspaceID(subscriptionId string, storageDiscoveryWorkspaceName string) StorageDiscoveryWorkspaceId { + return StorageDiscoveryWorkspaceId{ + SubscriptionId: subscriptionId, + StorageDiscoveryWorkspaceName: storageDiscoveryWorkspaceName, + } +} + +// ParseStorageDiscoveryWorkspaceID parses 'input' into a StorageDiscoveryWorkspaceId +func ParseStorageDiscoveryWorkspaceID(input string) (*StorageDiscoveryWorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&StorageDiscoveryWorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := StorageDiscoveryWorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseStorageDiscoveryWorkspaceIDInsensitively parses 'input' case-insensitively into a StorageDiscoveryWorkspaceId +// note: this method should only be used for API response data and not user input +func ParseStorageDiscoveryWorkspaceIDInsensitively(input string) (*StorageDiscoveryWorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&StorageDiscoveryWorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := StorageDiscoveryWorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageDiscoveryWorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.StorageDiscoveryWorkspaceName, ok = input.Parsed["storageDiscoveryWorkspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageDiscoveryWorkspaceName", input) + } + + return nil +} + +// ValidateStorageDiscoveryWorkspaceID checks that 'input' can be parsed as a Storage Discovery Workspace ID +func ValidateStorageDiscoveryWorkspaceID(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 := ParseStorageDiscoveryWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Storage Discovery Workspace ID +func (id StorageDiscoveryWorkspaceId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.StorageDiscoveryWorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Storage Discovery Workspace ID +func (id StorageDiscoveryWorkspaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftStorageDiscovery", "Microsoft.StorageDiscovery", "Microsoft.StorageDiscovery"), + resourceids.StaticSegment("staticStorageDiscoveryWorkspaces", "storageDiscoveryWorkspaces", "storageDiscoveryWorkspaces"), + resourceids.UserSpecifiedSegment("storageDiscoveryWorkspaceName", "storageDiscoveryWorkspaceName"), + } +} + +// String returns a human-readable description of this Storage Discovery Workspace ID +func (id StorageDiscoveryWorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Storage Discovery Workspace Name: %q", id.StorageDiscoveryWorkspaceName), + } + return fmt.Sprintf("Storage Discovery Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/id_storagediscoveryworkspace_test.go b/resource-manager/storagediscovery/2025-09-01/report/id_storagediscoveryworkspace_test.go new file mode 100644 index 00000000000..a1b0e466a7d --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/id_storagediscoveryworkspace_test.go @@ -0,0 +1,237 @@ +package report + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &StorageDiscoveryWorkspaceId{} + +func TestNewStorageDiscoveryWorkspaceID(t *testing.T) { + id := NewStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "storageDiscoveryWorkspaceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.StorageDiscoveryWorkspaceName != "storageDiscoveryWorkspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'StorageDiscoveryWorkspaceName'", id.StorageDiscoveryWorkspaceName, "storageDiscoveryWorkspaceName") + } +} + +func TestFormatStorageDiscoveryWorkspaceID(t *testing.T) { + actual := NewStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "storageDiscoveryWorkspaceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseStorageDiscoveryWorkspaceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *StorageDiscoveryWorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.StorageDiscovery", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName", + Expected: &StorageDiscoveryWorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + StorageDiscoveryWorkspaceName: "storageDiscoveryWorkspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseStorageDiscoveryWorkspaceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.StorageDiscoveryWorkspaceName != v.Expected.StorageDiscoveryWorkspaceName { + t.Fatalf("Expected %q but got %q for StorageDiscoveryWorkspaceName", v.Expected.StorageDiscoveryWorkspaceName, actual.StorageDiscoveryWorkspaceName) + } + + } +} + +func TestParseStorageDiscoveryWorkspaceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *StorageDiscoveryWorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.StorageDiscovery", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName", + Expected: &StorageDiscoveryWorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + StorageDiscoveryWorkspaceName: "storageDiscoveryWorkspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe", + Expected: &StorageDiscoveryWorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + StorageDiscoveryWorkspaceName: "sToRaGeDiScOvErYwOrKsPaCeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseStorageDiscoveryWorkspaceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.StorageDiscoveryWorkspaceName != v.Expected.StorageDiscoveryWorkspaceName { + t.Fatalf("Expected %q but got %q for StorageDiscoveryWorkspaceName", v.Expected.StorageDiscoveryWorkspaceName, actual.StorageDiscoveryWorkspaceName) + } + + } +} + +func TestSegmentsForStorageDiscoveryWorkspaceId(t *testing.T) { + segments := StorageDiscoveryWorkspaceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("StorageDiscoveryWorkspaceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/method_generatereport.go b/resource-manager/storagediscovery/2025-09-01/report/method_generatereport.go new file mode 100644 index 00000000000..91419e3318d --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/method_generatereport.go @@ -0,0 +1,75 @@ +package report + +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 GenerateReportOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *GetReportResult +} + +// GenerateReport ... +func (c ReportClient) GenerateReport(ctx context.Context, id ReportId, input GetReportContent) (result GenerateReportOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateReport", 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 +} + +// GenerateReportThenPoll performs GenerateReport then polls until it's completed +func (c ReportClient) GenerateReportThenPoll(ctx context.Context, id ReportId, input GetReportContent) error { + result, err := c.GenerateReport(ctx, id, input) + if err != nil { + return fmt.Errorf("performing GenerateReport: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GenerateReport: %+v", err) + } + + return nil +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/method_get.go b/resource-manager/storagediscovery/2025-09-01/report/method_get.go new file mode 100644 index 00000000000..0ee2b2eb151 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/method_get.go @@ -0,0 +1,53 @@ +package report + +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 *ReportResource +} + +// Get ... +func (c ReportClient) Get(ctx context.Context, id ReportId) (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 ReportResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/method_listbyresourcegroup.go b/resource-manager/storagediscovery/2025-09-01/report/method_listbyresourcegroup.go new file mode 100644 index 00000000000..568baec9112 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/method_listbyresourcegroup.go @@ -0,0 +1,105 @@ +package report + +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportResource +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ReportResource +} + +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 ReportClient) ListByResourceGroup(ctx context.Context, id ProviderStorageDiscoveryWorkspaceId) (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/reports", 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 *[]ReportResource `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 ReportClient) ListByResourceGroupComplete(ctx context.Context, id ProviderStorageDiscoveryWorkspaceId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ReportResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ProviderStorageDiscoveryWorkspaceId, predicate ReportResourceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ReportResource, 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/resource-manager/storagediscovery/2025-09-01/report/method_listbysubscription.go b/resource-manager/storagediscovery/2025-09-01/report/method_listbysubscription.go new file mode 100644 index 00000000000..46f9c8f1fdd --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/method_listbysubscription.go @@ -0,0 +1,105 @@ +package report + +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 ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportResource +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []ReportResource +} + +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 ReportClient) ListBySubscription(ctx context.Context, id StorageDiscoveryWorkspaceId) (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/reports", 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 *[]ReportResource `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 ReportClient) ListBySubscriptionComplete(ctx context.Context, id StorageDiscoveryWorkspaceId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ReportResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id StorageDiscoveryWorkspaceId, predicate ReportResourceOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ReportResource, 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/resource-manager/storagediscovery/2025-09-01/report/model_getreportcontent.go b/resource-manager/storagediscovery/2025-09-01/report/model_getreportcontent.go new file mode 100644 index 00000000000..8918b9552ea --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/model_getreportcontent.go @@ -0,0 +1,8 @@ +package report + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetReportContent struct { + Queries []string `json:"queries"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/model_getreportresult.go b/resource-manager/storagediscovery/2025-09-01/report/model_getreportresult.go new file mode 100644 index 00000000000..543d7e60ccb --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/model_getreportresult.go @@ -0,0 +1,8 @@ +package report + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetReportResult struct { + Results []ReportResultSet `json:"results"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/model_reportproperties.go b/resource-manager/storagediscovery/2025-09-01/report/model_reportproperties.go new file mode 100644 index 00000000000..c2c397ae0a2 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/model_reportproperties.go @@ -0,0 +1,8 @@ +package report + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReportProperties struct { + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/model_reportresource.go b/resource-manager/storagediscovery/2025-09-01/report/model_reportresource.go new file mode 100644 index 00000000000..c75991dea13 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/model_reportresource.go @@ -0,0 +1,16 @@ +package report + +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 ReportResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ReportProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/model_reportresultcolumn.go b/resource-manager/storagediscovery/2025-09-01/report/model_reportresultcolumn.go new file mode 100644 index 00000000000..01534419d6b --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/model_reportresultcolumn.go @@ -0,0 +1,9 @@ +package report + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReportResultColumn struct { + Name string `json:"name"` + Type string `json:"type"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/model_reportresultset.go b/resource-manager/storagediscovery/2025-09-01/report/model_reportresultset.go new file mode 100644 index 00000000000..cda689e84a2 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/model_reportresultset.go @@ -0,0 +1,10 @@ +package report + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReportResultSet struct { + Columns *[]ReportResultColumn `json:"columns,omitempty"` + ErrorCode *string `json:"errorCode,omitempty"` + Rows *[][]string `json:"rows,omitempty"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/report/predicates.go b/resource-manager/storagediscovery/2025-09-01/report/predicates.go new file mode 100644 index 00000000000..ebf95202b01 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/predicates.go @@ -0,0 +1,27 @@ +package report + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReportResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ReportResourceOperationPredicate) Matches(input ReportResource) 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/resource-manager/storagediscovery/2025-09-01/report/version.go b/resource-manager/storagediscovery/2025-09-01/report/version.go new file mode 100644 index 00000000000..394bda29694 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/report/version.go @@ -0,0 +1,10 @@ +package report + +// 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-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/report/2025-09-01" +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/README.md b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/README.md new file mode 100644 index 00000000000..986d7166d6e --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/README.md @@ -0,0 +1,146 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces` Documentation + +The `storagediscoveryworkspaces` SDK allows for interaction with Azure Resource Manager `storagediscovery` (API Version `2025-09-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/storagediscovery/2025-09-01/storagediscoveryworkspaces" +``` + + +### Client Initialization + +```go +client := storagediscoveryworkspaces.NewStorageDiscoveryWorkspacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `StorageDiscoveryWorkspacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := storagediscoveryworkspaces.NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName") + +payload := storagediscoveryworkspaces.StorageDiscoveryWorkspace{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `StorageDiscoveryWorkspacesClient.Delete` + +```go +ctx := context.TODO() +id := storagediscoveryworkspaces.NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `StorageDiscoveryWorkspacesClient.Get` + +```go +ctx := context.TODO() +id := storagediscoveryworkspaces.NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName") + +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: `StorageDiscoveryWorkspacesClient.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: `StorageDiscoveryWorkspacesClient.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: `StorageDiscoveryWorkspacesClient.Report` + +```go +ctx := context.TODO() +id := storagediscoveryworkspaces.NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName") + +payload := storagediscoveryworkspaces.GetReportContent{ + // ... +} + + +if err := client.ReportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `StorageDiscoveryWorkspacesClient.Update` + +```go +ctx := context.TODO() +id := storagediscoveryworkspaces.NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName") + +payload := storagediscoveryworkspaces.StorageDiscoveryWorkspaceUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/client.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/client.go new file mode 100644 index 00000000000..c5ddfcdfe64 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/client.go @@ -0,0 +1,26 @@ +package storagediscoveryworkspaces + +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 StorageDiscoveryWorkspacesClient struct { + Client *resourcemanager.Client +} + +func NewStorageDiscoveryWorkspacesClientWithBaseURI(sdkApi sdkEnv.Api) (*StorageDiscoveryWorkspacesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "storagediscoveryworkspaces", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating StorageDiscoveryWorkspacesClient: %+v", err) + } + + return &StorageDiscoveryWorkspacesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/constants.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/constants.go new file mode 100644 index 00000000000..f61f200f80b --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/constants.go @@ -0,0 +1,133 @@ +package storagediscoveryworkspaces + +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 ResourceProvisioningState string + +const ( + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForResourceProvisioningState() []string { + return []string{ + string(ResourceProvisioningStateCanceled), + string(ResourceProvisioningStateFailed), + string(ResourceProvisioningStateSucceeded), + } +} + +func (s *ResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceProvisioningState(input string) (*ResourceProvisioningState, error) { + vals := map[string]ResourceProvisioningState{ + "canceled": ResourceProvisioningStateCanceled, + "failed": ResourceProvisioningStateFailed, + "succeeded": ResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceProvisioningState(input) + return &out, nil +} + +type StorageDiscoveryResourceType string + +const ( + StorageDiscoveryResourceTypeMicrosoftPointStorageStorageAccounts StorageDiscoveryResourceType = "Microsoft.Storage/storageAccounts" +) + +func PossibleValuesForStorageDiscoveryResourceType() []string { + return []string{ + string(StorageDiscoveryResourceTypeMicrosoftPointStorageStorageAccounts), + } +} + +func (s *StorageDiscoveryResourceType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageDiscoveryResourceType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageDiscoveryResourceType(input string) (*StorageDiscoveryResourceType, error) { + vals := map[string]StorageDiscoveryResourceType{ + "microsoft.storage/storageaccounts": StorageDiscoveryResourceTypeMicrosoftPointStorageStorageAccounts, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageDiscoveryResourceType(input) + return &out, nil +} + +type StorageDiscoverySku string + +const ( + StorageDiscoverySkuFree StorageDiscoverySku = "Free" + StorageDiscoverySkuStandard StorageDiscoverySku = "Standard" +) + +func PossibleValuesForStorageDiscoverySku() []string { + return []string{ + string(StorageDiscoverySkuFree), + string(StorageDiscoverySkuStandard), + } +} + +func (s *StorageDiscoverySku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageDiscoverySku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageDiscoverySku(input string) (*StorageDiscoverySku, error) { + vals := map[string]StorageDiscoverySku{ + "free": StorageDiscoverySkuFree, + "standard": StorageDiscoverySkuStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageDiscoverySku(input) + return &out, nil +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/id_providerstoragediscoveryworkspace.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/id_providerstoragediscoveryworkspace.go new file mode 100644 index 00000000000..7f885d16061 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/id_providerstoragediscoveryworkspace.go @@ -0,0 +1,130 @@ +package storagediscoveryworkspaces + +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(&ProviderStorageDiscoveryWorkspaceId{}) +} + +var _ resourceids.ResourceId = &ProviderStorageDiscoveryWorkspaceId{} + +// ProviderStorageDiscoveryWorkspaceId is a struct representing the Resource ID for a Provider Storage Discovery Workspace +type ProviderStorageDiscoveryWorkspaceId struct { + SubscriptionId string + ResourceGroupName string + StorageDiscoveryWorkspaceName string +} + +// NewProviderStorageDiscoveryWorkspaceID returns a new ProviderStorageDiscoveryWorkspaceId struct +func NewProviderStorageDiscoveryWorkspaceID(subscriptionId string, resourceGroupName string, storageDiscoveryWorkspaceName string) ProviderStorageDiscoveryWorkspaceId { + return ProviderStorageDiscoveryWorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageDiscoveryWorkspaceName: storageDiscoveryWorkspaceName, + } +} + +// ParseProviderStorageDiscoveryWorkspaceID parses 'input' into a ProviderStorageDiscoveryWorkspaceId +func ParseProviderStorageDiscoveryWorkspaceID(input string) (*ProviderStorageDiscoveryWorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderStorageDiscoveryWorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderStorageDiscoveryWorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProviderStorageDiscoveryWorkspaceIDInsensitively parses 'input' case-insensitively into a ProviderStorageDiscoveryWorkspaceId +// note: this method should only be used for API response data and not user input +func ParseProviderStorageDiscoveryWorkspaceIDInsensitively(input string) (*ProviderStorageDiscoveryWorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderStorageDiscoveryWorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderStorageDiscoveryWorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderStorageDiscoveryWorkspaceId) 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.StorageDiscoveryWorkspaceName, ok = input.Parsed["storageDiscoveryWorkspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageDiscoveryWorkspaceName", input) + } + + return nil +} + +// ValidateProviderStorageDiscoveryWorkspaceID checks that 'input' can be parsed as a Provider Storage Discovery Workspace ID +func ValidateProviderStorageDiscoveryWorkspaceID(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 := ParseProviderStorageDiscoveryWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Storage Discovery Workspace ID +func (id ProviderStorageDiscoveryWorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageDiscoveryWorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Storage Discovery Workspace ID +func (id ProviderStorageDiscoveryWorkspaceId) 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("staticMicrosoftStorageDiscovery", "Microsoft.StorageDiscovery", "Microsoft.StorageDiscovery"), + resourceids.StaticSegment("staticStorageDiscoveryWorkspaces", "storageDiscoveryWorkspaces", "storageDiscoveryWorkspaces"), + resourceids.UserSpecifiedSegment("storageDiscoveryWorkspaceName", "storageDiscoveryWorkspaceName"), + } +} + +// String returns a human-readable description of this Provider Storage Discovery Workspace ID +func (id ProviderStorageDiscoveryWorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Storage Discovery Workspace Name: %q", id.StorageDiscoveryWorkspaceName), + } + return fmt.Sprintf("Provider Storage Discovery Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/id_providerstoragediscoveryworkspace_test.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/id_providerstoragediscoveryworkspace_test.go new file mode 100644 index 00000000000..97416e7ffbb --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/id_providerstoragediscoveryworkspace_test.go @@ -0,0 +1,282 @@ +package storagediscoveryworkspaces + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ProviderStorageDiscoveryWorkspaceId{} + +func TestNewProviderStorageDiscoveryWorkspaceID(t *testing.T) { + id := NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.StorageDiscoveryWorkspaceName != "storageDiscoveryWorkspaceName" { + t.Fatalf("Expected %q but got %q for Segment 'StorageDiscoveryWorkspaceName'", id.StorageDiscoveryWorkspaceName, "storageDiscoveryWorkspaceName") + } +} + +func TestFormatProviderStorageDiscoveryWorkspaceID(t *testing.T) { + actual := NewProviderStorageDiscoveryWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageDiscoveryWorkspaceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseProviderStorageDiscoveryWorkspaceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProviderStorageDiscoveryWorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName", + Expected: &ProviderStorageDiscoveryWorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + StorageDiscoveryWorkspaceName: "storageDiscoveryWorkspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProviderStorageDiscoveryWorkspaceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.StorageDiscoveryWorkspaceName != v.Expected.StorageDiscoveryWorkspaceName { + t.Fatalf("Expected %q but got %q for StorageDiscoveryWorkspaceName", v.Expected.StorageDiscoveryWorkspaceName, actual.StorageDiscoveryWorkspaceName) + } + + } +} + +func TestParseProviderStorageDiscoveryWorkspaceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProviderStorageDiscoveryWorkspaceId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName", + Expected: &ProviderStorageDiscoveryWorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + StorageDiscoveryWorkspaceName: "storageDiscoveryWorkspaceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageDiscovery/storageDiscoveryWorkspaces/storageDiscoveryWorkspaceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe", + Expected: &ProviderStorageDiscoveryWorkspaceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + StorageDiscoveryWorkspaceName: "sToRaGeDiScOvErYwOrKsPaCeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.sToRaGeDiScOvErY/sToRaGeDiScOvErYwOrKsPaCeS/sToRaGeDiScOvErYwOrKsPaCeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProviderStorageDiscoveryWorkspaceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.StorageDiscoveryWorkspaceName != v.Expected.StorageDiscoveryWorkspaceName { + t.Fatalf("Expected %q but got %q for StorageDiscoveryWorkspaceName", v.Expected.StorageDiscoveryWorkspaceName, actual.StorageDiscoveryWorkspaceName) + } + + } +} + +func TestSegmentsForProviderStorageDiscoveryWorkspaceId(t *testing.T) { + segments := ProviderStorageDiscoveryWorkspaceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ProviderStorageDiscoveryWorkspaceId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_createorupdate.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_createorupdate.go new file mode 100644 index 00000000000..76e453e6ff0 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_createorupdate.go @@ -0,0 +1,58 @@ +package storagediscoveryworkspaces + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *StorageDiscoveryWorkspace +} + +// CreateOrUpdate ... +func (c StorageDiscoveryWorkspacesClient) CreateOrUpdate(ctx context.Context, id ProviderStorageDiscoveryWorkspaceId, input StorageDiscoveryWorkspace) (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 + } + + var model StorageDiscoveryWorkspace + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_delete.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_delete.go new file mode 100644 index 00000000000..99071059739 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_delete.go @@ -0,0 +1,47 @@ +package storagediscoveryworkspaces + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c StorageDiscoveryWorkspacesClient) Delete(ctx context.Context, id ProviderStorageDiscoveryWorkspaceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_get.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_get.go new file mode 100644 index 00000000000..20bb085e156 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_get.go @@ -0,0 +1,53 @@ +package storagediscoveryworkspaces + +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 *StorageDiscoveryWorkspace +} + +// Get ... +func (c StorageDiscoveryWorkspacesClient) Get(ctx context.Context, id ProviderStorageDiscoveryWorkspaceId) (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 StorageDiscoveryWorkspace + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_listbyresourcegroup.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_listbyresourcegroup.go new file mode 100644 index 00000000000..654885339fe --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package storagediscoveryworkspaces + +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 *[]StorageDiscoveryWorkspace +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []StorageDiscoveryWorkspace +} + +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 StorageDiscoveryWorkspacesClient) 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.StorageDiscovery/storageDiscoveryWorkspaces", 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 *[]StorageDiscoveryWorkspace `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 StorageDiscoveryWorkspacesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, StorageDiscoveryWorkspaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c StorageDiscoveryWorkspacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate StorageDiscoveryWorkspaceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]StorageDiscoveryWorkspace, 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/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_listbysubscription.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_listbysubscription.go new file mode 100644 index 00000000000..0e3c7b59068 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_listbysubscription.go @@ -0,0 +1,106 @@ +package storagediscoveryworkspaces + +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 *[]StorageDiscoveryWorkspace +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []StorageDiscoveryWorkspace +} + +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 StorageDiscoveryWorkspacesClient) 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.StorageDiscovery/storageDiscoveryWorkspaces", 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 *[]StorageDiscoveryWorkspace `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 StorageDiscoveryWorkspacesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, StorageDiscoveryWorkspaceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c StorageDiscoveryWorkspacesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate StorageDiscoveryWorkspaceOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]StorageDiscoveryWorkspace, 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/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_report.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_report.go new file mode 100644 index 00000000000..73da20cbdc5 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_report.go @@ -0,0 +1,75 @@ +package storagediscoveryworkspaces + +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 ReportOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *GetReportResult +} + +// Report ... +func (c StorageDiscoveryWorkspacesClient) Report(ctx context.Context, id ProviderStorageDiscoveryWorkspaceId, input GetReportContent) (result ReportOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/report", 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 +} + +// ReportThenPoll performs Report then polls until it's completed +func (c StorageDiscoveryWorkspacesClient) ReportThenPoll(ctx context.Context, id ProviderStorageDiscoveryWorkspaceId, input GetReportContent) error { + result, err := c.Report(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Report: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Report: %+v", err) + } + + return nil +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_update.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_update.go new file mode 100644 index 00000000000..2294fb53f6a --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/method_update.go @@ -0,0 +1,57 @@ +package storagediscoveryworkspaces + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *StorageDiscoveryWorkspace +} + +// Update ... +func (c StorageDiscoveryWorkspacesClient) Update(ctx context.Context, id ProviderStorageDiscoveryWorkspaceId, input StorageDiscoveryWorkspaceUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model StorageDiscoveryWorkspace + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_getreportcontent.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_getreportcontent.go new file mode 100644 index 00000000000..9f7104f2fd0 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_getreportcontent.go @@ -0,0 +1,8 @@ +package storagediscoveryworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetReportContent struct { + Queries []string `json:"queries"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_getreportresult.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_getreportresult.go new file mode 100644 index 00000000000..74b0bb9c740 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_getreportresult.go @@ -0,0 +1,8 @@ +package storagediscoveryworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetReportResult struct { + Results []ReportResultSet `json:"results"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_reportresultcolumn.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_reportresultcolumn.go new file mode 100644 index 00000000000..78917cec36e --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_reportresultcolumn.go @@ -0,0 +1,9 @@ +package storagediscoveryworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReportResultColumn struct { + Name string `json:"name"` + Type string `json:"type"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_reportresultset.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_reportresultset.go new file mode 100644 index 00000000000..840c5ee43d3 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_reportresultset.go @@ -0,0 +1,10 @@ +package storagediscoveryworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReportResultSet struct { + Columns *[]ReportResultColumn `json:"columns,omitempty"` + ErrorCode *string `json:"errorCode,omitempty"` + Rows *[][]string `json:"rows,omitempty"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryscope.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryscope.go new file mode 100644 index 00000000000..e6e4781be51 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryscope.go @@ -0,0 +1,11 @@ +package storagediscoveryworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageDiscoveryScope struct { + DisplayName string `json:"displayName"` + ResourceTypes []StorageDiscoveryResourceType `json:"resourceTypes"` + TagKeysOnly *[]string `json:"tagKeysOnly,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspace.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspace.go new file mode 100644 index 00000000000..8132521f302 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspace.go @@ -0,0 +1,18 @@ +package storagediscoveryworkspaces + +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 StorageDiscoveryWorkspace struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *StorageDiscoveryWorkspaceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspaceproperties.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspaceproperties.go new file mode 100644 index 00000000000..8ad5ca0401f --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspaceproperties.go @@ -0,0 +1,12 @@ +package storagediscoveryworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageDiscoveryWorkspaceProperties struct { + Description *string `json:"description,omitempty"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Scopes []StorageDiscoveryScope `json:"scopes"` + Sku *StorageDiscoverySku `json:"sku,omitempty"` + WorkspaceRoots []string `json:"workspaceRoots"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspacepropertiesupdate.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspacepropertiesupdate.go new file mode 100644 index 00000000000..d1047a7b98d --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspacepropertiesupdate.go @@ -0,0 +1,11 @@ +package storagediscoveryworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageDiscoveryWorkspacePropertiesUpdate struct { + Description *string `json:"description,omitempty"` + Scopes *[]StorageDiscoveryScope `json:"scopes,omitempty"` + Sku *StorageDiscoverySku `json:"sku,omitempty"` + WorkspaceRoots *[]string `json:"workspaceRoots,omitempty"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspaceupdate.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspaceupdate.go new file mode 100644 index 00000000000..d108ad66771 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/model_storagediscoveryworkspaceupdate.go @@ -0,0 +1,9 @@ +package storagediscoveryworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageDiscoveryWorkspaceUpdate struct { + Properties *StorageDiscoveryWorkspacePropertiesUpdate `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/predicates.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/predicates.go new file mode 100644 index 00000000000..8fb87c12cde --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/predicates.go @@ -0,0 +1,32 @@ +package storagediscoveryworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageDiscoveryWorkspaceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p StorageDiscoveryWorkspaceOperationPredicate) Matches(input StorageDiscoveryWorkspace) 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/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/version.go b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/version.go new file mode 100644 index 00000000000..f585dbd8817 --- /dev/null +++ b/resource-manager/storagediscovery/2025-09-01/storagediscoveryworkspaces/version.go @@ -0,0 +1,10 @@ +package storagediscoveryworkspaces + +// 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-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/storagediscoveryworkspaces/2025-09-01" +}