Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protection rule and Recovery plan(DR Runbook) resources and datasources #216

Merged
merged 29 commits into from
Jan 22, 2021
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
947506e
updated client for protection rules and recovery plans
Dec 3, 2020
22357e5
added files protection rules and recovery plan
Dec 3, 2020
9ee5a03
deleted dr runbook for rebase
Dec 3, 2020
972c87d
Merge branch 'v1.2.0-beta' into dr-runbook-2
Dec 3, 2020
7d8f17b
changed typemap to typelist
Dec 4, 2020
72f395c
chore: added testify for validate diff
Dec 4, 2020
600d828
test: added other validation diff and fixes the diff because of type …
Dec 4, 2020
ae558f9
fixes linter
Dec 4, 2020
d065440
fixes linter
Dec 4, 2020
8686891
refactor: refactorized to make it compatible
Dec 4, 2020
32d49ce
fixes linter error
Dec 4, 2020
711c2ca
added other parameters of doc for network mapping in schema
Dec 7, 2020
aacd551
docs: added docs for resource and datasource(s) of protection rule an…
Dec 7, 2020
49659ce
added other parameters of doc for network mapping in schema
Dec 7, 2020
d8fdf8a
refactor
Dec 10, 2020
2ae0bd7
deleted to make it easy for git merge
Dec 16, 2020
90e17b3
merged
Dec 16, 2020
affa47d
feat: added filterbyname for protection rules and recovery plans
Dec 16, 2020
9f21497
make fmt
Dec 16, 2020
bcdb38f
fixes linter
Dec 16, 2020
a9baf11
fix: added instatiates to avoid nil exception error
Dec 17, 2020
b7135e3
fix: added validation for any entity reference
Dec 17, 2020
00ca1ca
change schema for categories entity info list and added testacc for t…
Dec 18, 2020
0627647
deleted printing logs
Dec 18, 2020
e483f18
fix: changed to only optional for any reference of entity info list
Dec 22, 2020
e44050d
test: updated testacc so it can repeat same steps to see if it works …
Dec 22, 2020
7e0ee7a
fixes linter code
Dec 22, 2020
623113c
git merge
Jan 22, 2021
afb0809
test: complete testacc for protection rules and recovery plan with ne…
Jan 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: added instatiates to avoid nil exception error
  • Loading branch information
