Skip to content

Commit

Permalink
Updating based on 2eda08b1
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Jul 10, 2024
1 parent 11f650c commit 9a87ed3
Show file tree
Hide file tree
Showing 20 changed files with 1,297 additions and 0 deletions.
28 changes: 28 additions & 0 deletions resource-manager/qumulostorage/2024-06-19/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package v2024_06_19

// 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/qumulostorage/2024-06-19/filesystems"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

type Client struct {
FileSystems *filesystems.FileSystemsClient
}

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

return &Client{
FileSystems: fileSystemsClient,
}, nil
}
121 changes: 121 additions & 0 deletions resource-manager/qumulostorage/2024-06-19/filesystems/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/qumulostorage/2024-06-19/filesystems` Documentation

The `filesystems` SDK allows for interaction with the Azure Resource Manager Service `qumulostorage` (API Version `2024-06-19`).

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/qumulostorage/2024-06-19/filesystems"
```


### Client Initialization

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


### Example Usage: `FileSystemsClient.CreateOrUpdate`

```go
ctx := context.TODO()
id := filesystems.NewFileSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fileSystemValue")

payload := filesystems.LiftrBaseStorageFileSystemResource{
// ...
}


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


### Example Usage: `FileSystemsClient.Delete`

```go
ctx := context.TODO()
id := filesystems.NewFileSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fileSystemValue")

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


### Example Usage: `FileSystemsClient.Get`

```go
ctx := context.TODO()
id := filesystems.NewFileSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fileSystemValue")

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: `FileSystemsClient.ListByResourceGroup`

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

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


### Example Usage: `FileSystemsClient.ListBySubscription`

```go
ctx := context.TODO()
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")

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


### Example Usage: `FileSystemsClient.Update`

```go
ctx := context.TODO()
id := filesystems.NewFileSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fileSystemValue")

payload := filesystems.LiftrBaseStorageFileSystemResourceUpdate{
// ...
}


read, err := client.Update(ctx, id, payload)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
```
26 changes: 26 additions & 0 deletions resource-manager/qumulostorage/2024-06-19/filesystems/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package filesystems

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

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

return &FileSystemsClient{
Client: client,
}, nil
}
116 changes: 116 additions & 0 deletions resource-manager/qumulostorage/2024-06-19/filesystems/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
package filesystems

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

const (
MarketplaceSubscriptionStatusPendingFulfillmentStart MarketplaceSubscriptionStatus = "PendingFulfillmentStart"
MarketplaceSubscriptionStatusSubscribed MarketplaceSubscriptionStatus = "Subscribed"
MarketplaceSubscriptionStatusSuspended MarketplaceSubscriptionStatus = "Suspended"
MarketplaceSubscriptionStatusUnsubscribed MarketplaceSubscriptionStatus = "Unsubscribed"
)

func PossibleValuesForMarketplaceSubscriptionStatus() []string {
return []string{
string(MarketplaceSubscriptionStatusPendingFulfillmentStart),
string(MarketplaceSubscriptionStatusSubscribed),
string(MarketplaceSubscriptionStatusSuspended),
string(MarketplaceSubscriptionStatusUnsubscribed),
}
}

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

func parseMarketplaceSubscriptionStatus(input string) (*MarketplaceSubscriptionStatus, error) {
vals := map[string]MarketplaceSubscriptionStatus{
"pendingfulfillmentstart": MarketplaceSubscriptionStatusPendingFulfillmentStart,
"subscribed": MarketplaceSubscriptionStatusSubscribed,
"suspended": MarketplaceSubscriptionStatusSuspended,
"unsubscribed": MarketplaceSubscriptionStatusUnsubscribed,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type ProvisioningState string

const (
ProvisioningStateAccepted ProvisioningState = "Accepted"
ProvisioningStateCanceled ProvisioningState = "Canceled"
ProvisioningStateCreating ProvisioningState = "Creating"
ProvisioningStateDeleted ProvisioningState = "Deleted"
ProvisioningStateDeleting ProvisioningState = "Deleting"
ProvisioningStateFailed ProvisioningState = "Failed"
ProvisioningStateSucceeded ProvisioningState = "Succeeded"
ProvisioningStateUpdating ProvisioningState = "Updating"
)

func PossibleValuesForProvisioningState() []string {
return []string{
string(ProvisioningStateAccepted),
string(ProvisioningStateCanceled),
string(ProvisioningStateCreating),
string(ProvisioningStateDeleted),
string(ProvisioningStateDeleting),
string(ProvisioningStateFailed),
string(ProvisioningStateSucceeded),
string(ProvisioningStateUpdating),
}
}

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

func parseProvisioningState(input string) (*ProvisioningState, error) {
vals := map[string]ProvisioningState{
"accepted": ProvisioningStateAccepted,
"canceled": ProvisioningStateCanceled,
"creating": ProvisioningStateCreating,
"deleted": ProvisioningStateDeleted,
"deleting": ProvisioningStateDeleting,
"failed": ProvisioningStateFailed,
"succeeded": ProvisioningStateSucceeded,
"updating": ProvisioningStateUpdating,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

0 comments on commit 9a87ed3

Please sign in to comment.