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 (06fa288ce233533baa5acba135a48230df31b28d) #835

Merged
merged 1 commit into from
Jan 23, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions resource-manager/portal/2020-09-01-preview/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package v2020_09_01_preview

// 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/portal/2020-09-01-preview/dashboard"
"github.com/hashicorp/go-azure-sdk/resource-manager/portal/2020-09-01-preview/listtenantconfigurationviolations"
"github.com/hashicorp/go-azure-sdk/resource-manager/portal/2020-09-01-preview/tenantconfiguration"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

type Client struct {
Dashboard *dashboard.DashboardClient
ListTenantConfigurationViolations *listtenantconfigurationviolations.ListTenantConfigurationViolationsClient
TenantConfiguration *tenantconfiguration.TenantConfigurationClient
}

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

listTenantConfigurationViolationsClient, err := listtenantconfigurationviolations.NewListTenantConfigurationViolationsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ListTenantConfigurationViolations client: %+v", err)
}
configureFunc(listTenantConfigurationViolationsClient.Client)

tenantConfigurationClient, err := tenantconfiguration.NewTenantConfigurationClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building TenantConfiguration client: %+v", err)
}
configureFunc(tenantConfigurationClient.Client)

return &Client{
Dashboard: dashboardClient,
ListTenantConfigurationViolations: listTenantConfigurationViolationsClient,
TenantConfiguration: tenantConfigurationClient,
}, nil
}
128 changes: 128 additions & 0 deletions resource-manager/portal/2020-09-01-preview/dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/portal/2020-09-01-preview/dashboard` Documentation

The `dashboard` SDK allows for interaction with the Azure Resource Manager Service `portal` (API Version `2020-09-01-preview`).

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/portal/2020-09-01-preview/dashboard"
```


### Client Initialization

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


### Example Usage: `DashboardClient.CreateOrUpdate`

```go
ctx := context.TODO()
id := dashboard.NewDashboardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dashboardValue")

payload := dashboard.Dashboard{
// ...
}


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: `DashboardClient.Delete`

```go
ctx := context.TODO()
id := dashboard.NewDashboardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dashboardValue")

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: `DashboardClient.Get`

```go
ctx := context.TODO()
id := dashboard.NewDashboardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dashboardValue")

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: `DashboardClient.ListByResourceGroup`

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

// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination
items, err := client.ListByResourceGroupComplete(ctx, id)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
```


### Example Usage: `DashboardClient.ListBySubscription`

```go
ctx := context.TODO()
id := dashboard.NewSubscriptionID("12345678-1234-9876-4563-123456789012")

// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination
items, err := client.ListBySubscriptionComplete(ctx, id)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
```


### Example Usage: `DashboardClient.Update`

```go
ctx := context.TODO()
id := dashboard.NewDashboardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dashboardValue")

payload := dashboard.PatchableDashboard{
// ...
}


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
}
```
26 changes: 26 additions & 0 deletions resource-manager/portal/2020-09-01-preview/dashboard/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package dashboard

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

func NewDashboardClientWithBaseURI(sdkApi sdkEnv.Api) (*DashboardClient, error) {
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "dashboard", defaultApiVersion)
if err != nil {
return nil, fmt.Errorf("instantiating DashboardClient: %+v", err)
}

return &DashboardClient{
Client: client,
}, nil
}
125 changes: 125 additions & 0 deletions resource-manager/portal/2020-09-01-preview/dashboard/id_dashboard.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
package dashboard

import (
"fmt"
"strings"

"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.

var _ resourceids.ResourceId = &DashboardId{}

// DashboardId is a struct representing the Resource ID for a Dashboard
type DashboardId struct {
SubscriptionId string
ResourceGroupName string
DashboardName string
}

// NewDashboardID returns a new DashboardId struct
func NewDashboardID(subscriptionId string, resourceGroupName string, dashboardName string) DashboardId {
return DashboardId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
DashboardName: dashboardName,
}
}

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

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

return &id, nil
}

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

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

return &id, nil
}

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

return nil
}

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

return
}

// ID returns the formatted Dashboard ID
func (id DashboardId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Portal/dashboards/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DashboardName)
}

// Segments returns a slice of Resource ID Segments which comprise this Dashboard ID
func (id DashboardId) 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("staticMicrosoftPortal", "Microsoft.Portal", "Microsoft.Portal"),
resourceids.StaticSegment("staticDashboards", "dashboards", "dashboards"),
resourceids.UserSpecifiedSegment("dashboardName", "dashboardValue"),
}
}

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