forked from hashicorp/terraform-provider-azurerm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
2,641 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
internal/services/powerbi/sdk/2021-01-01/autoscalevcores/client.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
internal/services/powerbi/sdk/2021-01-01/autoscalevcores/constants.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
124 changes: 124 additions & 0 deletions
124
internal/services/powerbi/sdk/2021-01-01/autoscalevcores/id_autoscalevcore.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) | ||
} |
Oops, something went wrong.