-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from appoptics/chore/AO-11606/use-official-cli…
…ent-chad Bring in the new updates for the Client with related fixes
- Loading branch information
Showing
2,064 changed files
with
578,947 additions
and
106,656 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
# | ||
# [prune] | ||
# non-go = false | ||
# go-tests = true | ||
# unused-packages = true | ||
|
||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/akahn/go-librato" | ||
|
||
[[constraint]] | ||
name = "github.com/appoptics/appoptics-api-go" | ||
version = ">=0.3.0" | ||
|
||
[[constraint]] | ||
name = "github.com/hashicorp/terraform" | ||
version = "0.11.13" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,17 +16,17 @@ Requirements | |
Building The Provider | ||
--------------------- | ||
|
||
Clone repository to: `$GOPATH/src/github.com/terraform-providers/terraform-provider-librato` | ||
Clone repository to: `$GOPATH/src/github.com/terraform-providers/terraform-provider-appoptics` | ||
|
||
```sh | ||
$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers | ||
$ git clone [email protected]:terraform-providers/terraform-provider-librato | ||
$ git clone [email protected]:terraform-providers/terraform-provider-appoptics | ||
``` | ||
|
||
Enter the provider directory and build the provider | ||
|
||
```sh | ||
$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-librato | ||
$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-appoptics | ||
$ make build | ||
``` | ||
|
||
|
@@ -44,7 +44,7 @@ To compile the provider, run `make build`. This will build the provider and put | |
```sh | ||
$ make bin | ||
... | ||
$ $GOPATH/bin/terraform-provider-librato | ||
$ $GOPATH/bin/terraform-provider-appoptics | ||
... | ||
``` | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
librato/common_helpers_test.go → appoptics/common_helpers_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package librato | ||
package appoptics | ||
|
||
import ( | ||
"log" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package appoptics | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/appoptics/appoptics-api-go" | ||
"github.com/hashicorp/terraform/helper/schema" | ||
"github.com/hashicorp/terraform/terraform" | ||
) | ||
|
||
// Provider returns a schema.Provider for Librato. | ||
func Provider() terraform.ResourceProvider { | ||
return &schema.Provider{ | ||
Schema: map[string]*schema.Schema{ | ||
"token": &schema.Schema{ | ||
Type: schema.TypeString, | ||
Required: true, | ||
DefaultFunc: schema.EnvDefaultFunc("APPOPTICS_TOKEN", nil), | ||
Description: "The auth token for the AppOptics account.", | ||
}, | ||
}, | ||
|
||
ResourcesMap: map[string]*schema.Resource{ | ||
"appoptics_space": resourceAppOpticsSpace(), | ||
"appoptics_space_chart": resourceAppOpticsSpaceChart(), | ||
"appoptics_metric": resourceAppOpticsMetric(), | ||
"appoptics_alert": resourceAppOpticsAlert(), | ||
"appoptics_service": resourceAppOpticsService(), | ||
}, | ||
|
||
ConfigureFunc: providerConfigure, | ||
} | ||
} | ||
|
||
func providerConfigure(d *schema.ResourceData) (interface{}, error) { | ||
var url string | ||
if appOpticsURL := os.Getenv("APPOPTICS_URL"); appOpticsURL != "" { | ||
url = appOpticsURL | ||
} else { | ||
url = "https://api.appoptics.com/v1/" | ||
} | ||
|
||
client := appoptics.NewClient(d.Get("token").(string), appoptics.BaseURLClientOption(url)) | ||
return client, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package appoptics | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/schema" | ||
"github.com/hashicorp/terraform/terraform" | ||
) | ||
|
||
var testAccProviders map[string]terraform.ResourceProvider | ||
var testAccProvider *schema.Provider | ||
|
||
func init() { | ||
testAccProvider = Provider().(*schema.Provider) | ||
testAccProviders = map[string]terraform.ResourceProvider{ | ||
"appoptics": testAccProvider, | ||
} | ||
} | ||
|
||
func TestProvider(t *testing.T) { | ||
if err := Provider().(*schema.Provider).InternalValidate(); err != nil { | ||
t.Fatalf("err: %s", err) | ||
} | ||
} | ||
|
||
func TestProvider_impl(t *testing.T) { | ||
var _ terraform.ResourceProvider = Provider() | ||
} | ||
|
||
func testAccPreCheck(t *testing.T) { | ||
v, ok := os.LookupEnv("APPOPTICS_TOKEN") | ||
if !ok || v == "" { | ||
t.Fatal("APPOPTICS_TOKEN must be set for acceptance tests") | ||
} | ||
} |
Oops, something went wrong.