Skip to content

Commit

Permalink
Removed some duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
wrighbr committed Sep 25, 2020
1 parent 4d4ebea commit 1d0c7c6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 43 deletions.
20 changes: 10 additions & 10 deletions provider/resource_config_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func resourceConfigAuth() *schema.Resource {
},
Create: resourceConfigAuthCreate,
Read: resourceConfigAuthRead,
Update: resourceConfigAuthUpdate,
Update: resourceConfigAuthCreate,
Delete: resourceConfigAuthDelete,
}
}
Expand All @@ -69,17 +69,17 @@ func resourceConfigAuthRead(d *schema.ResourceData, m interface{}) error {
return nil
}

func resourceConfigAuthUpdate(d *schema.ResourceData, m interface{}) error {
apiClient := m.(*client.Client)
body := client.GetConfigAuth(d)
// func resourceConfigAuthUpdate(d *schema.ResourceData, m interface{}) error {
// apiClient := m.(*client.Client)
// body := client.GetConfigAuth(d)

_, _, err := apiClient.SendRequest("PUT", models.PathConfig, body, 200)
if err != nil {
return err
}
// _, _, err := apiClient.SendRequest("PUT", models.PathConfig, body, 200)
// if err != nil {
// return err
// }

return resourceConfigAuthRead(d, m)
}
// return resourceConfigAuthRead(d, m)
// }

func resourceConfigAuthDelete(d *schema.ResourceData, m interface{}) error {
return nil
Expand Down
20 changes: 10 additions & 10 deletions provider/resource_config_email.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func resourceConfigEmail() *schema.Resource {
},
Create: resourceConfigEmailCreate,
Read: resourceConfigEmailRead,
Update: resourceConfigEmailUpdate,
Update: resourceConfigEmailCreate,
Delete: resourceConfigEmailDelete,
}
}
Expand All @@ -65,18 +65,18 @@ func resourceConfigEmailRead(d *schema.ResourceData, m interface{}) error {
return nil
}

func resourceConfigEmailUpdate(d *schema.ResourceData, m interface{}) error {
apiClient := m.(*client.Client)
// func resourceConfigEmailUpdate(d *schema.ResourceData, m interface{}) error {
// apiClient := m.(*client.Client)

body := client.GetConfigEmail(d)
// body := client.GetConfigEmail(d)

_, _, err := apiClient.SendRequest("PUT", models.PathConfig, body, 200)
if err != nil {
return err
}
// _, _, err := apiClient.SendRequest("PUT", models.PathConfig, body, 200)
// if err != nil {
// return err
// }

return resourceConfigEmailRead(d, m)
}
// return resourceConfigEmailRead(d, m)
// }

func resourceConfigEmailDelete(d *schema.ResourceData, m interface{}) error {
return nil
Expand Down
20 changes: 10 additions & 10 deletions provider/resource_config_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func resourceConfigSystem() *schema.Resource {
},
Create: resourceConfigSystemCreate,
Read: resourceConfigSystemRead,
Update: resourceConfigSystemUpdate,
Update: resourceConfigSystemCreate,
Delete: resourceConfigSystemDelete,
}
}
Expand All @@ -50,18 +50,18 @@ func resourceConfigSystemRead(d *schema.ResourceData, m interface{}) error {
return nil
}

func resourceConfigSystemUpdate(d *schema.ResourceData, m interface{}) error {
apiClient := m.(*client.Client)
// func resourceConfigSystemUpdate(d *schema.ResourceData, m interface{}) error {
// apiClient := m.(*client.Client)

body := client.GetConfigSystem(d)
// body := client.GetConfigSystem(d)

_, _, err := apiClient.SendRequest("PUT", models.PathConfig, body, 200)
if err != nil {
return err
}
// _, _, err := apiClient.SendRequest("PUT", models.PathConfig, body, 200)
// if err != nil {
// return err
// }

return resourceConfigSystemRead(d, m)
}
// return resourceConfigSystemRead(d, m)
// }

func resourceConfigSystemDelete(d *schema.ResourceData, m interface{}) error {
return nil
Expand Down
26 changes: 13 additions & 13 deletions provider/resource_interrogation_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func resourceVuln() *schema.Resource {
},
Create: resourceVulnCreate,
Read: resourceVulnRead,
Update: resourceVulnUpdate,
Update: resourceVulnCreate,
Delete: resourceVulnDelete,
}
}
Expand All @@ -46,21 +46,21 @@ func resourceVulnRead(d *schema.ResourceData, m interface{}) error {
return nil
}

func resourceVulnUpdate(d *schema.ResourceData, m interface{}) error {
apiClient := m.(*client.Client)
// func resourceVulnUpdate(d *schema.ResourceData, m interface{}) error {
// apiClient := m.(*client.Client)

err := apiClient.SetScannerPolicy(d)
if err != nil {
return err
}
// err := apiClient.SetScannerPolicy(d)
// if err != nil {
// return err
// }

scanner := d.Get("default_scanner").(string)
if scanner != "" {
apiClient.SetDefaultScanner(scanner)
}
// scanner := d.Get("default_scanner").(string)
// if scanner != "" {
// apiClient.SetDefaultScanner(scanner)
// }

return resourceVulnRead(d, m)
}
// return resourceVulnRead(d, m)
// }

func resourceVulnDelete(d *schema.ResourceData, m interface{}) error {
apiClient := m.(*client.Client)
Expand Down

0 comments on commit 1d0c7c6

Please sign in to comment.