Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 1 addition & 5 deletions resource-manager/apimanagement/2024-05-01/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ 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"
)

// Copyright (c) Microsoft Corporation. All rights reserved.
// 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
}
Expand Down Expand Up @@ -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,
},
Expand All @@ -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
}
221 changes: 221 additions & 0 deletions resource-manager/compute/2025-04-01/availabilitysets/README.md
Original file line number Diff line number Diff line change
@@ -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
}
```
26 changes: 26 additions & 0 deletions resource-manager/compute/2025-04-01/availabilitysets/client.go
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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
}
Loading
Loading