Edgar López committed Dec 17, 2020
commit a9baf117cc12a95e7d5bfd321a57a9d5d91ad929
42 changes: 27 additions & 15 deletions nutanix/resource_nutanix_recovery_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -941,18 +941,20 @@ func expandEntityInfoList(d []interface{}) []*v3.EntityInfoList {
for _, val := range d {
v := val.(map[string]interface{})
entity := &v3.EntityInfoList{}
reference := &v3.Reference{}
if v1, ok1 := v["any_entity_reference_kind"]; ok1 && v1.(string) != "" {
entity.AnyEntityReference.Kind = utils.StringPtr(v1.(string))
reference.Kind = utils.StringPtr(v1.(string))
}
if v1, ok1 := v["any_entity_reference_uuid"]; ok1 && v1.(string) != "" {
entity.AnyEntityReference.UUID = utils.StringPtr(v1.(string))
reference.UUID = utils.StringPtr(v1.(string))
}
if v1, ok1 := v["any_entity_reference_name"]; ok1 && v1.(string) != "" {
entity.AnyEntityReference.Name = utils.StringPtr(v1.(string))
reference.Name = utils.StringPtr(v1.(string))
}
if v1, ok1 := v["categories"]; ok1 {
entity.Categories = expandCategories(v1)
}
entity.AnyEntityReference = reference

entities = append(entities, entity)
}
Expand Down Expand Up @@ -1015,51 +1017,59 @@ func expandVMIPAssignmentList(d []interface{}) []*v3.VMIPAssignmentList {
v4 := v2.([]interface{})
for _, v6 := range v4 {
v7 := v6.(map[string]interface{})
ipConfig := &v3.FloatingIPConfig{}
if v5, ok1 := v7["ip"]; ok1 && v5.(string) != "" {
vmial.TestFloatingIPConfig.IP = v5.(string)
ipConfig.IP = v5.(string)
}
if v5, ok1 := v7["should_allocate_dynamically"]; ok1 {
vmial.TestFloatingIPConfig.ShouldAllocateDynamically = utils.BoolPtr(v5.(bool))
ipConfig.ShouldAllocateDynamically = utils.BoolPtr(v5.(bool))
}
vmial.TestFloatingIPConfig = ipConfig
}
}
if v2, ok1 := v1["recovery_floating_ip_config"]; ok1 {
v4 := v2.([]interface{})
for _, v6 := range v4 {
v7 := v6.(map[string]interface{})
ipConfig := &v3.FloatingIPConfig{}
if v5, ok1 := v7["ip"]; ok1 && v5.(string) != "" {
vmial.TestFloatingIPConfig.IP = v5.(string)
ipConfig.IP = v5.(string)
}
if v5, ok1 := v7["should_allocate_dynamically"]; ok1 {
vmial.TestFloatingIPConfig.ShouldAllocateDynamically = utils.BoolPtr(v5.(bool))
ipConfig.ShouldAllocateDynamically = utils.BoolPtr(v5.(bool))
}
vmial.RecoveryFloatingIPConfig = ipConfig
}
}
if v2, ok1 := v1["vm_reference"]; ok1 {
v6 := v2.([]interface{})
for _, v7 := range v6 {
v4 := v7.(map[string]interface{})
reference := &v3.Reference{}
if v5, ok1 := v4["name"]; ok1 && v5.(string) != "" {
vmial.VMReference.Name = utils.StringPtr(v5.(string))
reference.Name = utils.StringPtr(v5.(string))
}
if v5, ok1 := v4["uuid"]; ok1 && v5.(string) != "" {
vmial.VMReference.UUID = utils.StringPtr(v5.(string))
reference.UUID = utils.StringPtr(v5.(string))
}
if v5, ok1 := v4["kind"]; ok1 && v5.(string) != "" {
vmial.VMReference.Kind = utils.StringPtr(v5.(string))
reference.Kind = utils.StringPtr(v5.(string))
}
vmial.VMReference = reference
}
}
if v2, ok1 := v1["vm_nic_information"]; ok1 {
v6 := v2.([]interface{})
for _, v7 := range v6 {
v4 := v7.(map[string]interface{})
vmInfo := &v3.VMNICInformation{}
if v5, ok1 := v4["ip"]; ok1 && v5.(string) != "" {
vmial.VMNICInformation.IP = v5.(string)
vmInfo.IP = v5.(string)
}
if v5, ok1 := v4["uuid"]; ok1 && v5.(string) != "" {
vmial.VMNICInformation.UUID = v5.(string)
vmInfo.UUID = v5.(string)
}
vmial.VMNICInformation = vmInfo
}
}
assigns = append(assigns, vmial)
Expand Down Expand Up @@ -1130,15 +1140,17 @@ func expandIPAssignmentList(d []interface{}) []*v3.IPAssignmentList {
v6 := v2.([]interface{})
for _, v7 := range v6 {
v4 := v7.(map[string]interface{})
reference := &v3.Reference{}
if v5, ok1 := v4["name"]; ok1 && v5.(string) != "" {
vmial.VMReference.Name = utils.StringPtr(v5.(string))
reference.Name = utils.StringPtr(v5.(string))
}
if v5, ok1 := v4["uuid"]; ok1 && v5.(string) != "" {
vmial.VMReference.UUID = utils.StringPtr(v5.(string))
reference.UUID = utils.StringPtr(v5.(string))
}
if v5, ok1 := v4["kind"]; ok1 && v5.(string) != "" {
vmial.VMReference.Kind = utils.StringPtr(v5.(string))
reference.Kind = utils.StringPtr(v5.(string))
}
vmial.VMReference = reference
}
}
if v2, ok1 := v1["ip_config_list"]; ok1 {
Expand Down