Skip to content

Commit f5fdef6

Browse files
authored
Merge pull request #1161 from hashicorp/auto-pr/48303ef4c
Auto PR: Regenerating the Go SDK (77df0a3)
2 parents 09383c9 + 77df0a3 commit f5fdef6

File tree

1,676 files changed

+120642
-156
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,676 files changed

+120642
-156
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
## `github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2025-01-01/capabilities` Documentation
3+
4+
The `capabilities` SDK allows for interaction with Azure Resource Manager `chaosstudio` (API Version `2025-01-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/chaosstudio/2025-01-01/capabilities"
13+
```
14+
15+
16+
### Client Initialization
17+
18+
```go
19+
client := capabilities.NewCapabilitiesClientWithBaseURI("https://management.azure.com")
20+
client.Client.Authorizer = authorizer
21+
```
22+
23+
24+
### Example Usage: `CapabilitiesClient.CreateOrUpdate`
25+
26+
```go
27+
ctx := context.TODO()
28+
id := commonids.NewChaosStudioCapabilityID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetName", "capabilityName")
29+
30+
payload := capabilities.Capability{
31+
// ...
32+
}
33+
34+
35+
read, err := client.CreateOrUpdate(ctx, id, payload)
36+
if err != nil {
37+
// handle the error
38+
}
39+
if model := read.Model; model != nil {
40+
// do something with the model/response object
41+
}
42+
```
43+
44+
45+
### Example Usage: `CapabilitiesClient.Delete`
46+
47+
```go
48+
ctx := context.TODO()
49+
id := commonids.NewChaosStudioCapabilityID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetName", "capabilityName")
50+
51+
read, err := client.Delete(ctx, id)
52+
if err != nil {
53+
// handle the error
54+
}
55+
if model := read.Model; model != nil {
56+
// do something with the model/response object
57+
}
58+
```
59+
60+
61+
### Example Usage: `CapabilitiesClient.Get`
62+
63+
```go
64+
ctx := context.TODO()
65+
id := commonids.NewChaosStudioCapabilityID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetName", "capabilityName")
66+
67+
read, err := client.Get(ctx, id)
68+
if err != nil {
69+
// handle the error
70+
}
71+
if model := read.Model; model != nil {
72+
// do something with the model/response object
73+
}
74+
```
75+
76+
77+
### Example Usage: `CapabilitiesClient.List`
78+
79+
```go
80+
ctx := context.TODO()
81+
id := commonids.NewChaosStudioTargetID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetName")
82+
83+
// alternatively `client.List(ctx, id, capabilities.DefaultListOperationOptions())` can be used to do batched pagination
84+
items, err := client.ListComplete(ctx, id, capabilities.DefaultListOperationOptions())
85+
if err != nil {
86+
// handle the error
87+
}
88+
for _, item := range items {
89+
// do something
90+
}
91+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package capabilities
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 CapabilitiesClient struct {
14+
Client *resourcemanager.Client
15+
}
16+
17+
func NewCapabilitiesClientWithBaseURI(sdkApi sdkEnv.Api) (*CapabilitiesClient, error) {
18+
client, err := resourcemanager.NewClient(sdkApi, "capabilities", defaultApiVersion)
19+
if err != nil {
20+
return nil, fmt.Errorf("instantiating CapabilitiesClient: %+v", err)
21+
}
22+
23+
return &CapabilitiesClient{
24+
Client: client,
25+
}, nil
26+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package capabilities
2+
3+
import (
4+
"context"
5+
"net/http"
6+
7+
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
8+
"github.com/hashicorp/go-azure-sdk/sdk/client"
9+
"github.com/hashicorp/go-azure-sdk/sdk/odata"
10+
)
11+
12+
// Copyright (c) Microsoft Corporation. All rights reserved.
13+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
14+
15+
type CreateOrUpdateOperationResponse struct {
16+
HttpResponse *http.Response
17+
OData *odata.OData
18+
Model *Capability
19+
}
20+
21+
// CreateOrUpdate ...
22+
func (c CapabilitiesClient) CreateOrUpdate(ctx context.Context, id commonids.ChaosStudioCapabilityId, input Capability) (result CreateOrUpdateOperationResponse, err error) {
23+
opts := client.RequestOptions{
24+
ContentType: "application/json; charset=utf-8",
25+
ExpectedStatusCodes: []int{
26+
http.StatusCreated,
27+
http.StatusOK,
28+
},
29+
HttpMethod: http.MethodPut,
30+
Path: id.ID(),
31+
}
32+
33+
req, err := c.Client.NewRequest(ctx, opts)
34+
if err != nil {
35+
return
36+
}
37+
38+
if err = req.Marshal(input); err != nil {
39+
return
40+
}
41+
42+
var resp *client.Response
43+
resp, err = req.Execute(ctx)
44+
if resp != nil {
45+
result.OData = resp.OData
46+
result.HttpResponse = resp.Response
47+
}
48+
if err != nil {
49+
return
50+
}
51+
52+
var model Capability
53+
result.Model = &model
54+
if err = resp.Unmarshal(result.Model); err != nil {
55+
return
56+
}
57+
58+
return
59+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package capabilities
2+
3+
import (
4+
"context"
5+
"net/http"
6+
7+
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
8+
"github.com/hashicorp/go-azure-sdk/sdk/client"
9+
"github.com/hashicorp/go-azure-sdk/sdk/odata"
10+
)
11+
12+
// Copyright (c) Microsoft Corporation. All rights reserved.
13+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
14+
15+
type DeleteOperationResponse struct {
16+
HttpResponse *http.Response
17+
OData *odata.OData
18+
}
19+
20+
// Delete ...
21+
func (c CapabilitiesClient) Delete(ctx context.Context, id commonids.ChaosStudioCapabilityId) (result DeleteOperationResponse, err error) {
22+
opts := client.RequestOptions{
23+
ContentType: "application/json; charset=utf-8",
24+
ExpectedStatusCodes: []int{
25+
http.StatusNoContent,
26+
http.StatusOK,
27+
},
28+
HttpMethod: http.MethodDelete,
29+
Path: 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+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package capabilities
2+
3+
import (
4+
"context"
5+
"net/http"
6+
7+
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
8+
"github.com/hashicorp/go-azure-sdk/sdk/client"
9+
"github.com/hashicorp/go-azure-sdk/sdk/odata"
10+
)
11+
12+
// Copyright (c) Microsoft Corporation. All rights reserved.
13+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
14+
15+
type GetOperationResponse struct {
16+
HttpResponse *http.Response
17+
OData *odata.OData
18+
Model *Capability
19+
}
20+
21+
// Get ...
22+
func (c CapabilitiesClient) Get(ctx context.Context, id commonids.ChaosStudioCapabilityId) (result GetOperationResponse, err error) {
23+
opts := client.RequestOptions{
24+
ContentType: "application/json; charset=utf-8",
25+
ExpectedStatusCodes: []int{
26+
http.StatusOK,
27+
},
28+
HttpMethod: http.MethodGet,
29+
Path: 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+
var model Capability
48+
result.Model = &model
49+
if err = resp.Unmarshal(result.Model); err != nil {
50+
return
51+
}
52+
53+
return
54+
}

0 commit comments

Comments
 (0)