Skip to content

Commit

Permalink
Merge pull request hashicorp#14154 from hashicorp/pandora-powerbi-regen
Browse files Browse the repository at this point in the history
powerbi - regenerate embedded sdk
  • Loading branch information
tombuildsstuff authored Nov 12, 2021
2 parents ae96dd4 + 6907fe0 commit 2170cd3
Show file tree
Hide file tree
Showing 41 changed files with 2,623 additions and 524 deletions.
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
15 changes: 15 additions & 0 deletions internal/services/powerbi/sdk/2021-01-01/autoscalevcores/client.go
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

0 comments on commit 2170cd3

Please sign in to comment.