-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hc-github-team-tf-azure
committed
Apr 8, 2024
1 parent
925a33b
commit f606463
Showing
796 changed files
with
54,563 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
resource-manager/recoveryservicesbackup/2024-02-01/backupengines/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2024-02-01/backupengines` Documentation | ||
|
||
The `backupengines` SDK allows for interaction with the Azure Resource Manager Service `recoveryservicesbackup` (API Version `2024-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-sdk/resource-manager/recoveryservicesbackup/2024-02-01/backupengines" | ||
``` | ||
|
||
|
||
### Client Initialization | ||
|
||
```go | ||
client := backupengines.NewBackupEnginesClientWithBaseURI("https://management.azure.com") | ||
client.Client.Authorizer = authorizer | ||
``` | ||
|
||
|
||
### Example Usage: `BackupEnginesClient.Get` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := backupengines.NewBackupEngineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupEngineValue") | ||
|
||
read, err := client.Get(ctx, id, backupengines.DefaultGetOperationOptions()) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `BackupEnginesClient.List` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := backupengines.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") | ||
|
||
// alternatively `client.List(ctx, id, backupengines.DefaultListOperationOptions())` can be used to do batched pagination | ||
items, err := client.ListComplete(ctx, id, backupengines.DefaultListOperationOptions()) | ||
if err != nil { | ||
// handle the error | ||
} | ||
for _, item := range items { | ||
// do something | ||
} | ||
``` |
18 changes: 18 additions & 0 deletions
18
resource-manager/recoveryservicesbackup/2024-02-01/backupengines/client.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package backupengines | ||
|
||
import "github.com/Azure/go-autorest/autorest" | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type BackupEnginesClient struct { | ||
Client autorest.Client | ||
baseUri string | ||
} | ||
|
||
func NewBackupEnginesClientWithBaseURI(endpoint string) BackupEnginesClient { | ||
return BackupEnginesClient{ | ||
Client: autorest.NewClientWithUserAgent(userAgent()), | ||
baseUri: endpoint, | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
resource-manager/recoveryservicesbackup/2024-02-01/backupengines/constants.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package backupengines | ||
|
||
import "strings" | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type BackupEngineType string | ||
|
||
const ( | ||
BackupEngineTypeAzureBackupServerEngine BackupEngineType = "AzureBackupServerEngine" | ||
BackupEngineTypeDpmBackupEngine BackupEngineType = "DpmBackupEngine" | ||
BackupEngineTypeInvalid BackupEngineType = "Invalid" | ||
) | ||
|
||
func PossibleValuesForBackupEngineType() []string { | ||
return []string{ | ||
string(BackupEngineTypeAzureBackupServerEngine), | ||
string(BackupEngineTypeDpmBackupEngine), | ||
string(BackupEngineTypeInvalid), | ||
} | ||
} | ||
|
||
func parseBackupEngineType(input string) (*BackupEngineType, error) { | ||
vals := map[string]BackupEngineType{ | ||
"azurebackupserverengine": BackupEngineTypeAzureBackupServerEngine, | ||
"dpmbackupengine": BackupEngineTypeDpmBackupEngine, | ||
"invalid": BackupEngineTypeInvalid, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := BackupEngineType(input) | ||
return &out, nil | ||
} | ||
|
||
type BackupManagementType string | ||
|
||
const ( | ||
BackupManagementTypeAzureBackupServer BackupManagementType = "AzureBackupServer" | ||
BackupManagementTypeAzureIaasVM BackupManagementType = "AzureIaasVM" | ||
BackupManagementTypeAzureSql BackupManagementType = "AzureSql" | ||
BackupManagementTypeAzureStorage BackupManagementType = "AzureStorage" | ||
BackupManagementTypeAzureWorkload BackupManagementType = "AzureWorkload" | ||
BackupManagementTypeDPM BackupManagementType = "DPM" | ||
BackupManagementTypeDefaultBackup BackupManagementType = "DefaultBackup" | ||
BackupManagementTypeInvalid BackupManagementType = "Invalid" | ||
BackupManagementTypeMAB BackupManagementType = "MAB" | ||
) | ||
|
||
func PossibleValuesForBackupManagementType() []string { | ||
return []string{ | ||
string(BackupManagementTypeAzureBackupServer), | ||
string(BackupManagementTypeAzureIaasVM), | ||
string(BackupManagementTypeAzureSql), | ||
string(BackupManagementTypeAzureStorage), | ||
string(BackupManagementTypeAzureWorkload), | ||
string(BackupManagementTypeDPM), | ||
string(BackupManagementTypeDefaultBackup), | ||
string(BackupManagementTypeInvalid), | ||
string(BackupManagementTypeMAB), | ||
} | ||
} | ||
|
||
func parseBackupManagementType(input string) (*BackupManagementType, error) { | ||
vals := map[string]BackupManagementType{ | ||
"azurebackupserver": BackupManagementTypeAzureBackupServer, | ||
"azureiaasvm": BackupManagementTypeAzureIaasVM, | ||
"azuresql": BackupManagementTypeAzureSql, | ||
"azurestorage": BackupManagementTypeAzureStorage, | ||
"azureworkload": BackupManagementTypeAzureWorkload, | ||
"dpm": BackupManagementTypeDPM, | ||
"defaultbackup": BackupManagementTypeDefaultBackup, | ||
"invalid": BackupManagementTypeInvalid, | ||
"mab": BackupManagementTypeMAB, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := BackupManagementType(input) | ||
return &out, nil | ||
} |
134 changes: 134 additions & 0 deletions
134
resource-manager/recoveryservicesbackup/2024-02-01/backupengines/id_backupengine.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
package backupengines | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"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. | ||
|
||
var _ resourceids.ResourceId = &BackupEngineId{} | ||
|
||
// BackupEngineId is a struct representing the Resource ID for a Backup Engine | ||
type BackupEngineId struct { | ||
SubscriptionId string | ||
ResourceGroupName string | ||
VaultName string | ||
BackupEngineName string | ||
} | ||
|
||
// NewBackupEngineID returns a new BackupEngineId struct | ||
func NewBackupEngineID(subscriptionId string, resourceGroupName string, vaultName string, backupEngineName string) BackupEngineId { | ||
return BackupEngineId{ | ||
SubscriptionId: subscriptionId, | ||
ResourceGroupName: resourceGroupName, | ||
VaultName: vaultName, | ||
BackupEngineName: backupEngineName, | ||
} | ||
} | ||
|
||
// ParseBackupEngineID parses 'input' into a BackupEngineId | ||
func ParseBackupEngineID(input string) (*BackupEngineId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&BackupEngineId{}) | ||
parsed, err := parser.Parse(input, false) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := BackupEngineId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
// ParseBackupEngineIDInsensitively parses 'input' case-insensitively into a BackupEngineId | ||
// note: this method should only be used for API response data and not user input | ||
func ParseBackupEngineIDInsensitively(input string) (*BackupEngineId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&BackupEngineId{}) | ||
parsed, err := parser.Parse(input, true) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := BackupEngineId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
func (id *BackupEngineId) 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.VaultName, ok = input.Parsed["vaultName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) | ||
} | ||
|
||
if id.BackupEngineName, ok = input.Parsed["backupEngineName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", input) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// ValidateBackupEngineID checks that 'input' can be parsed as a Backup Engine ID | ||
func ValidateBackupEngineID(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 := ParseBackupEngineID(v); err != nil { | ||
errors = append(errors, err) | ||
} | ||
|
||
return | ||
} | ||
|
||
// ID returns the formatted Backup Engine ID | ||
func (id BackupEngineId) ID() string { | ||
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/backupEngines/%s" | ||
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.BackupEngineName) | ||
} | ||
|
||
// Segments returns a slice of Resource ID Segments which comprise this Backup Engine ID | ||
func (id BackupEngineId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), | ||
resourceids.StaticSegment("staticVaults", "vaults", "vaults"), | ||
resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), | ||
resourceids.StaticSegment("staticBackupEngines", "backupEngines", "backupEngines"), | ||
resourceids.UserSpecifiedSegment("backupEngineName", "backupEngineValue"), | ||
} | ||
} | ||
|
||
// String returns a human-readable description of this Backup Engine ID | ||
func (id BackupEngineId) String() string { | ||
components := []string{ | ||
fmt.Sprintf("Subscription: %q", id.SubscriptionId), | ||
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), | ||
fmt.Sprintf("Vault Name: %q", id.VaultName), | ||
fmt.Sprintf("Backup Engine Name: %q", id.BackupEngineName), | ||
} | ||
return fmt.Sprintf("Backup Engine (%s)", strings.Join(components, "\n")) | ||
} |
Oops, something went wrong.