Skip to content

Commit

Permalink
fix whitespace, use pm.Client directly rather than copying client first
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnps committed Feb 15, 2023
1 parent ffea4a5 commit e2a33dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion provider/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func (c *Config) Client() (interface{}, error) {
client = sigsci.NewTokenClient(c.Email, c.APIToken)
} else if c.Password != "" {
client, err = sigsci.NewClient(c.Email, c.Password)

if err != nil {
return nil, err
}
Expand Down
6 changes: 2 additions & 4 deletions provider/resource_edge_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ func resourceEdgeDeployment() *schema.Resource {

func createOrUpdateEdgeDeployment(d *schema.ResourceData, m interface{}) error {
pm := m.(providerMetadata)
sc := pm.Client

d.SetId(d.Get("site_short_name").(string))

return sc.CreateOrUpdateEdgeDeployment(pm.Corp, d.Get("site_short_name").(string))
return pm.Client.CreateOrUpdateEdgeDeployment(pm.Corp, d.Get("site_short_name").(string))
}

func readEdgeDeployment(d *schema.ResourceData, m interface{}) error {
Expand All @@ -36,7 +35,6 @@ func readEdgeDeployment(d *schema.ResourceData, m interface{}) error {

func deleteEdgeDeployment(d *schema.ResourceData, m interface{}) error {
pm := m.(providerMetadata)
sc := pm.Client

return sc.DeleteEdgeDeployment(pm.Corp, d.Get("site_short_name").(string))
return pm.Client.DeleteEdgeDeployment(pm.Corp, d.Get("site_short_name").(string))
}
9 changes: 3 additions & 6 deletions provider/resource_edge_deployment_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ func resourceEdgeDeploymentService() *schema.Resource {

func createOrUpdateEdgeDeploymentService(d *schema.ResourceData, m interface{}) error {
pm := m.(providerMetadata)
sc := pm.Client

d.SetId(d.Get("fastly_sid").(string))

return sc.CreateOrUpdateEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string))
return pm.Client.CreateOrUpdateEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string))
}

func readEdgeDeploymentService(d *schema.ResourceData, m interface{}) error {
Expand All @@ -42,14 +41,12 @@ func readEdgeDeploymentService(d *schema.ResourceData, m interface{}) error {

func updateEdgeDeploymentBackends(d *schema.ResourceData, m interface{}) error {
pm := m.(providerMetadata)
sc := pm.Client

return sc.CreateOrUpdateEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string))
return pm.Client.CreateOrUpdateEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string))
}

func detachEdgeDeploymentService(d *schema.ResourceData, m interface{}) error {
pm := m.(providerMetadata)
sc := pm.Client

return sc.DetachEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string))
return pm.Client.DetachEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string))
}

0 comments on commit e2a33dd

Please sign in to comment.