Skip to content

Commit

Permalink
Updating based on 83b85c8b9
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Dec 12, 2024
1 parent d3a14e6 commit 771e2c5
Show file tree
Hide file tree
Showing 407 changed files with 30,312 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2024-04-08-preview/activesessionhostconfiguration` Documentation

The `activesessionhostconfiguration` SDK allows for interaction with Azure Resource Manager `desktopvirtualization` (API Version `2024-04-08-preview`).

This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs).

### Import Path

```go
import "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2024-04-08-preview/activesessionhostconfiguration"
```


### Client Initialization

```go
client := activesessionhostconfiguration.NewActiveSessionHostConfigurationClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer
```


### Example Usage: `ActiveSessionHostConfigurationClient.Get`

```go
ctx := context.TODO()
id := activesessionhostconfiguration.NewHostPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolName")

read, err := client.Get(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
```


### Example Usage: `ActiveSessionHostConfigurationClient.ListByHostPool`

```go
ctx := context.TODO()
id := activesessionhostconfiguration.NewHostPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolName")

// alternatively `client.ListByHostPool(ctx, id)` can be used to do batched pagination
items, err := client.ListByHostPoolComplete(ctx, id)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package activesessionhostconfiguration

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

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

type ActiveSessionHostConfigurationClient struct {
Client *resourcemanager.Client
}

func NewActiveSessionHostConfigurationClientWithBaseURI(sdkApi sdkEnv.Api) (*ActiveSessionHostConfigurationClient, error) {
client, err := resourcemanager.NewClient(sdkApi, "activesessionhostconfiguration", defaultApiVersion)
if err != nil {
return nil, fmt.Errorf("instantiating ActiveSessionHostConfigurationClient: %+v", err)
}

return &ActiveSessionHostConfigurationClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
package activesessionhostconfiguration

import (
"encoding/json"
"fmt"
"strings"
)

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

type DomainJoinType string

const (
DomainJoinTypeActiveDirectory DomainJoinType = "ActiveDirectory"
DomainJoinTypeAzureActiveDirectory DomainJoinType = "AzureActiveDirectory"
)

func PossibleValuesForDomainJoinType() []string {
return []string{
string(DomainJoinTypeActiveDirectory),
string(DomainJoinTypeAzureActiveDirectory),
}
}

func (s *DomainJoinType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseDomainJoinType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}

func parseDomainJoinType(input string) (*DomainJoinType, error) {
vals := map[string]DomainJoinType{
"activedirectory": DomainJoinTypeActiveDirectory,
"azureactivedirectory": DomainJoinTypeAzureActiveDirectory,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type Type string

const (
TypeCustom Type = "Custom"
TypeMarketplace Type = "Marketplace"
)

func PossibleValuesForType() []string {
return []string{
string(TypeCustom),
string(TypeMarketplace),
}
}

func (s *Type) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}

func parseType(input string) (*Type, error) {
vals := map[string]Type{
"custom": TypeCustom,
"marketplace": TypeMarketplace,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type VirtualMachineDiskType string

const (
VirtualMachineDiskTypePremiumLRS VirtualMachineDiskType = "Premium_LRS"
VirtualMachineDiskTypeStandardLRS VirtualMachineDiskType = "Standard_LRS"
VirtualMachineDiskTypeStandardSSDLRS VirtualMachineDiskType = "StandardSSD_LRS"
)

func PossibleValuesForVirtualMachineDiskType() []string {
return []string{
string(VirtualMachineDiskTypePremiumLRS),
string(VirtualMachineDiskTypeStandardLRS),
string(VirtualMachineDiskTypeStandardSSDLRS),
}
}

func (s *VirtualMachineDiskType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseVirtualMachineDiskType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}

func parseVirtualMachineDiskType(input string) (*VirtualMachineDiskType, error) {
vals := map[string]VirtualMachineDiskType{
"premium_lrs": VirtualMachineDiskTypePremiumLRS,
"standard_lrs": VirtualMachineDiskTypeStandardLRS,
"standardssd_lrs": VirtualMachineDiskTypeStandardSSDLRS,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type VirtualMachineSecurityType string

const (
VirtualMachineSecurityTypeConfidentialVM VirtualMachineSecurityType = "ConfidentialVM"
VirtualMachineSecurityTypeStandard VirtualMachineSecurityType = "Standard"
VirtualMachineSecurityTypeTrustedLaunch VirtualMachineSecurityType = "TrustedLaunch"
)

func PossibleValuesForVirtualMachineSecurityType() []string {
return []string{
string(VirtualMachineSecurityTypeConfidentialVM),
string(VirtualMachineSecurityTypeStandard),
string(VirtualMachineSecurityTypeTrustedLaunch),
}
}

func (s *VirtualMachineSecurityType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseVirtualMachineSecurityType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}

func parseVirtualMachineSecurityType(input string) (*VirtualMachineSecurityType, error) {
vals := map[string]VirtualMachineSecurityType{
"confidentialvm": VirtualMachineSecurityTypeConfidentialVM,
"standard": VirtualMachineSecurityTypeStandard,
"trustedlaunch": VirtualMachineSecurityTypeTrustedLaunch,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

import (
"fmt"
"strings"

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

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

func init() {
recaser.RegisterResourceId(&HostPoolId{})
}

var _ resourceids.ResourceId = &HostPoolId{}

// HostPoolId is a struct representing the Resource ID for a Host Pool
type HostPoolId struct {
SubscriptionId string
ResourceGroupName string
HostPoolName string
}

// NewHostPoolID returns a new HostPoolId struct
func NewHostPoolID(subscriptionId string, resourceGroupName string, hostPoolName string) HostPoolId {
return HostPoolId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
HostPoolName: hostPoolName,
}
}

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

id := HostPoolId{}
if err = id.FromParseResult(*parsed); err != nil {
return nil, err
}

return &id, nil
}

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

id := HostPoolId{}
if err = id.FromParseResult(*parsed); err != nil {
return nil, err
}

return &id, nil
}

func (id *HostPoolId) FromParseResult(input resourceids.ParseResult) error {
var ok bool

if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input)
}

if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input)
}

if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input)
}

return nil
}

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

return
}

// ID returns the formatted Host Pool ID
func (id HostPoolId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostPoolName)
}

// Segments returns a slice of Resource ID Segments which comprise this Host Pool ID
func (id HostPoolId) 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("staticHostPools", "hostPools", "hostPools"),
resourceids.UserSpecifiedSegment("hostPoolName", "hostPoolName"),
}
}

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

0 comments on commit 771e2c5

Please sign in to comment.