Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
TER-232: go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecat authored and Shr3ps committed Mar 5, 2018
1 parent 2321029 commit 41cdf01
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ func main() {
}

plugin.Serve(&p)
}
}
10 changes: 5 additions & 5 deletions provider/config.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package ghost

import (
"bitbucket.org/morea/go-st"
"log"
"bitbucket.org/morea/go-st"
)

// Config defines the configuration options for the Ghost client
type Config struct {
User string
Password string
URL string
User string
Password string
URL string
}

// Client returns a new PagerDuty client
Expand All @@ -19,4 +19,4 @@ func (c *Config) Client() (*ghost.Client, error) {
log.Printf("[INFO] Ghost client configured")

return client, nil
}
}
8 changes: 4 additions & 4 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ func Provider() terraform.ResourceProvider {
Required: true,
DefaultFunc: schema.EnvDefaultFunc("GHOST_USER", nil),
},
"password": {
"password": {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("GHOST_PASSWORD", nil),
},
"server_url": {
"server_url": {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("GHOST_SERVER_URL", nil),
},
},

ResourcesMap: map[string]*schema.Resource{
"ghost_app": resourceGhostApp(),
"ghost_app": resourceGhostApp(),
},

ConfigureFunc: providerConfigure,
Expand All @@ -40,4 +40,4 @@ func providerConfigure(data *schema.ResourceData) (interface{}, error) {
config := Config{User: data.Get("user").(string), Password: data.Get("password").(string), URL: data.Get("server_url").(string)}
log.Println("[INFO] Initializing Ghost client")
return config.Client()
}
}
42 changes: 21 additions & 21 deletions provider/resource_ghost_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,39 @@ func resourceGhostApp() *schema.Resource {
}

func resourceGhostAppCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ghost.Client)
log.Printf("[INFO] Creating Ghost app %s", d.Get("name").(string))
d.SetId(app.ID)
return nil
client := meta.(*ghost.Client)
log.Printf("[INFO] Creating Ghost app %s", d.Get("name").(string))

d.SetId(app.ID)
return nil
}

func resourceGhostAppRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ghost.Client)
log.Printf("[INFO] Reading Ghost app %s", d.Get("name").(string))
// TODO retrieve Ghost App with d.Id()
d.Set("name", app.Name)
return nil
client := meta.(*ghost.Client)
log.Printf("[INFO] Reading Ghost app %s", d.Get("name").(string))
// TODO retrieve Ghost App with d.Id()
d.Set("name", app.Name)

return nil
}

func resourceGhostAppUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ghost.Client)
log.Printf("[INFO] Updating Ghost app %s", d.Get("name").(string))
return nil
client := meta.(*ghost.Client)
log.Printf("[INFO] Updating Ghost app %s", d.Get("name").(string))
return nil
}

func resourceGhostAppDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ghost.Client)
log.Printf("[INFO] Deleting Ghost app %s", d.Get("name").(string))
d.SetId("")
return nil
client := meta.(*ghost.Client)
log.Printf("[INFO] Deleting Ghost app %s", d.Get("name").(string))
d.SetId("")
return nil
}

func resourceGhostAppImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
log.Printf("[INFO] Importing Ghost app %s", d.Get("name").(string))
if err := resourceGhostAppRead(d, meta); err != nil {
log.Printf("[INFO] Importing Ghost app %s", d.Get("name").(string))
if err := resourceGhostAppRead(d, meta); err != nil {
return nil, err
}
return []*schema.ResourceData{d}, nil
}
}
1 change: 1 addition & 0 deletions provider/resource_ghost_app_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package ghost

0 comments on commit 41cdf01

Please sign in to comment.