Skip to content

Commit

Permalink
regen embedded sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
mbfrahry committed Nov 10, 2021
1 parent dc716ed commit 4ac4a01
Show file tree
Hide file tree
Showing 41 changed files with 2,641 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,93 @@
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{
"Application",
"Key",
"ManagedIdentity",
"User",
}
}

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

// it could be a new value - best effort convert this
v := input

out := IdentityType(v)
return &out, nil
}

type VCoreProvisioningState string

const (
VCoreProvisioningStateSucceeded VCoreProvisioningState = "Succeeded"
)

func PossibleValuesForVCoreProvisioningState() []string {
return []string{
"Succeeded",
}
}

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

// it could be a new value - best effort convert this
v := input

out := VCoreProvisioningState(v)
return &out, nil
}

type VCoreSkuTier string

const (
VCoreSkuTierAutoScale VCoreSkuTier = "AutoScale"
)

func PossibleValuesForVCoreSkuTier() []string {
return []string{
"AutoScale",
}
}

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

// it could be a new value - best effort convert this
v := input

out := VCoreSkuTier(v)
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 4ac4a01

Please sign in to comment.