/
hyperVReplicationPolicyAssociation.go
323 lines (274 loc) · 15.4 KB
/
hyperVReplicationPolicyAssociation.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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package siterecovery
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an Azure Site Recovery replication policy for HyperV within a Recovery Vault.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/recoveryservices"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/siterecovery"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("example-rg"),
// Location: pulumi.String("East US"),
// })
// if err != nil {
// return err
// }
// exampleVault, err := recoveryservices.NewVault(ctx, "example", &recoveryservices.VaultArgs{
// Name: pulumi.String("example-recovery-vault"),
// Location: example.Location,
// ResourceGroupName: example.Name,
// Sku: pulumi.String("Standard"),
// })
// if err != nil {
// return err
// }
// exampleHyperVSite, err := siterecovery.NewHyperVSite(ctx, "example", &siterecovery.HyperVSiteArgs{
// RecoveryVaultId: exampleVault.ID(),
// Name: pulumi.String("example-site"),
// })
// if err != nil {
// return err
// }
// exampleHyperVReplicationPolicy, err := siterecovery.NewHyperVReplicationPolicy(ctx, "example", &siterecovery.HyperVReplicationPolicyArgs{
// Name: pulumi.String("policy"),
// RecoveryVaultId: exampleVault.ID(),
// RecoveryPointRetentionInHours: pulumi.Int(2),
// ApplicationConsistentSnapshotFrequencyInHours: pulumi.Int(1),
// ReplicationIntervalInSeconds: pulumi.Int(300),
// })
// if err != nil {
// return err
// }
// _, err = siterecovery.NewHyperVReplicationPolicyAssociation(ctx, "example", &siterecovery.HyperVReplicationPolicyAssociationArgs{
// Name: pulumi.String("example-association"),
// HypervSiteId: exampleHyperVSite.ID(),
// PolicyId: exampleHyperVReplicationPolicy.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Site Recovery Replication Policies can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:siterecovery/hyperVReplicationPolicyAssociation:HyperVReplicationPolicyAssociation azurerm_site_recovery_hyperv_replication_policy_association.mypolicy /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationFabrics/site-name/replicationProtectionContainers/container-name/replicationProtectionContainerMappings/mapping-name
// ```
type HyperVReplicationPolicyAssociation struct {
pulumi.CustomResourceState
// The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
HypervSiteId pulumi.StringOutput `pulumi:"hypervSiteId"`
// The name of the replication policy association. Changing this forces a new association to be created.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
PolicyId pulumi.StringOutput `pulumi:"policyId"`
}
// NewHyperVReplicationPolicyAssociation registers a new resource with the given unique name, arguments, and options.
func NewHyperVReplicationPolicyAssociation(ctx *pulumi.Context,
name string, args *HyperVReplicationPolicyAssociationArgs, opts ...pulumi.ResourceOption) (*HyperVReplicationPolicyAssociation, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.HypervSiteId == nil {
return nil, errors.New("invalid value for required argument 'HypervSiteId'")
}
if args.PolicyId == nil {
return nil, errors.New("invalid value for required argument 'PolicyId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource HyperVReplicationPolicyAssociation
err := ctx.RegisterResource("azure:siterecovery/hyperVReplicationPolicyAssociation:HyperVReplicationPolicyAssociation", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetHyperVReplicationPolicyAssociation gets an existing HyperVReplicationPolicyAssociation 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 GetHyperVReplicationPolicyAssociation(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *HyperVReplicationPolicyAssociationState, opts ...pulumi.ResourceOption) (*HyperVReplicationPolicyAssociation, error) {
var resource HyperVReplicationPolicyAssociation
err := ctx.ReadResource("azure:siterecovery/hyperVReplicationPolicyAssociation:HyperVReplicationPolicyAssociation", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering HyperVReplicationPolicyAssociation resources.
type hyperVReplicationPolicyAssociationState struct {
// The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
HypervSiteId *string `pulumi:"hypervSiteId"`
// The name of the replication policy association. Changing this forces a new association to be created.
Name *string `pulumi:"name"`
// The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
PolicyId *string `pulumi:"policyId"`
}
type HyperVReplicationPolicyAssociationState struct {
// The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
HypervSiteId pulumi.StringPtrInput
// The name of the replication policy association. Changing this forces a new association to be created.
Name pulumi.StringPtrInput
// The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
PolicyId pulumi.StringPtrInput
}
func (HyperVReplicationPolicyAssociationState) ElementType() reflect.Type {
return reflect.TypeOf((*hyperVReplicationPolicyAssociationState)(nil)).Elem()
}
type hyperVReplicationPolicyAssociationArgs struct {
// The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
HypervSiteId string `pulumi:"hypervSiteId"`
// The name of the replication policy association. Changing this forces a new association to be created.
Name *string `pulumi:"name"`
// The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
PolicyId string `pulumi:"policyId"`
}
// The set of arguments for constructing a HyperVReplicationPolicyAssociation resource.
type HyperVReplicationPolicyAssociationArgs struct {
// The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
HypervSiteId pulumi.StringInput
// The name of the replication policy association. Changing this forces a new association to be created.
Name pulumi.StringPtrInput
// The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
PolicyId pulumi.StringInput
}
func (HyperVReplicationPolicyAssociationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*hyperVReplicationPolicyAssociationArgs)(nil)).Elem()
}
type HyperVReplicationPolicyAssociationInput interface {
pulumi.Input
ToHyperVReplicationPolicyAssociationOutput() HyperVReplicationPolicyAssociationOutput
ToHyperVReplicationPolicyAssociationOutputWithContext(ctx context.Context) HyperVReplicationPolicyAssociationOutput
}
func (*HyperVReplicationPolicyAssociation) ElementType() reflect.Type {
return reflect.TypeOf((**HyperVReplicationPolicyAssociation)(nil)).Elem()
}
func (i *HyperVReplicationPolicyAssociation) ToHyperVReplicationPolicyAssociationOutput() HyperVReplicationPolicyAssociationOutput {
return i.ToHyperVReplicationPolicyAssociationOutputWithContext(context.Background())
}
func (i *HyperVReplicationPolicyAssociation) ToHyperVReplicationPolicyAssociationOutputWithContext(ctx context.Context) HyperVReplicationPolicyAssociationOutput {
return pulumi.ToOutputWithContext(ctx, i).(HyperVReplicationPolicyAssociationOutput)
}
// HyperVReplicationPolicyAssociationArrayInput is an input type that accepts HyperVReplicationPolicyAssociationArray and HyperVReplicationPolicyAssociationArrayOutput values.
// You can construct a concrete instance of `HyperVReplicationPolicyAssociationArrayInput` via:
//
// HyperVReplicationPolicyAssociationArray{ HyperVReplicationPolicyAssociationArgs{...} }
type HyperVReplicationPolicyAssociationArrayInput interface {
pulumi.Input
ToHyperVReplicationPolicyAssociationArrayOutput() HyperVReplicationPolicyAssociationArrayOutput
ToHyperVReplicationPolicyAssociationArrayOutputWithContext(context.Context) HyperVReplicationPolicyAssociationArrayOutput
}
type HyperVReplicationPolicyAssociationArray []HyperVReplicationPolicyAssociationInput
func (HyperVReplicationPolicyAssociationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*HyperVReplicationPolicyAssociation)(nil)).Elem()
}
func (i HyperVReplicationPolicyAssociationArray) ToHyperVReplicationPolicyAssociationArrayOutput() HyperVReplicationPolicyAssociationArrayOutput {
return i.ToHyperVReplicationPolicyAssociationArrayOutputWithContext(context.Background())
}
func (i HyperVReplicationPolicyAssociationArray) ToHyperVReplicationPolicyAssociationArrayOutputWithContext(ctx context.Context) HyperVReplicationPolicyAssociationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(HyperVReplicationPolicyAssociationArrayOutput)
}
// HyperVReplicationPolicyAssociationMapInput is an input type that accepts HyperVReplicationPolicyAssociationMap and HyperVReplicationPolicyAssociationMapOutput values.
// You can construct a concrete instance of `HyperVReplicationPolicyAssociationMapInput` via:
//
// HyperVReplicationPolicyAssociationMap{ "key": HyperVReplicationPolicyAssociationArgs{...} }
type HyperVReplicationPolicyAssociationMapInput interface {
pulumi.Input
ToHyperVReplicationPolicyAssociationMapOutput() HyperVReplicationPolicyAssociationMapOutput
ToHyperVReplicationPolicyAssociationMapOutputWithContext(context.Context) HyperVReplicationPolicyAssociationMapOutput
}
type HyperVReplicationPolicyAssociationMap map[string]HyperVReplicationPolicyAssociationInput
func (HyperVReplicationPolicyAssociationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*HyperVReplicationPolicyAssociation)(nil)).Elem()
}
func (i HyperVReplicationPolicyAssociationMap) ToHyperVReplicationPolicyAssociationMapOutput() HyperVReplicationPolicyAssociationMapOutput {
return i.ToHyperVReplicationPolicyAssociationMapOutputWithContext(context.Background())
}
func (i HyperVReplicationPolicyAssociationMap) ToHyperVReplicationPolicyAssociationMapOutputWithContext(ctx context.Context) HyperVReplicationPolicyAssociationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(HyperVReplicationPolicyAssociationMapOutput)
}
type HyperVReplicationPolicyAssociationOutput struct{ *pulumi.OutputState }
func (HyperVReplicationPolicyAssociationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**HyperVReplicationPolicyAssociation)(nil)).Elem()
}
func (o HyperVReplicationPolicyAssociationOutput) ToHyperVReplicationPolicyAssociationOutput() HyperVReplicationPolicyAssociationOutput {
return o
}
func (o HyperVReplicationPolicyAssociationOutput) ToHyperVReplicationPolicyAssociationOutputWithContext(ctx context.Context) HyperVReplicationPolicyAssociationOutput {
return o
}
// The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
func (o HyperVReplicationPolicyAssociationOutput) HypervSiteId() pulumi.StringOutput {
return o.ApplyT(func(v *HyperVReplicationPolicyAssociation) pulumi.StringOutput { return v.HypervSiteId }).(pulumi.StringOutput)
}
// The name of the replication policy association. Changing this forces a new association to be created.
func (o HyperVReplicationPolicyAssociationOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *HyperVReplicationPolicyAssociation) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
func (o HyperVReplicationPolicyAssociationOutput) PolicyId() pulumi.StringOutput {
return o.ApplyT(func(v *HyperVReplicationPolicyAssociation) pulumi.StringOutput { return v.PolicyId }).(pulumi.StringOutput)
}
type HyperVReplicationPolicyAssociationArrayOutput struct{ *pulumi.OutputState }
func (HyperVReplicationPolicyAssociationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*HyperVReplicationPolicyAssociation)(nil)).Elem()
}
func (o HyperVReplicationPolicyAssociationArrayOutput) ToHyperVReplicationPolicyAssociationArrayOutput() HyperVReplicationPolicyAssociationArrayOutput {
return o
}
func (o HyperVReplicationPolicyAssociationArrayOutput) ToHyperVReplicationPolicyAssociationArrayOutputWithContext(ctx context.Context) HyperVReplicationPolicyAssociationArrayOutput {
return o
}
func (o HyperVReplicationPolicyAssociationArrayOutput) Index(i pulumi.IntInput) HyperVReplicationPolicyAssociationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *HyperVReplicationPolicyAssociation {
return vs[0].([]*HyperVReplicationPolicyAssociation)[vs[1].(int)]
}).(HyperVReplicationPolicyAssociationOutput)
}
type HyperVReplicationPolicyAssociationMapOutput struct{ *pulumi.OutputState }
func (HyperVReplicationPolicyAssociationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*HyperVReplicationPolicyAssociation)(nil)).Elem()
}
func (o HyperVReplicationPolicyAssociationMapOutput) ToHyperVReplicationPolicyAssociationMapOutput() HyperVReplicationPolicyAssociationMapOutput {
return o
}
func (o HyperVReplicationPolicyAssociationMapOutput) ToHyperVReplicationPolicyAssociationMapOutputWithContext(ctx context.Context) HyperVReplicationPolicyAssociationMapOutput {
return o
}
func (o HyperVReplicationPolicyAssociationMapOutput) MapIndex(k pulumi.StringInput) HyperVReplicationPolicyAssociationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *HyperVReplicationPolicyAssociation {
return vs[0].(map[string]*HyperVReplicationPolicyAssociation)[vs[1].(string)]
}).(HyperVReplicationPolicyAssociationOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*HyperVReplicationPolicyAssociationInput)(nil)).Elem(), &HyperVReplicationPolicyAssociation{})
pulumi.RegisterInputType(reflect.TypeOf((*HyperVReplicationPolicyAssociationArrayInput)(nil)).Elem(), HyperVReplicationPolicyAssociationArray{})
pulumi.RegisterInputType(reflect.TypeOf((*HyperVReplicationPolicyAssociationMapInput)(nil)).Elem(), HyperVReplicationPolicyAssociationMap{})
pulumi.RegisterOutputType(HyperVReplicationPolicyAssociationOutput{})
pulumi.RegisterOutputType(HyperVReplicationPolicyAssociationArrayOutput{})
pulumi.RegisterOutputType(HyperVReplicationPolicyAssociationMapOutput{})
}