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 (a3853dcf6ca0832507c384bcaa200a98f3dbcfcf) #966

Merged
merged 1 commit into from
Apr 16, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions resource-manager/quota/2023-02-01/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package v2023_02_01

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

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/quota/2023-02-01/quotainformation"
"github.com/hashicorp/go-azure-sdk/resource-manager/quota/2023-02-01/quotarequests"
"github.com/hashicorp/go-azure-sdk/resource-manager/quota/2023-02-01/usagesinformation"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

type Client struct {
QuotaInformation *quotainformation.QuotaInformationClient
QuotaRequests *quotarequests.QuotaRequestsClient
UsagesInformation *usagesinformation.UsagesInformationClient
}

func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
quotaInformationClient, err := quotainformation.NewQuotaInformationClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building QuotaInformation client: %+v", err)
}
configureFunc(quotaInformationClient.Client)

quotaRequestsClient, err := quotarequests.NewQuotaRequestsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building QuotaRequests client: %+v", err)
}
configureFunc(quotaRequestsClient.Client)

usagesInformationClient, err := usagesinformation.NewUsagesInformationClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building UsagesInformation client: %+v", err)
}
configureFunc(usagesInformationClient.Client)

return &Client{
QuotaInformation: quotaInformationClient,
QuotaRequests: quotaRequestsClient,
UsagesInformation: usagesInformationClient,
}, nil
}
88 changes: 88 additions & 0 deletions resource-manager/quota/2023-02-01/quotainformation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/quota/2023-02-01/quotainformation` Documentation

The `quotainformation` SDK allows for interaction with the Azure Resource Manager Service `quota` (API Version `2023-02-01`).

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-helpers/resourcemanager/commonids"
import "github.com/hashicorp/go-azure-sdk/resource-manager/quota/2023-02-01/quotainformation"
```


### Client Initialization

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


### Example Usage: `QuotaInformationClient.QuotaCreateOrUpdate`

```go
ctx := context.TODO()
id := quotainformation.NewScopedQuotaID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "quotaValue")

payload := quotainformation.CurrentQuotaLimitBase{
// ...
}


if err := client.QuotaCreateOrUpdateThenPoll(ctx, id, payload); err != nil {
// handle the error
}
```


### Example Usage: `QuotaInformationClient.QuotaGet`

```go
ctx := context.TODO()
id := quotainformation.NewScopedQuotaID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "quotaValue")

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


### Example Usage: `QuotaInformationClient.QuotaList`

```go
ctx := context.TODO()
id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group")

// alternatively `client.QuotaList(ctx, id)` can be used to do batched pagination
items, err := client.QuotaListComplete(ctx, id)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
```


### Example Usage: `QuotaInformationClient.QuotaUpdate`

```go
ctx := context.TODO()
id := quotainformation.NewScopedQuotaID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "quotaValue")

payload := quotainformation.CurrentQuotaLimitBase{
// ...
}


if err := client.QuotaUpdateThenPoll(ctx, id, payload); err != nil {
// handle the error
}
```
26 changes: 26 additions & 0 deletions resource-manager/quota/2023-02-01/quotainformation/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package quotainformation

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

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

return &QuotaInformationClient{
Client: client,
}, nil
}
89 changes: 89 additions & 0 deletions resource-manager/quota/2023-02-01/quotainformation/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package quotainformation

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 LimitType string

const (
LimitTypeLimitValue LimitType = "LimitValue"
)

func PossibleValuesForLimitType() []string {
return []string{
string(LimitTypeLimitValue),
}
}

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

func parseLimitType(input string) (*LimitType, error) {
vals := map[string]LimitType{
"limitvalue": LimitTypeLimitValue,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type QuotaLimitTypes string

const (
QuotaLimitTypesIndependent QuotaLimitTypes = "Independent"
QuotaLimitTypesShared QuotaLimitTypes = "Shared"
)

func PossibleValuesForQuotaLimitTypes() []string {
return []string{
string(QuotaLimitTypesIndependent),
string(QuotaLimitTypesShared),
}
}

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

func parseQuotaLimitTypes(input string) (*QuotaLimitTypes, error) {
vals := map[string]QuotaLimitTypes{
"independent": QuotaLimitTypesIndependent,
"shared": QuotaLimitTypesShared,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := QuotaLimitTypes(input)
return &out, nil
}
120 changes: 120 additions & 0 deletions resource-manager/quota/2023-02-01/quotainformation/id_scopedquota.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package quotainformation

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

var _ resourceids.ResourceId = &ScopedQuotaId{}

// ScopedQuotaId is a struct representing the Resource ID for a Scoped Quota
type ScopedQuotaId struct {
Scope string
QuotaName string
}

// NewScopedQuotaID returns a new ScopedQuotaId struct
func NewScopedQuotaID(scope string, quotaName string) ScopedQuotaId {
return ScopedQuotaId{
Scope: scope,
QuotaName: quotaName,
}
}

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

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

return &id, nil
}

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

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

return &id, nil
}

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

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

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

return nil
}

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

return
}

// ID returns the formatted Scoped Quota ID
func (id ScopedQuotaId) ID() string {
fmtString := "/%s/providers/Microsoft.Quota/quotas/%s"
return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.QuotaName)
}

// Segments returns a slice of Resource ID Segments which comprise this Scoped Quota ID
func (id ScopedQuotaId) Segments() []resourceids.Segment {
return []resourceids.Segment{
resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"),
resourceids.StaticSegment("staticProviders", "providers", "providers"),
resourceids.ResourceProviderSegment("staticMicrosoftQuota", "Microsoft.Quota", "Microsoft.Quota"),
resourceids.StaticSegment("staticQuotas", "quotas", "quotas"),
resourceids.UserSpecifiedSegment("quotaName", "quotaValue"),
}
}

// String returns a human-readable description of this Scoped Quota ID
func (id ScopedQuotaId) String() string {
components := []string{
fmt.Sprintf("Scope: %q", id.Scope),
fmt.Sprintf("Quota Name: %q", id.QuotaName),
}
return fmt.Sprintf("Scoped Quota (%s)", strings.Join(components, "\n"))
}
Loading
Loading