package
0.20240715.1103416
Repository: https://github.com/hashicorp/go-azure-sdk.git
Documentation: pkg.go.dev

# README

github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2024-04-01/backupinstances Documentation

The backupinstances 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.

Import Path

import "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2024-04-01/backupinstances"

Client Initialization

client := backupinstances.NewBackupInstancesClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer

Example Usage: BackupInstancesClient.AdhocBackup

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

payload := backupinstances.TriggerBackupRequest{
	// ...
}


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

Example Usage: BackupInstancesClient.CreateOrUpdate

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

payload := backupinstances.BackupInstanceResource{
	// ...
}


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

Example Usage: BackupInstancesClient.Delete

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

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

Example Usage: BackupInstancesClient.Get

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

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: BackupInstancesClient.List

ctx := context.TODO()
id := backupinstances.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue")

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

Example Usage: BackupInstancesClient.ResumeBackups

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

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

Example Usage: BackupInstancesClient.ResumeProtection

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

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

Example Usage: BackupInstancesClient.StopProtection

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

payload := backupinstances.StopProtectionRequest{
	// ...
}


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

Example Usage: BackupInstancesClient.SuspendBackups

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

payload := backupinstances.SuspendBackupRequest{
	// ...
}


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

Example Usage: BackupInstancesClient.SyncBackupInstance

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

payload := backupinstances.SyncBackupInstanceRequest{
	// ...
}


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

Example Usage: BackupInstancesClient.TriggerCrossRegionRestore

ctx := context.TODO()
id := backupinstances.NewProviderLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "locationValue")

payload := backupinstances.CrossRegionRestoreRequestObject{
	// ...
}


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

Example Usage: BackupInstancesClient.TriggerRehydrate

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

payload := backupinstances.AzureBackupRehydrationRequest{
	// ...
}


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

Example Usage: BackupInstancesClient.TriggerRestore

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

payload := backupinstances.AzureBackupRestoreRequest{
	// ...
}


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

Example Usage: BackupInstancesClient.ValidateCrossRegionRestore

ctx := context.TODO()
id := backupinstances.NewProviderLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "locationValue")

payload := backupinstances.ValidateCrossRegionRestoreRequestObject{
	// ...
}


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

Example Usage: BackupInstancesClient.ValidateForBackup

ctx := context.TODO()
id := backupinstances.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue")

payload := backupinstances.ValidateForBackupRequest{
	// ...
}


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

Example Usage: BackupInstancesClient.ValidateForRestore

ctx := context.TODO()
id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue")

payload := backupinstances.ValidateRestoreRequestObject{
	// ...
}


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