Skip to content

Commit

Permalink
Merge pull request #754 from hashicorp/auto-pr/f3e198a16
Browse files Browse the repository at this point in the history
Auto PR: Regenerating the Go SDK (d08fc85)
  • Loading branch information
mbfrahry authored Nov 29, 2023
2 parents 1694069 + d08fc85 commit 1659461
Show file tree
Hide file tree
Showing 351 changed files with 26,441 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/Azure/go-autorest/autorest v0.11.29
github.com/Azure/go-autorest/autorest/adal v0.9.23
github.com/davecgh/go-spew v1.1.1
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/hashicorp/go-azure-helpers v0.64.0
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/hashicorp/go-uuid v1.0.3
Expand All @@ -22,7 +23,6 @@ require (
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2023-11-01/azurebackupjob` Documentation

The `azurebackupjob` SDK allows for interaction with the Azure Resource Manager Service `dataprotection` (API Version `2023-11-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/2023-11-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
}
```
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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package azurebackupjob

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 = 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"))
}
Loading

0 comments on commit 1659461

Please sign in to comment.