Skip to content

Commit 84bbc86

Browse files
authored
Merge pull request #1151 from hashicorp/auto-pr/6dbdfa5d4
Auto PR: Regenerating the Go SDK (0a2fc47)
2 parents 8939d67 + 0a2fc47 commit 84bbc86

File tree

497 files changed

+36151
-0
lines changed

Some content is hidden

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

497 files changed

+36151
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package v2024_10_01
2+
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
5+
6+
import (
7+
"fmt"
8+
9+
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/grafanaplugin"
10+
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/grafanaresource"
11+
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/integrationfabric"
12+
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/managedprivateendpoints"
13+
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/privateendpointconnection"
14+
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/privatelinkresource"
15+
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
16+
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
17+
)
18+
19+
type Client struct {
20+
GrafanaPlugin *grafanaplugin.GrafanaPluginClient
21+
GrafanaResource *grafanaresource.GrafanaResourceClient
22+
IntegrationFabric *integrationfabric.IntegrationFabricClient
23+
ManagedPrivateEndpoints *managedprivateendpoints.ManagedPrivateEndpointsClient
24+
PrivateEndpointConnection *privateendpointconnection.PrivateEndpointConnectionClient
25+
PrivateLinkResource *privatelinkresource.PrivateLinkResourceClient
26+
}
27+
28+
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
29+
grafanaPluginClient, err := grafanaplugin.NewGrafanaPluginClientWithBaseURI(sdkApi)
30+
if err != nil {
31+
return nil, fmt.Errorf("building GrafanaPlugin client: %+v", err)
32+
}
33+
configureFunc(grafanaPluginClient.Client)
34+
35+
grafanaResourceClient, err := grafanaresource.NewGrafanaResourceClientWithBaseURI(sdkApi)
36+
if err != nil {
37+
return nil, fmt.Errorf("building GrafanaResource client: %+v", err)
38+
}
39+
configureFunc(grafanaResourceClient.Client)
40+
41+
integrationFabricClient, err := integrationfabric.NewIntegrationFabricClientWithBaseURI(sdkApi)
42+
if err != nil {
43+
return nil, fmt.Errorf("building IntegrationFabric client: %+v", err)
44+
}
45+
configureFunc(integrationFabricClient.Client)
46+
47+
managedPrivateEndpointsClient, err := managedprivateendpoints.NewManagedPrivateEndpointsClientWithBaseURI(sdkApi)
48+
if err != nil {
49+
return nil, fmt.Errorf("building ManagedPrivateEndpoints client: %+v", err)
50+
}
51+
configureFunc(managedPrivateEndpointsClient.Client)
52+
53+
privateEndpointConnectionClient, err := privateendpointconnection.NewPrivateEndpointConnectionClientWithBaseURI(sdkApi)
54+
if err != nil {
55+
return nil, fmt.Errorf("building PrivateEndpointConnection client: %+v", err)
56+
}
57+
configureFunc(privateEndpointConnectionClient.Client)
58+
59+
privateLinkResourceClient, err := privatelinkresource.NewPrivateLinkResourceClientWithBaseURI(sdkApi)
60+
if err != nil {
61+
return nil, fmt.Errorf("building PrivateLinkResource client: %+v", err)
62+
}
63+
configureFunc(privateLinkResourceClient.Client)
64+
65+
return &Client{
66+
GrafanaPlugin: grafanaPluginClient,
67+
GrafanaResource: grafanaResourceClient,
68+
IntegrationFabric: integrationFabricClient,
69+
ManagedPrivateEndpoints: managedPrivateEndpointsClient,
70+
PrivateEndpointConnection: privateEndpointConnectionClient,
71+
PrivateLinkResource: privateLinkResourceClient,
72+
}, nil
73+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
## `github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/grafanaplugin` Documentation
3+
4+
The `grafanaplugin` SDK allows for interaction with Azure Resource Manager `dashboard` (API Version `2024-10-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-sdk/resource-manager/dashboard/2024-10-01/grafanaplugin"
12+
```
13+
14+
15+
### Client Initialization
16+
17+
```go
18+
client := grafanaplugin.NewGrafanaPluginClientWithBaseURI("https://management.azure.com")
19+
client.Client.Authorizer = authorizer
20+
```
21+
22+
23+
### Example Usage: `GrafanaPluginClient.GrafanaFetchAvailablePlugins`
24+
25+
```go
26+
ctx := context.TODO()
27+
id := grafanaplugin.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "grafanaName")
28+
29+
// alternatively `client.GrafanaFetchAvailablePlugins(ctx, id)` can be used to do batched pagination
30+
items, err := client.GrafanaFetchAvailablePluginsComplete(ctx, id)
31+
if err != nil {
32+
// handle the error
33+
}
34+
for _, item := range items {
35+
// do something
36+
}
37+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package grafanaplugin
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 GrafanaPluginClient struct {
14+
Client *resourcemanager.Client
15+
}
16+
17+
func NewGrafanaPluginClientWithBaseURI(sdkApi sdkEnv.Api) (*GrafanaPluginClient, error) {
18+
client, err := resourcemanager.NewClient(sdkApi, "grafanaplugin", defaultApiVersion)
19+
if err != nil {
20+
return nil, fmt.Errorf("instantiating GrafanaPluginClient: %+v", err)
21+
}
22+
23+
return &GrafanaPluginClient{
24+
Client: client,
25+
}, nil
26+
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
package grafanaplugin
2+
3+
import (
4+
"fmt"
5+
"strings"
6+
7+
"github.com/hashicorp/go-azure-helpers/resourcemanager/recaser"
8+
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
9+
)
10+
11+
// Copyright (c) Microsoft Corporation. All rights reserved.
12+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
13+
14+
func init() {
15+
recaser.RegisterResourceId(&GrafanaId{})
16+
}
17+
18+
var _ resourceids.ResourceId = &GrafanaId{}
19+
20+
// GrafanaId is a struct representing the Resource ID for a Grafana
21+
type GrafanaId struct {
22+
SubscriptionId string
23+
ResourceGroupName string
24+
GrafanaName string
25+
}
26+
27+
// NewGrafanaID returns a new GrafanaId struct
28+
func NewGrafanaID(subscriptionId string, resourceGroupName string, grafanaName string) GrafanaId {
29+
return GrafanaId{
30+
SubscriptionId: subscriptionId,
31+
ResourceGroupName: resourceGroupName,
32+
GrafanaName: grafanaName,
33+
}
34+
}
35+
36+
// ParseGrafanaID parses 'input' into a GrafanaId
37+
func ParseGrafanaID(input string) (*GrafanaId, error) {
38+
parser := resourceids.NewParserFromResourceIdType(&GrafanaId{})
39+
parsed, err := parser.Parse(input, false)
40+
if err != nil {
41+
return nil, fmt.Errorf("parsing %q: %+v", input, err)
42+
}
43+
44+
id := GrafanaId{}
45+
if err = id.FromParseResult(*parsed); err != nil {
46+
return nil, err
47+
}
48+
49+
return &id, nil
50+
}
51+
52+
// ParseGrafanaIDInsensitively parses 'input' case-insensitively into a GrafanaId
53+
// note: this method should only be used for API response data and not user input
54+
func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) {
55+
parser := resourceids.NewParserFromResourceIdType(&GrafanaId{})
56+
parsed, err := parser.Parse(input, true)
57+
if err != nil {
58+
return nil, fmt.Errorf("parsing %q: %+v", input, err)
59+
}
60+
61+
id := GrafanaId{}
62+
if err = id.FromParseResult(*parsed); err != nil {
63+
return nil, err
64+
}
65+
66+
return &id, nil
67+
}
68+
69+
func (id *GrafanaId) FromParseResult(input resourceids.ParseResult) error {
70+
var ok bool
71+
72+
if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok {
73+
return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input)
74+
}
75+
76+
if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok {
77+
return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input)
78+
}
79+
80+
if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok {
81+
return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input)
82+
}
83+
84+
return nil
85+
}
86+
87+
// ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID
88+
func ValidateGrafanaID(input interface{}, key string) (warnings []string, errors []error) {
89+
v, ok := input.(string)
90+
if !ok {
91+
errors = append(errors, fmt.Errorf("expected %q to be a string", key))
92+
return
93+
}
94+
95+
if _, err := ParseGrafanaID(v); err != nil {
96+
errors = append(errors, err)
97+
}
98+
99+
return
100+
}
101+
102+
// ID returns the formatted Grafana ID
103+
func (id GrafanaId) ID() string {
104+
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Dashboard/grafana/%s"
105+
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.GrafanaName)
106+
}
107+
108+
// Segments returns a slice of Resource ID Segments which comprise this Grafana ID
109+
func (id GrafanaId) Segments() []resourceids.Segment {
110+
return []resourceids.Segment{
111+
resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"),
112+
resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"),
113+
resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"),
114+
resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"),
115+
resourceids.StaticSegment("staticProviders", "providers", "providers"),
116+
resourceids.ResourceProviderSegment("staticMicrosoftDashboard", "Microsoft.Dashboard", "Microsoft.Dashboard"),
117+
resourceids.StaticSegment("staticGrafana", "grafana", "grafana"),
118+
resourceids.UserSpecifiedSegment("grafanaName", "grafanaName"),
119+
}
120+
}
121+
122+
// String returns a human-readable description of this Grafana ID
123+
func (id GrafanaId) String() string {
124+
components := []string{
125+
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
126+
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
127+
fmt.Sprintf("Grafana Name: %q", id.GrafanaName),
128+
}
129+
return fmt.Sprintf("Grafana (%s)", strings.Join(components, "\n"))
130+
}

0 commit comments

Comments
 (0)