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

powerbi - regenerate embedded sdk #14154

Merged
merged 2 commits into from
Nov 12, 2021
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
4 changes: 2 additions & 2 deletions internal/services/powerbi/powerbi_embedded_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func resourcePowerBIEmbeddedRead(d *pluginsdk.ResourceData, meta interface{}) er
return fmt.Errorf("retrieving %s: %+v", *id, err)
}

d.Set("name", id.CapacityName)
d.Set("resource_group_name", id.ResourceGroup)
d.Set("name", id.DedicatedCapacityName)
d.Set("resource_group_name", id.ResourceGroupName)

if model := resp.Model; model != nil {
d.Set("location", location.Normalize(model.Location))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package autoscalevcores

import "github.com/Azure/go-autorest/autorest"

type AutoScaleVCoresClient struct {
Client autorest.Client
baseUri string
}

func NewAutoScaleVCoresClientWithBaseURI(endpoint string) AutoScaleVCoresClient {
return AutoScaleVCoresClient{
Client: autorest.NewClientWithUserAgent(userAgent()),
baseUri: endpoint,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package autoscalevcores

import "strings"

type IdentityType string

const (
IdentityTypeApplication IdentityType = "Application"
IdentityTypeKey IdentityType = "Key"
IdentityTypeManagedIdentity IdentityType = "ManagedIdentity"
IdentityTypeUser IdentityType = "User"
)

func PossibleValuesForIdentityType() []string {
return []string{
string(IdentityTypeApplication),
string(IdentityTypeKey),
string(IdentityTypeManagedIdentity),
string(IdentityTypeUser),
}
}

func parseIdentityType(input string) (*IdentityType, error) {
vals := map[string]IdentityType{
"application": IdentityTypeApplication,
"key": IdentityTypeKey,
"managedidentity": IdentityTypeManagedIdentity,
"user": IdentityTypeUser,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := IdentityType(input)
return &out, nil
}

type VCoreProvisioningState string

const (
VCoreProvisioningStateSucceeded VCoreProvisioningState = "Succeeded"
)

func PossibleValuesForVCoreProvisioningState() []string {
return []string{
string(VCoreProvisioningStateSucceeded),
}
}

func parseVCoreProvisioningState(input string) (*VCoreProvisioningState, error) {
vals := map[string]VCoreProvisioningState{
"succeeded": VCoreProvisioningStateSucceeded,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := VCoreProvisioningState(input)
return &out, nil
}

type VCoreSkuTier string

const (
VCoreSkuTierAutoScale VCoreSkuTier = "AutoScale"
)

func PossibleValuesForVCoreSkuTier() []string {
return []string{
string(VCoreSkuTierAutoScale),
}
}

func parseVCoreSkuTier(input string) (*VCoreSkuTier, error) {
vals := map[string]VCoreSkuTier{
"autoscale": VCoreSkuTierAutoScale,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := VCoreSkuTier(input)
return &out, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
package autoscalevcores

import (
"fmt"
"strings"

"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
)

var _ resourceids.ResourceId = AutoScaleVCoreId{}

// AutoScaleVCoreId is a struct representing the Resource ID for a Auto Scale V Core
type AutoScaleVCoreId struct {
SubscriptionId string
ResourceGroupName string
VcoreName string
}

// NewAutoScaleVCoreID returns a new AutoScaleVCoreId struct
func NewAutoScaleVCoreID(subscriptionId string, resourceGroupName string, vcoreName string) AutoScaleVCoreId {
return AutoScaleVCoreId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
VcoreName: vcoreName,
}
}

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

var ok bool
id := AutoScaleVCoreId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
}

if id.VcoreName, ok = parsed.Parsed["vcoreName"]; !ok {
return nil, fmt.Errorf("the segment 'vcoreName' was not found in the resource id %q", input)
}

return &id, nil
}

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

var ok bool
id := AutoScaleVCoreId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
}

if id.VcoreName, ok = parsed.Parsed["vcoreName"]; !ok {
return nil, fmt.Errorf("the segment 'vcoreName' was not found in the resource id %q", input)
}

return &id, nil
}

// ValidateAutoScaleVCoreID checks that 'input' can be parsed as a Auto Scale V Core ID
func ValidateAutoScaleVCoreID(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 := ParseAutoScaleVCoreID(v); err != nil {
errors = append(errors, err)
}

return
}

// ID returns the formatted Auto Scale V Core ID
func (id AutoScaleVCoreId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.PowerBIDedicated/autoScaleVCores/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VcoreName)
}

// Segments returns a slice of Resource ID Segments which comprise this Auto Scale V Core ID
func (id AutoScaleVCoreId) Segments() []resourceids.Segment {
return []resourceids.Segment{
resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"),
resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"),
resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"),
resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"),
resourceids.StaticSegment("providers", "providers", "providers"),
resourceids.ResourceProviderSegment("microsoftPowerBIDedicated", "Microsoft.PowerBIDedicated", "Microsoft.PowerBIDedicated"),
resourceids.StaticSegment("autoScaleVCores", "autoScaleVCores", "autoScaleVCores"),
resourceids.UserSpecifiedSegment("vcoreName", "vcoreValue"),
}
}

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