Skip to content

Commit b0e1448

Browse files
authored
Merge pull request #1184 from hashicorp/auto-pr/58329c4db
Auto PR: Regenerating the Go SDK (d5efbc5)
2 parents 3c516fa + d5efbc5 commit b0e1448

File tree

4,085 files changed

+302636
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,085 files changed

+302636
-12
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
## `github.com/hashicorp/go-azure-sdk/resource-manager/advisor/2025-01-01/advisorscore` Documentation
3+
4+
The `advisorscore` SDK allows for interaction with Azure Resource Manager `advisor` (API Version `2025-01-01`).
5+
6+
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).
7+
8+
### Import Path
9+
10+
```go
11+
import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
12+
import "github.com/hashicorp/go-azure-sdk/resource-manager/advisor/2025-01-01/advisorscore"
13+
```
14+
15+
16+
### Client Initialization
17+
18+
```go
19+
client := advisorscore.NewAdvisorScoreClientWithBaseURI("https://management.azure.com")
20+
client.Client.Authorizer = authorizer
21+
```
22+
23+
24+
### Example Usage: `AdvisorScoreClient.Get`
25+
26+
```go
27+
ctx := context.TODO()
28+
id := advisorscore.NewAdvisorScoreID("12345678-1234-9876-4563-123456789012", "advisorScoreName")
29+
30+
read, err := client.Get(ctx, id)
31+
if err != nil {
32+
// handle the error
33+
}
34+
if model := read.Model; model != nil {
35+
// do something with the model/response object
36+
}
37+
```
38+
39+
40+
### Example Usage: `AdvisorScoreClient.List`
41+
42+
```go
43+
ctx := context.TODO()
44+
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")
45+
46+
read, err := client.List(ctx, id)
47+
if err != nil {
48+
// handle the error
49+
}
50+
if model := read.Model; model != nil {
51+
// do something with the model/response object
52+
}
53+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package advisorscore
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
7+
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
8+
)
9+
10+
// Copyright (c) Microsoft Corporation. All rights reserved.
11+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
12+
13+
type AdvisorScoreClient struct {
14+
Client *resourcemanager.Client
15+
}
16+
17+
func NewAdvisorScoreClientWithBaseURI(sdkApi sdkEnv.Api) (*AdvisorScoreClient, error) {
18+
client, err := resourcemanager.NewClient(sdkApi, "advisorscore", defaultApiVersion)
19+
if err != nil {
20+
return nil, fmt.Errorf("instantiating AdvisorScoreClient: %+v", err)
21+
}
22+
23+
return &AdvisorScoreClient{
24+
Client: client,
25+
}, nil
26+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package advisorscore
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"strings"
7+
)
8+
9+
// Copyright (c) Microsoft Corporation. All rights reserved.
10+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
11+
12+
type Aggregated string
13+
14+
const (
15+
AggregatedDay Aggregated = "day"
16+
AggregatedMonth Aggregated = "month"
17+
AggregatedWeek Aggregated = "week"
18+
)
19+
20+
func PossibleValuesForAggregated() []string {
21+
return []string{
22+
string(AggregatedDay),
23+
string(AggregatedMonth),
24+
string(AggregatedWeek),
25+
}
26+
}
27+
28+
func (s *Aggregated) UnmarshalJSON(bytes []byte) error {
29+
var decoded string
30+
if err := json.Unmarshal(bytes, &decoded); err != nil {
31+
return fmt.Errorf("unmarshaling: %+v", err)
32+
}
33+
out, err := parseAggregated(decoded)
34+
if err != nil {
35+
return fmt.Errorf("parsing %q: %+v", decoded, err)
36+
}
37+
*s = *out
38+
return nil
39+
}
40+
41+
func parseAggregated(input string) (*Aggregated, error) {
42+
vals := map[string]Aggregated{
43+
"day": AggregatedDay,
44+
"month": AggregatedMonth,
45+
"week": AggregatedWeek,
46+
}
47+
if v, ok := vals[strings.ToLower(input)]; ok {
48+
return &v, nil
49+
}
50+
51+
// otherwise presume it's an undefined value and best-effort it
52+
out := Aggregated(input)
53+
return &out, nil
54+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
package advisorscore
2+
3+
import (
4+
"fmt"
5+
"strings"
6+
7+
"github.com/hashicorp/go-azure-helpers/resourcemanager/recaser"
8+
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
9+
)
10+
11+
// Copyright (c) Microsoft Corporation. All rights reserved.
12+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
13+
14+
func init() {
15+
recaser.RegisterResourceId(&AdvisorScoreId{})
16+
}
17+
18+
var _ resourceids.ResourceId = &AdvisorScoreId{}
19+
20+
// AdvisorScoreId is a struct representing the Resource ID for a Advisor Score
21+
type AdvisorScoreId struct {
22+
SubscriptionId string
23+
AdvisorScoreName string
24+
}
25+
26+
// NewAdvisorScoreID returns a new AdvisorScoreId struct
27+
func NewAdvisorScoreID(subscriptionId string, advisorScoreName string) AdvisorScoreId {
28+
return AdvisorScoreId{
29+
SubscriptionId: subscriptionId,
30+
AdvisorScoreName: advisorScoreName,
31+
}
32+
}
33+
34+
// ParseAdvisorScoreID parses 'input' into a AdvisorScoreId
35+
func ParseAdvisorScoreID(input string) (*AdvisorScoreId, error) {
36+
parser := resourceids.NewParserFromResourceIdType(&AdvisorScoreId{})
37+
parsed, err := parser.Parse(input, false)
38+
if err != nil {
39+
return nil, fmt.Errorf("parsing %q: %+v", input, err)
40+
}
41+
42+
id := AdvisorScoreId{}
43+
if err = id.FromParseResult(*parsed); err != nil {
44+
return nil, err
45+
}
46+
47+
return &id, nil
48+
}
49+
50+
// ParseAdvisorScoreIDInsensitively parses 'input' case-insensitively into a AdvisorScoreId
51+
// note: this method should only be used for API response data and not user input
52+
func ParseAdvisorScoreIDInsensitively(input string) (*AdvisorScoreId, error) {
53+
parser := resourceids.NewParserFromResourceIdType(&AdvisorScoreId{})
54+
parsed, err := parser.Parse(input, true)
55+
if err != nil {
56+
return nil, fmt.Errorf("parsing %q: %+v", input, err)
57+
}
58+
59+
id := AdvisorScoreId{}
60+
if err = id.FromParseResult(*parsed); err != nil {
61+
return nil, err
62+
}
63+
64+
return &id, nil
65+
}
66+
67+
func (id *AdvisorScoreId) FromParseResult(input resourceids.ParseResult) error {
68+
var ok bool
69+
70+
if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok {
71+
return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input)
72+
}
73+
74+
if id.AdvisorScoreName, ok = input.Parsed["advisorScoreName"]; !ok {
75+
return resourceids.NewSegmentNotSpecifiedError(id, "advisorScoreName", input)
76+
}
77+
78+
return nil
79+
}
80+
81+
// ValidateAdvisorScoreID checks that 'input' can be parsed as a Advisor Score ID
82+
func ValidateAdvisorScoreID(input interface{}, key string) (warnings []string, errors []error) {
83+
v, ok := input.(string)
84+
if !ok {
85+
errors = append(errors, fmt.Errorf("expected %q to be a string", key))
86+
return
87+
}
88+
89+
if _, err := ParseAdvisorScoreID(v); err != nil {
90+
errors = append(errors, err)
91+
}
92+
93+
return
94+
}
95+
96+
// ID returns the formatted Advisor Score ID
97+
func (id AdvisorScoreId) ID() string {
98+
fmtString := "/subscriptions/%s/providers/Microsoft.Advisor/advisorScore/%s"
99+
return fmt.Sprintf(fmtString, id.SubscriptionId, id.AdvisorScoreName)
100+
}
101+
102+
// Segments returns a slice of Resource ID Segments which comprise this Advisor Score ID
103+
func (id AdvisorScoreId) Segments() []resourceids.Segment {
104+
return []resourceids.Segment{
105+
resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"),
106+
resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"),
107+
resourceids.StaticSegment("staticProviders", "providers", "providers"),
108+
resourceids.ResourceProviderSegment("staticMicrosoftAdvisor", "Microsoft.Advisor", "Microsoft.Advisor"),
109+
resourceids.StaticSegment("staticAdvisorScore", "advisorScore", "advisorScore"),
110+
resourceids.UserSpecifiedSegment("advisorScoreName", "advisorScoreName"),
111+
}
112+
}
113+
114+
// String returns a human-readable description of this Advisor Score ID
115+
func (id AdvisorScoreId) String() string {
116+
components := []string{
117+
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
118+
fmt.Sprintf("Advisor Score Name: %q", id.AdvisorScoreName),
119+
}
120+
return fmt.Sprintf("Advisor Score (%s)", strings.Join(components, "\n"))
121+
}

0 commit comments

Comments
 (0)