Skip to content

Commit 0ebe6af

Browse files
authored
Merge pull request #1197 from hashicorp/auto-pr/f11d1cf7f
Auto PR: Regenerating the Go SDK (4ddd9bd)
2 parents 339a64a + 4ddd9bd commit 0ebe6af

File tree

1,024 files changed

+63188
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,024 files changed

+63188
-136
lines changed
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
2+
## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/availabilitysets` Documentation
3+
4+
The `availabilitysets` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-11-01`).
5+
6+
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).
7+
8+
### Import Path
9+
10+
```go
11+
import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
12+
import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/availabilitysets"
13+
```
14+
15+
16+
### Client Initialization
17+
18+
```go
19+
client := availabilitysets.NewAvailabilitySetsClientWithBaseURI("https://management.azure.com")
20+
client.Client.Authorizer = authorizer
21+
```
22+
23+
24+
### Example Usage: `AvailabilitySetsClient.CancelMigrationToVirtualMachineScaleSet`
25+
26+
```go
27+
ctx := context.TODO()
28+
id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName")
29+
30+
read, err := client.CancelMigrationToVirtualMachineScaleSet(ctx, id)
31+
if err != nil {
32+
// handle the error
33+
}
34+
if model := read.Model; model != nil {
35+
// do something with the model/response object
36+
}
37+
```
38+
39+
40+
### Example Usage: `AvailabilitySetsClient.ConvertToVirtualMachineScaleSet`
41+
42+
```go
43+
ctx := context.TODO()
44+
id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName")
45+
46+
payload := availabilitysets.ConvertToVirtualMachineScaleSetInput{
47+
// ...
48+
}
49+
50+
51+
if err := client.ConvertToVirtualMachineScaleSetThenPoll(ctx, id, payload); err != nil {
52+
// handle the error
53+
}
54+
```
55+
56+
57+
### Example Usage: `AvailabilitySetsClient.CreateOrUpdate`
58+
59+
```go
60+
ctx := context.TODO()
61+
id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName")
62+
63+
payload := availabilitysets.AvailabilitySet{
64+
// ...
65+
}
66+
67+
68+
read, err := client.CreateOrUpdate(ctx, id, payload)
69+
if err != nil {
70+
// handle the error
71+
}
72+
if model := read.Model; model != nil {
73+
// do something with the model/response object
74+
}
75+
```
76+
77+
78+
### Example Usage: `AvailabilitySetsClient.Delete`
79+
80+
```go
81+
ctx := context.TODO()
82+
id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName")
83+
84+
read, err := client.Delete(ctx, id)
85+
if err != nil {
86+
// handle the error
87+
}
88+
if model := read.Model; model != nil {
89+
// do something with the model/response object
90+
}
91+
```
92+
93+
94+
### Example Usage: `AvailabilitySetsClient.Get`
95+
96+
```go
97+
ctx := context.TODO()
98+
id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName")
99+
100+
read, err := client.Get(ctx, id)
101+
if err != nil {
102+
// handle the error
103+
}
104+
if model := read.Model; model != nil {
105+
// do something with the model/response object
106+
}
107+
```
108+
109+
110+
### Example Usage: `AvailabilitySetsClient.List`
111+
112+
```go
113+
ctx := context.TODO()
114+
id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group")
115+
116+
// alternatively `client.List(ctx, id)` can be used to do batched pagination
117+
items, err := client.ListComplete(ctx, id)
118+
if err != nil {
119+
// handle the error
120+
}
121+
for _, item := range items {
122+
// do something
123+
}
124+
```
125+
126+
127+
### Example Usage: `AvailabilitySetsClient.ListAvailableSizes`
128+
129+
```go
130+
ctx := context.TODO()
131+
id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName")
132+
133+
read, err := client.ListAvailableSizes(ctx, id)
134+
if err != nil {
135+
// handle the error
136+
}
137+
if model := read.Model; model != nil {
138+
// do something with the model/response object
139+
}
140+
```
141+
142+
143+
### Example Usage: `AvailabilitySetsClient.ListBySubscription`
144+
145+
```go
146+
ctx := context.TODO()
147+
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")
148+
149+
// alternatively `client.ListBySubscription(ctx, id, availabilitysets.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination
150+
items, err := client.ListBySubscriptionComplete(ctx, id, availabilitysets.DefaultListBySubscriptionOperationOptions())
151+
if err != nil {
152+
// handle the error
153+
}
154+
for _, item := range items {
155+
// do something
156+
}
157+
```
158+
159+
160+
### Example Usage: `AvailabilitySetsClient.StartMigrationToVirtualMachineScaleSet`
161+
162+
```go
163+
ctx := context.TODO()
164+
id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName")
165+
166+
payload := availabilitysets.MigrateToVirtualMachineScaleSetInput{
167+
// ...
168+
}
169+
170+
171+
read, err := client.StartMigrationToVirtualMachineScaleSet(ctx, id, payload)
172+
if err != nil {
173+
// handle the error
174+
}
175+
if model := read.Model; model != nil {
176+
// do something with the model/response object
177+
}
178+
```
179+
180+
181+
### Example Usage: `AvailabilitySetsClient.Update`
182+
183+
```go
184+
ctx := context.TODO()
185+
id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName")
186+
187+
payload := availabilitysets.AvailabilitySetUpdate{
188+
// ...
189+
}
190+
191+
192+
read, err := client.Update(ctx, id, payload)
193+
if err != nil {
194+
// handle the error
195+
}
196+
if model := read.Model; model != nil {
197+
// do something with the model/response object
198+
}
199+
```
200+
201+
202+
### Example Usage: `AvailabilitySetsClient.ValidateMigrationToVirtualMachineScaleSet`
203+
204+
```go
205+
ctx := context.TODO()
206+
id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName")
207+
208+
payload := availabilitysets.MigrateToVirtualMachineScaleSetInput{
209+
// ...
210+
}
211+
212+
213+
read, err := client.ValidateMigrationToVirtualMachineScaleSet(ctx, id, payload)
214+
if err != nil {
215+
// handle the error
216+
}
217+
if model := read.Model; model != nil {
218+
// do something with the model/response object
219+
}
220+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package availabilitysets
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
7+
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
8+
)
9+
10+
// Copyright (c) Microsoft Corporation. All rights reserved.
11+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
12+
13+
type AvailabilitySetsClient struct {
14+
Client *resourcemanager.Client
15+
}
16+
17+
func NewAvailabilitySetsClientWithBaseURI(sdkApi sdkEnv.Api) (*AvailabilitySetsClient, error) {
18+
client, err := resourcemanager.NewClient(sdkApi, "availabilitysets", defaultApiVersion)
19+
if err != nil {
20+
return nil, fmt.Errorf("instantiating AvailabilitySetsClient: %+v", err)
21+
}
22+
23+
return &AvailabilitySetsClient{
24+
Client: client,
25+
}, nil
26+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package availabilitysets
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"strings"
7+
)
8+
9+
// Copyright (c) Microsoft Corporation. All rights reserved.
10+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
11+
12+
type StatusLevelTypes string
13+
14+
const (
15+
StatusLevelTypesError StatusLevelTypes = "Error"
16+
StatusLevelTypesInfo StatusLevelTypes = "Info"
17+
StatusLevelTypesWarning StatusLevelTypes = "Warning"
18+
)
19+
20+
func PossibleValuesForStatusLevelTypes() []string {
21+
return []string{
22+
string(StatusLevelTypesError),
23+
string(StatusLevelTypesInfo),
24+
string(StatusLevelTypesWarning),
25+
}
26+
}
27+
28+
func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error {
29+
var decoded string
30+
if err := json.Unmarshal(bytes, &decoded); err != nil {
31+
return fmt.Errorf("unmarshaling: %+v", err)
32+
}
33+
out, err := parseStatusLevelTypes(decoded)
34+
if err != nil {
35+
return fmt.Errorf("parsing %q: %+v", decoded, err)
36+
}
37+
*s = *out
38+
return nil
39+
}
40+
41+
func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) {
42+
vals := map[string]StatusLevelTypes{
43+
"error": StatusLevelTypesError,
44+
"info": StatusLevelTypesInfo,
45+
"warning": StatusLevelTypesWarning,
46+
}
47+
if v, ok := vals[strings.ToLower(input)]; ok {
48+
return &v, nil
49+
}
50+
51+
// otherwise presume it's an undefined value and best-effort it
52+
out := StatusLevelTypes(input)
53+
return &out, nil
54+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package availabilitysets
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"net/http"
7+
8+
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
9+
"github.com/hashicorp/go-azure-sdk/sdk/client"
10+
"github.com/hashicorp/go-azure-sdk/sdk/odata"
11+
)
12+
13+
// Copyright (c) Microsoft Corporation. All rights reserved.
14+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
15+
16+
type CancelMigrationToVirtualMachineScaleSetOperationResponse struct {
17+
HttpResponse *http.Response
18+
OData *odata.OData
19+
}
20+
21+
// CancelMigrationToVirtualMachineScaleSet ...
22+
func (c AvailabilitySetsClient) CancelMigrationToVirtualMachineScaleSet(ctx context.Context, id commonids.AvailabilitySetId) (result CancelMigrationToVirtualMachineScaleSetOperationResponse, err error) {
23+
opts := client.RequestOptions{
24+
ContentType: "application/json; charset=utf-8",
25+
ExpectedStatusCodes: []int{
26+
http.StatusNoContent,
27+
},
28+
HttpMethod: http.MethodPost,
29+
Path: fmt.Sprintf("%s/cancelMigrationToVirtualMachineScaleSet", id.ID()),
30+
}
31+
32+
req, err := c.Client.NewRequest(ctx, opts)
33+
if err != nil {
34+
return
35+
}
36+
37+
var resp *client.Response
38+
resp, err = req.Execute(ctx)
39+
if resp != nil {
40+
result.OData = resp.OData
41+
result.HttpResponse = resp.Response
42+
}
43+
if err != nil {
44+
return
45+
}
46+
47+
return
48+
}

0 commit comments

Comments
 (0)