Skip to content

Commit

Permalink
Updating based on c5e382c8
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Jun 12, 2024
1 parent daf9568 commit 2acc4a8
Show file tree
Hide file tree
Showing 1,116 changed files with 82,167 additions and 0 deletions.
298 changes: 298 additions & 0 deletions resource-manager/recoveryservicessiterecovery/2024-04-01/client.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2024-04-01/clusterrecoverypoint` Documentation

The `clusterrecoverypoint` SDK allows for interaction with the Azure Resource Manager Service `recoveryservicessiterecovery` (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/recoveryservicessiterecovery/2024-04-01/clusterrecoverypoint"
```


### Client Initialization

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


### Example Usage: `ClusterRecoveryPointClient.Get`

```go
ctx := context.TODO()
id := clusterrecoverypoint.NewReplicationProtectionClusterRecoveryPointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectionClusterValue", "recoveryPointValue")

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
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package clusterrecoverypoint

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

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

return &ClusterRecoveryPointClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package clusterrecoverypoint

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

const (
ClusterRecoveryPointTypeApplicationConsistent ClusterRecoveryPointType = "ApplicationConsistent"
ClusterRecoveryPointTypeCrashConsistent ClusterRecoveryPointType = "CrashConsistent"
ClusterRecoveryPointTypeNotSpecified ClusterRecoveryPointType = "NotSpecified"
)

func PossibleValuesForClusterRecoveryPointType() []string {
return []string{
string(ClusterRecoveryPointTypeApplicationConsistent),
string(ClusterRecoveryPointTypeCrashConsistent),
string(ClusterRecoveryPointTypeNotSpecified),
}
}

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

func parseClusterRecoveryPointType(input string) (*ClusterRecoveryPointType, error) {
vals := map[string]ClusterRecoveryPointType{
"applicationconsistent": ClusterRecoveryPointTypeApplicationConsistent,
"crashconsistent": ClusterRecoveryPointTypeCrashConsistent,
"notspecified": ClusterRecoveryPointTypeNotSpecified,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type RecoveryPointSyncType string

const (
RecoveryPointSyncTypeMultiVMSyncRecoveryPoint RecoveryPointSyncType = "MultiVmSyncRecoveryPoint"
)

func PossibleValuesForRecoveryPointSyncType() []string {
return []string{
string(RecoveryPointSyncTypeMultiVMSyncRecoveryPoint),
}
}

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

func parseRecoveryPointSyncType(input string) (*RecoveryPointSyncType, error) {
vals := map[string]RecoveryPointSyncType{
"multivmsyncrecoverypoint": RecoveryPointSyncTypeMultiVMSyncRecoveryPoint,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := RecoveryPointSyncType(input)
return &out, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
package clusterrecoverypoint

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(&ReplicationProtectionClusterRecoveryPointId{})
}

var _ resourceids.ResourceId = &ReplicationProtectionClusterRecoveryPointId{}

// ReplicationProtectionClusterRecoveryPointId is a struct representing the Resource ID for a Replication Protection Cluster Recovery Point
type ReplicationProtectionClusterRecoveryPointId struct {
SubscriptionId string
ResourceGroupName string
VaultName string
ReplicationFabricName string
ReplicationProtectionContainerName string
ReplicationProtectionClusterName string
RecoveryPointName string
}

// NewReplicationProtectionClusterRecoveryPointID returns a new ReplicationProtectionClusterRecoveryPointId struct
func NewReplicationProtectionClusterRecoveryPointID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string, replicationProtectionContainerName string, replicationProtectionClusterName string, recoveryPointName string) ReplicationProtectionClusterRecoveryPointId {
return ReplicationProtectionClusterRecoveryPointId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
VaultName: vaultName,
ReplicationFabricName: replicationFabricName,
ReplicationProtectionContainerName: replicationProtectionContainerName,
ReplicationProtectionClusterName: replicationProtectionClusterName,
RecoveryPointName: recoveryPointName,
}
}

// ParseReplicationProtectionClusterRecoveryPointID parses 'input' into a ReplicationProtectionClusterRecoveryPointId
func ParseReplicationProtectionClusterRecoveryPointID(input string) (*ReplicationProtectionClusterRecoveryPointId, error) {
parser := resourceids.NewParserFromResourceIdType(&ReplicationProtectionClusterRecoveryPointId{})
parsed, err := parser.Parse(input, false)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

id := ReplicationProtectionClusterRecoveryPointId{}
if err := id.FromParseResult(*parsed); err != nil {
return nil, err
}

return &id, nil
}

// ParseReplicationProtectionClusterRecoveryPointIDInsensitively parses 'input' case-insensitively into a ReplicationProtectionClusterRecoveryPointId
// note: this method should only be used for API response data and not user input
func ParseReplicationProtectionClusterRecoveryPointIDInsensitively(input string) (*ReplicationProtectionClusterRecoveryPointId, error) {
parser := resourceids.NewParserFromResourceIdType(&ReplicationProtectionClusterRecoveryPointId{})
parsed, err := parser.Parse(input, true)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

id := ReplicationProtectionClusterRecoveryPointId{}
if err := id.FromParseResult(*parsed); err != nil {
return nil, err
}

return &id, nil
}

func (id *ReplicationProtectionClusterRecoveryPointId) 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.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input)
}

if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input)
}

if id.ReplicationProtectionClusterName, ok = input.Parsed["replicationProtectionClusterName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionClusterName", input)
}

if id.RecoveryPointName, ok = input.Parsed["recoveryPointName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", input)
}

return nil
}

// ValidateReplicationProtectionClusterRecoveryPointID checks that 'input' can be parsed as a Replication Protection Cluster Recovery Point ID
func ValidateReplicationProtectionClusterRecoveryPointID(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 := ParseReplicationProtectionClusterRecoveryPointID(v); err != nil {
errors = append(errors, err)
}

return
}

// ID returns the formatted Replication Protection Cluster Recovery Point ID
func (id ReplicationProtectionClusterRecoveryPointId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s/replicationProtectionContainers/%s/replicationProtectionClusters/%s/recoveryPoints/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName, id.ReplicationProtectionContainerName, id.ReplicationProtectionClusterName, id.RecoveryPointName)
}

// Segments returns a slice of Resource ID Segments which comprise this Replication Protection Cluster Recovery Point ID
func (id ReplicationProtectionClusterRecoveryPointId) 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("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"),
resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"),
resourceids.StaticSegment("staticReplicationProtectionContainers", "replicationProtectionContainers", "replicationProtectionContainers"),
resourceids.UserSpecifiedSegment("replicationProtectionContainerName", "replicationProtectionContainerValue"),
resourceids.StaticSegment("staticReplicationProtectionClusters", "replicationProtectionClusters", "replicationProtectionClusters"),
resourceids.UserSpecifiedSegment("replicationProtectionClusterName", "replicationProtectionClusterValue"),
resourceids.StaticSegment("staticRecoveryPoints", "recoveryPoints", "recoveryPoints"),
resourceids.UserSpecifiedSegment("recoveryPointName", "recoveryPointValue"),
}
}

// String returns a human-readable description of this Replication Protection Cluster Recovery Point ID
func (id ReplicationProtectionClusterRecoveryPointId) 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("Replication Fabric Name: %q", id.ReplicationFabricName),
fmt.Sprintf("Replication Protection Container Name: %q", id.ReplicationProtectionContainerName),
fmt.Sprintf("Replication Protection Cluster Name: %q", id.ReplicationProtectionClusterName),
fmt.Sprintf("Recovery Point Name: %q", id.RecoveryPointName),
}
return fmt.Sprintf("Replication Protection Cluster Recovery Point (%s)", strings.Join(components, "\n"))
}
Loading

0 comments on commit 2acc4a8

Please sign in to comment.