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
Show file tree
Hide file tree
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
fixes linter
  • Loading branch information
Edgar López committed Dec 16, 2020
commit bcdb38ff3f767af29d1d83d78a13a1a9aac601d2
7 changes: 6 additions & 1 deletion nutanix/data_source_protection_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,13 @@ func dataSourceNutanixProtectionRules() *schema.Resource {
func dataSourceNutanixProtectionRulesRead(d *schema.ResourceData, meta interface{}) error {
// Get client connection
conn := meta.(*Client).API
req := &v3.DSMetadata{}

resp, err := conn.V3.ListAllProtectionRules()
metadata, filtersOk := d.GetOk("metadata")
if filtersOk {
req = buildDataSourceListMetadata(metadata.(*schema.Set))
}
resp, err := conn.V3.ListProtectionRules(req)
if err != nil {
return err
}
Expand Down
8 changes: 7 additions & 1 deletion nutanix/data_source_recovery_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,13 @@ func dataSourceNutanixRecoveryPlansRead(d *schema.ResourceData, meta interface{}
// Get client connection
conn := meta.(*Client).API

resp, err := conn.V3.ListAllRecoveryPlans()
req := &v3.DSMetadata{}

metadata, filtersOk := d.GetOk("metadata")
if filtersOk {
req = buildDataSourceListMetadata(metadata.(*schema.Set))
}
resp, err := conn.V3.ListRecoveryPlans(req)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion nutanix/resource_nutanix_protection_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,8 @@ func resourceNutanixProtectionRuleDelete(d *schema.ResourceData, meta interface{
func resourceNutanixProtectionRulesExists(conn *v3.Client, name string) (*string, error) {
var uuid *string

protectionList, err := conn.V3.ListAllProtectionRules()
filter := fmt.Sprintf("name==%s", name)
protectionList, err := conn.V3.ListAllProtectionRules(filter)

if err != nil {
return nil, err
Expand Down
3 changes: 2 additions & 1 deletion nutanix/resource_nutanix_recovery_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,8 @@ func resourceNutanixRecoveryPlanDelete(d *schema.ResourceData, meta interface{})
func resourceNutanixRecoveryPlanExists(conn *v3.Client, name string) (*string, error) {
var uuid *string

protectionList, err := conn.V3.ListAllRecoveryPlans()
filter := fmt.Sprintf("name==%s", name)
protectionList, err := conn.V3.ListAllRecoveryPlans(filter)

if err != nil {
return nil, err
Expand Down