-
Notifications
You must be signed in to change notification settings - Fork 52
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 18, 2024
1 parent
773ed90
commit 3edc952
Showing
1,391 changed files
with
98,436 additions
and
42 deletions.
There are no files selected for viewing
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
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
64 changes: 64 additions & 0 deletions
64
resource-manager/dataprotection/2024-04-01/azurebackupjob/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,64 @@ | ||
|
||
## `github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2024-04-01/azurebackupjob` Documentation | ||
|
||
The `azurebackupjob` SDK allows for interaction with the Azure Resource Manager Service `dataprotection` (API Version `2024-04-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/dataprotection/2024-04-01/azurebackupjob" | ||
``` | ||
|
||
|
||
### Client Initialization | ||
|
||
```go | ||
client := azurebackupjob.NewAzureBackupJobClientWithBaseURI("https://management.azure.com") | ||
client.Client.Authorizer = authorizer | ||
``` | ||
|
||
|
||
### Example Usage: `AzureBackupJobClient.ExportJobsOperationResultGet` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := azurebackupjob.NewOperationIdID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "operationIdValue") | ||
|
||
read, err := client.ExportJobsOperationResultGet(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `AzureBackupJobClient.ExportJobsTrigger` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := azurebackupjob.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue") | ||
|
||
if err := client.ExportJobsTriggerThenPoll(ctx, id); err != nil { | ||
// handle the error | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `AzureBackupJobClient.JobsGet` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := azurebackupjob.NewBackupJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "jobIdValue") | ||
|
||
read, err := client.JobsGet(ctx, id) | ||
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
26
resource-manager/dataprotection/2024-04-01/azurebackupjob/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,26 @@ | ||
package azurebackupjob | ||
|
||
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 AzureBackupJobClient struct { | ||
Client *resourcemanager.Client | ||
} | ||
|
||
func NewAzureBackupJobClientWithBaseURI(sdkApi sdkEnv.Api) (*AzureBackupJobClient, error) { | ||
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "azurebackupjob", defaultApiVersion) | ||
if err != nil { | ||
return nil, fmt.Errorf("instantiating AzureBackupJobClient: %+v", err) | ||
} | ||
|
||
return &AzureBackupJobClient{ | ||
Client: client, | ||
}, nil | ||
} |
139 changes: 139 additions & 0 deletions
139
resource-manager/dataprotection/2024-04-01/azurebackupjob/id_backupjob.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,139 @@ | ||
package azurebackupjob | ||
|
||
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(&BackupJobId{}) | ||
} | ||
|
||
var _ resourceids.ResourceId = &BackupJobId{} | ||
|
||
// BackupJobId is a struct representing the Resource ID for a Backup Job | ||
type BackupJobId struct { | ||
SubscriptionId string | ||
ResourceGroupName string | ||
BackupVaultName string | ||
JobId string | ||
} | ||
|
||
// NewBackupJobID returns a new BackupJobId struct | ||
func NewBackupJobID(subscriptionId string, resourceGroupName string, backupVaultName string, jobId string) BackupJobId { | ||
return BackupJobId{ | ||
SubscriptionId: subscriptionId, | ||
ResourceGroupName: resourceGroupName, | ||
BackupVaultName: backupVaultName, | ||
JobId: jobId, | ||
} | ||
} | ||
|
||
// ParseBackupJobID parses 'input' into a BackupJobId | ||
func ParseBackupJobID(input string) (*BackupJobId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&BackupJobId{}) | ||
parsed, err := parser.Parse(input, false) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := BackupJobId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
// ParseBackupJobIDInsensitively parses 'input' case-insensitively into a BackupJobId | ||
// note: this method should only be used for API response data and not user input | ||
func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&BackupJobId{}) | ||
parsed, err := parser.Parse(input, true) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := BackupJobId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
func (id *BackupJobId) 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.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) | ||
} | ||
|
||
if id.JobId, ok = input.Parsed["jobId"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "jobId", input) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID | ||
func ValidateBackupJobID(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 := ParseBackupJobID(v); err != nil { | ||
errors = append(errors, err) | ||
} | ||
|
||
return | ||
} | ||
|
||
// ID returns the formatted Backup Job ID | ||
func (id BackupJobId) ID() string { | ||
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s/backupJobs/%s" | ||
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName, id.JobId) | ||
} | ||
|
||
// Segments returns a slice of Resource ID Segments which comprise this Backup Job ID | ||
func (id BackupJobId) 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("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), | ||
resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), | ||
resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultValue"), | ||
resourceids.StaticSegment("staticBackupJobs", "backupJobs", "backupJobs"), | ||
resourceids.UserSpecifiedSegment("jobId", "jobIdValue"), | ||
} | ||
} | ||
|
||
// String returns a human-readable description of this Backup Job ID | ||
func (id BackupJobId) String() string { | ||
components := []string{ | ||
fmt.Sprintf("Subscription: %q", id.SubscriptionId), | ||
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), | ||
fmt.Sprintf("Backup Vault Name: %q", id.BackupVaultName), | ||
fmt.Sprintf("Job: %q", id.JobId), | ||
} | ||
return fmt.Sprintf("Backup Job (%s)", strings.Join(components, "\n")) | ||
} |
Oops, something went wrong.