/
replicatedVM.go
210 lines (197 loc) · 10.4 KB
/
replicatedVM.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
// nolint: lll
package siterecovery
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages a VM replicated using Azure Site Recovery (Azure to Azure only). A replicated VM keeps a copiously updated image of the VM in another region in order to be able to start the VM in that region in case of a disaster.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/site_recovery_replicated_vm.html.markdown.
type ReplicatedVM struct {
pulumi.CustomResourceState
// One or more `managedDisk` block.
ManagedDisks ReplicatedVMManagedDiskArrayOutput `pulumi:"managedDisks"`
// The name of the network mapping.
Name pulumi.StringOutput `pulumi:"name"`
RecoveryReplicationPolicyId pulumi.StringOutput `pulumi:"recoveryReplicationPolicyId"`
// The name of the vault that should be updated.
RecoveryVaultName pulumi.StringOutput `pulumi:"recoveryVaultName"`
// Name of the resource group where the vault that should be updated is located.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// Name of fabric that should contains this replication.
SourceRecoveryFabricName pulumi.StringOutput `pulumi:"sourceRecoveryFabricName"`
// Name of the protection container to use.
SourceRecoveryProtectionContainerName pulumi.StringOutput `pulumi:"sourceRecoveryProtectionContainerName"`
// Id of the VM to replicate
SourceVmId pulumi.StringOutput `pulumi:"sourceVmId"`
// Id of availability set that the new VM should belong to when a failover is done.
TargetAvailabilitySetId pulumi.StringPtrOutput `pulumi:"targetAvailabilitySetId"`
// Id of fabric where the VM replication should be handled when a failover is done.
TargetRecoveryFabricId pulumi.StringOutput `pulumi:"targetRecoveryFabricId"`
// Id of protection container where the VM replication should be created when a failover is done.
TargetRecoveryProtectionContainerId pulumi.StringOutput `pulumi:"targetRecoveryProtectionContainerId"`
// Id of resource group where the VM should be created when a failover is done.
TargetResourceGroupId pulumi.StringOutput `pulumi:"targetResourceGroupId"`
}
// NewReplicatedVM registers a new resource with the given unique name, arguments, and options.
func NewReplicatedVM(ctx *pulumi.Context,
name string, args *ReplicatedVMArgs, opts ...pulumi.ResourceOption) (*ReplicatedVM, error) {
if args == nil || args.RecoveryReplicationPolicyId == nil {
return nil, errors.New("missing required argument 'RecoveryReplicationPolicyId'")
}
if args == nil || args.RecoveryVaultName == nil {
return nil, errors.New("missing required argument 'RecoveryVaultName'")
}
if args == nil || args.ResourceGroupName == nil {
return nil, errors.New("missing required argument 'ResourceGroupName'")
}
if args == nil || args.SourceRecoveryFabricName == nil {
return nil, errors.New("missing required argument 'SourceRecoveryFabricName'")
}
if args == nil || args.SourceRecoveryProtectionContainerName == nil {
return nil, errors.New("missing required argument 'SourceRecoveryProtectionContainerName'")
}
if args == nil || args.SourceVmId == nil {
return nil, errors.New("missing required argument 'SourceVmId'")
}
if args == nil || args.TargetRecoveryFabricId == nil {
return nil, errors.New("missing required argument 'TargetRecoveryFabricId'")
}
if args == nil || args.TargetRecoveryProtectionContainerId == nil {
return nil, errors.New("missing required argument 'TargetRecoveryProtectionContainerId'")
}
if args == nil || args.TargetResourceGroupId == nil {
return nil, errors.New("missing required argument 'TargetResourceGroupId'")
}
if args == nil {
args = &ReplicatedVMArgs{}
}
var resource ReplicatedVM
err := ctx.RegisterResource("azure:siterecovery/replicatedVM:ReplicatedVM", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetReplicatedVM gets an existing ReplicatedVM resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetReplicatedVM(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ReplicatedVMState, opts ...pulumi.ResourceOption) (*ReplicatedVM, error) {
var resource ReplicatedVM
err := ctx.ReadResource("azure:siterecovery/replicatedVM:ReplicatedVM", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ReplicatedVM resources.
type replicatedVMState struct {
// One or more `managedDisk` block.
ManagedDisks []ReplicatedVMManagedDisk `pulumi:"managedDisks"`
// The name of the network mapping.
Name *string `pulumi:"name"`
RecoveryReplicationPolicyId *string `pulumi:"recoveryReplicationPolicyId"`
// The name of the vault that should be updated.
RecoveryVaultName *string `pulumi:"recoveryVaultName"`
// Name of the resource group where the vault that should be updated is located.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// Name of fabric that should contains this replication.
SourceRecoveryFabricName *string `pulumi:"sourceRecoveryFabricName"`
// Name of the protection container to use.
SourceRecoveryProtectionContainerName *string `pulumi:"sourceRecoveryProtectionContainerName"`
// Id of the VM to replicate
SourceVmId *string `pulumi:"sourceVmId"`
// Id of availability set that the new VM should belong to when a failover is done.
TargetAvailabilitySetId *string `pulumi:"targetAvailabilitySetId"`
// Id of fabric where the VM replication should be handled when a failover is done.
TargetRecoveryFabricId *string `pulumi:"targetRecoveryFabricId"`
// Id of protection container where the VM replication should be created when a failover is done.
TargetRecoveryProtectionContainerId *string `pulumi:"targetRecoveryProtectionContainerId"`
// Id of resource group where the VM should be created when a failover is done.
TargetResourceGroupId *string `pulumi:"targetResourceGroupId"`
}
type ReplicatedVMState struct {
// One or more `managedDisk` block.
ManagedDisks ReplicatedVMManagedDiskArrayInput
// The name of the network mapping.
Name pulumi.StringPtrInput
RecoveryReplicationPolicyId pulumi.StringPtrInput
// The name of the vault that should be updated.
RecoveryVaultName pulumi.StringPtrInput
// Name of the resource group where the vault that should be updated is located.
ResourceGroupName pulumi.StringPtrInput
// Name of fabric that should contains this replication.
SourceRecoveryFabricName pulumi.StringPtrInput
// Name of the protection container to use.
SourceRecoveryProtectionContainerName pulumi.StringPtrInput
// Id of the VM to replicate
SourceVmId pulumi.StringPtrInput
// Id of availability set that the new VM should belong to when a failover is done.
TargetAvailabilitySetId pulumi.StringPtrInput
// Id of fabric where the VM replication should be handled when a failover is done.
TargetRecoveryFabricId pulumi.StringPtrInput
// Id of protection container where the VM replication should be created when a failover is done.
TargetRecoveryProtectionContainerId pulumi.StringPtrInput
// Id of resource group where the VM should be created when a failover is done.
TargetResourceGroupId pulumi.StringPtrInput
}
func (ReplicatedVMState) ElementType() reflect.Type {
return reflect.TypeOf((*replicatedVMState)(nil)).Elem()
}
type replicatedVMArgs struct {
// One or more `managedDisk` block.
ManagedDisks []ReplicatedVMManagedDisk `pulumi:"managedDisks"`
// The name of the network mapping.
Name *string `pulumi:"name"`
RecoveryReplicationPolicyId string `pulumi:"recoveryReplicationPolicyId"`
// The name of the vault that should be updated.
RecoveryVaultName string `pulumi:"recoveryVaultName"`
// Name of the resource group where the vault that should be updated is located.
ResourceGroupName string `pulumi:"resourceGroupName"`
// Name of fabric that should contains this replication.
SourceRecoveryFabricName string `pulumi:"sourceRecoveryFabricName"`
// Name of the protection container to use.
SourceRecoveryProtectionContainerName string `pulumi:"sourceRecoveryProtectionContainerName"`
// Id of the VM to replicate
SourceVmId string `pulumi:"sourceVmId"`
// Id of availability set that the new VM should belong to when a failover is done.
TargetAvailabilitySetId *string `pulumi:"targetAvailabilitySetId"`
// Id of fabric where the VM replication should be handled when a failover is done.
TargetRecoveryFabricId string `pulumi:"targetRecoveryFabricId"`
// Id of protection container where the VM replication should be created when a failover is done.
TargetRecoveryProtectionContainerId string `pulumi:"targetRecoveryProtectionContainerId"`
// Id of resource group where the VM should be created when a failover is done.
TargetResourceGroupId string `pulumi:"targetResourceGroupId"`
}
// The set of arguments for constructing a ReplicatedVM resource.
type ReplicatedVMArgs struct {
// One or more `managedDisk` block.
ManagedDisks ReplicatedVMManagedDiskArrayInput
// The name of the network mapping.
Name pulumi.StringPtrInput
RecoveryReplicationPolicyId pulumi.StringInput
// The name of the vault that should be updated.
RecoveryVaultName pulumi.StringInput
// Name of the resource group where the vault that should be updated is located.
ResourceGroupName pulumi.StringInput
// Name of fabric that should contains this replication.
SourceRecoveryFabricName pulumi.StringInput
// Name of the protection container to use.
SourceRecoveryProtectionContainerName pulumi.StringInput
// Id of the VM to replicate
SourceVmId pulumi.StringInput
// Id of availability set that the new VM should belong to when a failover is done.
TargetAvailabilitySetId pulumi.StringPtrInput
// Id of fabric where the VM replication should be handled when a failover is done.
TargetRecoveryFabricId pulumi.StringInput
// Id of protection container where the VM replication should be created when a failover is done.
TargetRecoveryProtectionContainerId pulumi.StringInput
// Id of resource group where the VM should be created when a failover is done.
TargetResourceGroupId pulumi.StringInput
}
func (ReplicatedVMArgs) ElementType() reflect.Type {
return reflect.TypeOf((*replicatedVMArgs)(nil)).Elem()
}