Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto PR: Regenerating the Go SDK (0a2fc47d4d734a9f51e2eb99cf5309dca21246e7) #1151

Merged
merged 1 commit into from
Jan 27, 2025
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
  •  
  •  
  •  
73 changes: 73 additions & 0 deletions resource-manager/dashboard/2024-10-01/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package v2024_10_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/dashboard/2024-10-01/grafanaplugin"
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/grafanaresource"
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/integrationfabric"
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/managedprivateendpoints"
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/privateendpointconnection"
"github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/privatelinkresource"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

type Client struct {
GrafanaPlugin *grafanaplugin.GrafanaPluginClient
GrafanaResource *grafanaresource.GrafanaResourceClient
IntegrationFabric *integrationfabric.IntegrationFabricClient
ManagedPrivateEndpoints *managedprivateendpoints.ManagedPrivateEndpointsClient
PrivateEndpointConnection *privateendpointconnection.PrivateEndpointConnectionClient
PrivateLinkResource *privatelinkresource.PrivateLinkResourceClient
}

func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
grafanaPluginClient, err := grafanaplugin.NewGrafanaPluginClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building GrafanaPlugin client: %+v", err)
}
configureFunc(grafanaPluginClient.Client)

grafanaResourceClient, err := grafanaresource.NewGrafanaResourceClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building GrafanaResource client: %+v", err)
}
configureFunc(grafanaResourceClient.Client)

integrationFabricClient, err := integrationfabric.NewIntegrationFabricClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building IntegrationFabric client: %+v", err)
}
configureFunc(integrationFabricClient.Client)

managedPrivateEndpointsClient, err := managedprivateendpoints.NewManagedPrivateEndpointsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ManagedPrivateEndpoints client: %+v", err)
}
configureFunc(managedPrivateEndpointsClient.Client)

privateEndpointConnectionClient, err := privateendpointconnection.NewPrivateEndpointConnectionClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building PrivateEndpointConnection client: %+v", err)
}
configureFunc(privateEndpointConnectionClient.Client)

privateLinkResourceClient, err := privatelinkresource.NewPrivateLinkResourceClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building PrivateLinkResource client: %+v", err)
}
configureFunc(privateLinkResourceClient.Client)

return &Client{
GrafanaPlugin: grafanaPluginClient,
GrafanaResource: grafanaResourceClient,
IntegrationFabric: integrationFabricClient,
ManagedPrivateEndpoints: managedPrivateEndpointsClient,
PrivateEndpointConnection: privateEndpointConnectionClient,
PrivateLinkResource: privateLinkResourceClient,
}, nil
}
37 changes: 37 additions & 0 deletions resource-manager/dashboard/2024-10-01/grafanaplugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2024-10-01/grafanaplugin` Documentation

The `grafanaplugin` SDK allows for interaction with Azure Resource Manager `dashboard` (API Version `2024-10-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/dashboard/2024-10-01/grafanaplugin"
```


### Client Initialization

```go
client := grafanaplugin.NewGrafanaPluginClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer
```


### Example Usage: `GrafanaPluginClient.GrafanaFetchAvailablePlugins`

```go
ctx := context.TODO()
id := grafanaplugin.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "grafanaName")

// alternatively `client.GrafanaFetchAvailablePlugins(ctx, id)` can be used to do batched pagination
items, err := client.GrafanaFetchAvailablePluginsComplete(ctx, id)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
```
26 changes: 26 additions & 0 deletions resource-manager/dashboard/2024-10-01/grafanaplugin/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package grafanaplugin

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 GrafanaPluginClient struct {
Client *resourcemanager.Client
}

func NewGrafanaPluginClientWithBaseURI(sdkApi sdkEnv.Api) (*GrafanaPluginClient, error) {
client, err := resourcemanager.NewClient(sdkApi, "grafanaplugin", defaultApiVersion)
if err != nil {
return nil, fmt.Errorf("instantiating GrafanaPluginClient: %+v", err)
}

return &GrafanaPluginClient{
Client: client,
}, nil
}
130 changes: 130 additions & 0 deletions resource-manager/dashboard/2024-10-01/grafanaplugin/id_grafana.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package grafanaplugin

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(&GrafanaId{})
}

var _ resourceids.ResourceId = &GrafanaId{}

// GrafanaId is a struct representing the Resource ID for a Grafana
type GrafanaId struct {
SubscriptionId string
ResourceGroupName string
GrafanaName string
}

// NewGrafanaID returns a new GrafanaId struct
func NewGrafanaID(subscriptionId string, resourceGroupName string, grafanaName string) GrafanaId {
return GrafanaId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
GrafanaName: grafanaName,
}
}

// ParseGrafanaID parses 'input' into a GrafanaId
func ParseGrafanaID(input string) (*GrafanaId, error) {
parser := resourceids.NewParserFromResourceIdType(&GrafanaId{})
parsed, err := parser.Parse(input, false)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

id := GrafanaId{}
if err = id.FromParseResult(*parsed); err != nil {
return nil, err
}

return &id, nil
}

// ParseGrafanaIDInsensitively parses 'input' case-insensitively into a GrafanaId
// note: this method should only be used for API response data and not user input
func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) {
parser := resourceids.NewParserFromResourceIdType(&GrafanaId{})
parsed, err := parser.Parse(input, true)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

id := GrafanaId{}
if err = id.FromParseResult(*parsed); err != nil {
return nil, err
}

return &id, nil
}

func (id *GrafanaId) 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.GrafanaName, ok = input.Parsed["grafanaName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input)
}

return nil
}

// ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID
func ValidateGrafanaID(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 := ParseGrafanaID(v); err != nil {
errors = append(errors, err)
}

return
}

// ID returns the formatted Grafana ID
func (id GrafanaId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Dashboard/grafana/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.GrafanaName)
}

// Segments returns a slice of Resource ID Segments which comprise this Grafana ID
func (id GrafanaId) 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("staticMicrosoftDashboard", "Microsoft.Dashboard", "Microsoft.Dashboard"),
resourceids.StaticSegment("staticGrafana", "grafana", "grafana"),
resourceids.UserSpecifiedSegment("grafanaName", "grafanaName"),
}
}

// String returns a human-readable description of this Grafana ID
func (id GrafanaId) String() string {
components := []string{
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
fmt.Sprintf("Grafana Name: %q", id.GrafanaName),
}
return fmt.Sprintf("Grafana (%s)", strings.Join(components, "\n"))
}
Loading
Loading