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 (9483cefaa4d66351f77f1a614ab96712f47568bf) #1047

Merged
merged 1 commit into from
Jul 12, 2024
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,53 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2024-05-20-preview/agentversions` Documentation

The `agentversions` SDK allows for interaction with the Azure Resource Manager Service `hybridcompute` (API Version `2024-05-20-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/hybridcompute/2024-05-20-preview/agentversions"
```


### Client Initialization

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


### Example Usage: `AgentVersionsClient.AgentVersionGet`

```go
ctx := context.TODO()
id := agentversions.NewAgentVersionID("osTypeValue", "agentVersionValue")

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


### Example Usage: `AgentVersionsClient.AgentVersionList`

```go
ctx := context.TODO()
id := agentversions.NewOsTypeID("osTypeValue")

// alternatively `client.AgentVersionList(ctx, id)` can be used to do batched pagination
items, err := client.AgentVersionListComplete(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 agentversions

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 AgentVersionsClient struct {
Client *resourcemanager.Client
}

func NewAgentVersionsClientWithBaseURI(sdkApi sdkEnv.Api) (*AgentVersionsClient, error) {
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "agentversions", defaultApiVersion)
if err != nil {
return nil, fmt.Errorf("instantiating AgentVersionsClient: %+v", err)
}

return &AgentVersionsClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package agentversions

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(&AgentVersionId{})
}

var _ resourceids.ResourceId = &AgentVersionId{}

// AgentVersionId is a struct representing the Resource ID for a Agent Version
type AgentVersionId struct {
OsTypeName string
AgentVersionName string
}

// NewAgentVersionID returns a new AgentVersionId struct
func NewAgentVersionID(osTypeName string, agentVersionName string) AgentVersionId {
return AgentVersionId{
OsTypeName: osTypeName,
AgentVersionName: agentVersionName,
}
}

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

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

return &id, nil
}

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

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

return &id, nil
}

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

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

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

return nil
}

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

return
}

// ID returns the formatted Agent Version ID
func (id AgentVersionId) ID() string {
fmtString := "/providers/Microsoft.HybridCompute/osType/%s/agentVersions/%s"
return fmt.Sprintf(fmtString, id.OsTypeName, id.AgentVersionName)
}

// Segments returns a slice of Resource ID Segments which comprise this Agent Version ID
func (id AgentVersionId) Segments() []resourceids.Segment {
return []resourceids.Segment{
resourceids.StaticSegment("staticProviders", "providers", "providers"),
resourceids.ResourceProviderSegment("staticMicrosoftHybridCompute", "Microsoft.HybridCompute", "Microsoft.HybridCompute"),
resourceids.StaticSegment("staticOsType", "osType", "osType"),
resourceids.UserSpecifiedSegment("osTypeName", "osTypeValue"),
resourceids.StaticSegment("staticAgentVersions", "agentVersions", "agentVersions"),
resourceids.UserSpecifiedSegment("agentVersionName", "agentVersionValue"),
}
}

// String returns a human-readable description of this Agent Version ID
func (id AgentVersionId) String() string {
components := []string{
fmt.Sprintf("Os Type Name: %q", id.OsTypeName),
fmt.Sprintf("Agent Version Name: %q", id.AgentVersionName),
}
return fmt.Sprintf("Agent Version (%s)", strings.Join(components, "\n"))
}
Loading
Loading