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 (3a692e437fb1d0eb4317abcba59977615dbb742d) #20

Merged
merged 1 commit into from
Jun 22, 2022
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package application

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

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type ApplicationClient struct {
Client autorest.Client
baseUri string
}

func NewApplicationClientWithBaseURI(endpoint string) ApplicationClient {
return ApplicationClient{
Client: autorest.NewClientWithUserAgent(userAgent()),
baseUri: endpoint,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package application

import "strings"

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type CommandLineSetting string

const (
CommandLineSettingAllow CommandLineSetting = "Allow"
CommandLineSettingDoNotAllow CommandLineSetting = "DoNotAllow"
CommandLineSettingRequire CommandLineSetting = "Require"
)

func PossibleValuesForCommandLineSetting() []string {
return []string{
string(CommandLineSettingAllow),
string(CommandLineSettingDoNotAllow),
string(CommandLineSettingRequire),
}
}

func parseCommandLineSetting(input string) (*CommandLineSetting, error) {
vals := map[string]CommandLineSetting{
"allow": CommandLineSettingAllow,
"donotallow": CommandLineSettingDoNotAllow,
"require": CommandLineSettingRequire,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type RemoteApplicationType string

const (
RemoteApplicationTypeInBuilt RemoteApplicationType = "InBuilt"
RemoteApplicationTypeMsixApplication RemoteApplicationType = "MsixApplication"
)

func PossibleValuesForRemoteApplicationType() []string {
return []string{
string(RemoteApplicationTypeInBuilt),
string(RemoteApplicationTypeMsixApplication),
}
}

func parseRemoteApplicationType(input string) (*RemoteApplicationType, error) {
vals := map[string]RemoteApplicationType{
"inbuilt": RemoteApplicationTypeInBuilt,
"msixapplication": RemoteApplicationTypeMsixApplication,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

import (
"fmt"
"strings"

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

var _ resourceids.ResourceId = ApplicationId{}

// ApplicationId is a struct representing the Resource ID for a Application
type ApplicationId struct {
SubscriptionId string
ResourceGroupName string
ApplicationGroupName string
ApplicationName string
}

// NewApplicationID returns a new ApplicationId struct
func NewApplicationID(subscriptionId string, resourceGroupName string, applicationGroupName string, applicationName string) ApplicationId {
return ApplicationId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
ApplicationGroupName: applicationGroupName,
ApplicationName: applicationName,
}
}

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

var ok bool
id := ApplicationId{}

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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input)
}

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

return &id, nil
}

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

var ok bool
id := ApplicationId{}

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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input)
}

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

return &id, nil
}

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

return
}

// ID returns the formatted Application ID
func (id ApplicationId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s/applications/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName, id.ApplicationName)
}

// Segments returns a slice of Resource ID Segments which comprise this Application ID
func (id ApplicationId) 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("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"),
resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"),
resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"),
resourceids.StaticSegment("staticApplications", "applications", "applications"),
resourceids.UserSpecifiedSegment("applicationName", "applicationValue"),
}
}

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