diff options
author | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:02 -0400 |
---|---|---|
committer | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:02 -0400 |
commit | dbde71c990295605ce351a494888c15f3d6be9a8 (patch) | |
tree | a9f40c179e44dbf635d439ae02d9e8126b1b2e2a /statuscake/provider.go | |
parent | 0e962b8ebd36cbb0e2f722a1859594b748713d65 (diff) | |
download | terraform-provider-statuscake-dbde71c990295605ce351a494888c15f3d6be9a8.tar.gz terraform-provider-statuscake-dbde71c990295605ce351a494888c15f3d6be9a8.tar.zst terraform-provider-statuscake-dbde71c990295605ce351a494888c15f3d6be9a8.zip |
Transfer statuscake provider
Diffstat (limited to 'statuscake/provider.go')
-rw-r--r-- | statuscake/provider.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/statuscake/provider.go b/statuscake/provider.go new file mode 100644 index 0000000..abca376 --- /dev/null +++ b/statuscake/provider.go | |||
@@ -0,0 +1,40 @@ | |||
1 | package statuscake | ||
2 | |||
3 | import ( | ||
4 | "github.com/DreamItGetIT/statuscake" | ||
5 | "github.com/hashicorp/terraform/helper/schema" | ||
6 | "github.com/hashicorp/terraform/terraform" | ||
7 | ) | ||
8 | |||
9 | func Provider() terraform.ResourceProvider { | ||
10 | return &schema.Provider{ | ||
11 | Schema: map[string]*schema.Schema{ | ||
12 | "username": &schema.Schema{ | ||
13 | Type: schema.TypeString, | ||
14 | Required: true, | ||
15 | DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_USERNAME", nil), | ||
16 | Description: "Username for StatusCake Account.", | ||
17 | }, | ||
18 | "apikey": &schema.Schema{ | ||
19 | Type: schema.TypeString, | ||
20 | Required: true, | ||
21 | DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_APIKEY", nil), | ||
22 | Description: "API Key for StatusCake", | ||
23 | }, | ||
24 | }, | ||
25 | |||
26 | ResourcesMap: map[string]*schema.Resource{ | ||
27 | "statuscake_test": resourceStatusCakeTest(), | ||
28 | }, | ||
29 | |||
30 | ConfigureFunc: providerConfigure, | ||
31 | } | ||
32 | } | ||
33 | |||
34 | func providerConfigure(d *schema.ResourceData) (interface{}, error) { | ||
35 | auth := statuscake.Auth{ | ||
36 | Username: d.Get("username").(string), | ||
37 | Apikey: d.Get("apikey").(string), | ||
38 | } | ||
39 | return statuscake.New(auth) | ||
40 | } | ||