Skip to content

Commit

Permalink
Fork go-sentry into this repo (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
fa93hws authored Nov 7, 2019
1 parent 9c68449 commit dd675bb
Show file tree
Hide file tree
Showing 28 changed files with 2,840 additions and 67 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/fa93hws/terraform-provider-sentry
module github.com/Canva/terraform-provider-sentry

require (
cloud.google.com/go/storage v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.25.0 // indirect
github.com/fa93hws/go-sentry v1.4.0
github.com/dghubble/sling v1.1.0
github.com/go-test/deep v1.0.4 // indirect
github.com/google/go-cmp v0.3.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
Expand All @@ -19,7 +19,7 @@ require (
github.com/mattn/go-isatty v0.0.9 // indirect
github.com/mitchellh/reflectwalk v1.0.1 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/stretchr/testify v1.4.0 // indirect
github.com/stretchr/testify v1.4.0
github.com/ulikunitz/xz v0.5.6 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/zclconf/go-cty v1.1.0 // indirect
Expand All @@ -39,4 +39,4 @@ require (

replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999 // indirect

go 1.13
go 1.12.5
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ github.com/dnaeon/go-vcr v0.0.0-20180920040454-5637cf3d8a31/go.mod h1:aBB1+wY4s9
github.com/dylanmei/iso8601 v0.1.0 h1:812NGQDBcqquTfH5Yeo7lwR0nzx/cKdsmf3qMjPURUI=
github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ=
github.com/dylanmei/winrmtest v0.0.0-20190225150635-99b7fe2fddf1/go.mod h1:lcy9/2gH1jn/VCLouHA6tOEwLoNVd4GW6zhuKLmHC2Y=
github.com/fa93hws/go-sentry v1.2.1-0.20191107034951-543bee31b10f h1:cxtfPVEgk0VgTssC0z7UqDnX2T1oX65jva2i4ILeTY4=
github.com/fa93hws/go-sentry v1.2.1-0.20191107034951-543bee31b10f/go.mod h1:IA473QCwZPQ+WXUXVMI1x3bPbaCFE7g9WQzAFA/MtFk=
github.com/fa93hws/go-sentry v1.3.0 h1:4R+jZLumhXdcL4eSNOrmvDQQb+TWh5dxplKXKNkPP1w=
github.com/fa93hws/go-sentry v1.3.0/go.mod h1:IA473QCwZPQ+WXUXVMI1x3bPbaCFE7g9WQzAFA/MtFk=
github.com/fa93hws/go-sentry v1.4.0 h1:yx3HlZ8oJXqIJna/TO8W5HypzMvFTehI7HuB6j1n/rE=
github.com/fa93hws/go-sentry v1.4.0/go.mod h1:IA473QCwZPQ+WXUXVMI1x3bPbaCFE7g9WQzAFA/MtFk=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/fa93hws/terraform-provider-sentry/sentry"
"github.com/Canva/terraform-provider-sentry/sentry"
"github.com/hashicorp/terraform/plugin"
)

Expand Down
4 changes: 2 additions & 2 deletions sentry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"net/url"

"github.com/fa93hws/go-sentry/sentry"
"github.com/Canva/terraform-provider-sentry/sentryclient"
)

// Config is the configuration structure used to instantiate the Sentry
Expand All @@ -26,7 +26,7 @@ func (c *Config) Client() (interface{}, error) {
}

log.Printf("[INFO] Instantiating Sentry client...")
cl := sentry.NewClient(nil, baseURL, c.Token)
cl := sentryclient.NewClient(nil, baseURL, c.Token)

return cl, nil
}
6 changes: 3 additions & 3 deletions sentry/data_source_sentry_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"log"

"github.com/Canva/terraform-provider-sentry/sentryclient"
"github.com/hashicorp/terraform/helper/schema"
"github.com/fa93hws/go-sentry/sentry"
)

func dataSourceSentryKey() *schema.Resource {
Expand Down Expand Up @@ -78,7 +78,7 @@ func dataSourceSentryKey() *schema.Resource {
}

func dataSourceSentryKeyRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

org := d.Get("organization").(string)
project := d.Get("project").(string)
Expand Down Expand Up @@ -114,7 +114,7 @@ func dataSourceSentryKeyRead(d *schema.ResourceData, meta interface{}) error {
len(keys))
}

func sentryKeyAttributes(d *schema.ResourceData, key *sentry.ProjectKey) error {
func sentryKeyAttributes(d *schema.ResourceData, key *sentryclient.ProjectKey) error {
d.SetId(key.ID)
d.Set("name", key.Name)
d.Set("public", key.Public)
Expand Down
14 changes: 7 additions & 7 deletions sentry/resource_sentry_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package sentry
import (
"net/http"

"github.com/Canva/terraform-provider-sentry/sentryclient"
"github.com/hashicorp/terraform/helper/schema"
"github.com/fa93hws/go-sentry/sentry"
)

func resourceSentryKey() *schema.Resource {
Expand Down Expand Up @@ -74,11 +74,11 @@ func resourceSentryKey() *schema.Resource {
}

func resourceSentryKeyCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

org := d.Get("organization").(string)
project := d.Get("project").(string)
params := &sentry.CreateProjectKeyParams{
params := &sentryclient.CreateProjectKeyParams{
Name: d.Get("name").(string),
}

Expand All @@ -92,7 +92,7 @@ func resourceSentryKeyCreate(d *schema.ResourceData, meta interface{}) error {
}

func resourceSentryKeyRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

id := d.Id()
org := d.Get("organization").(string)
Expand Down Expand Up @@ -140,12 +140,12 @@ func resourceSentryKeyRead(d *schema.ResourceData, meta interface{}) error {
}

func resourceSentryKeyUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

id := d.Id()
org := d.Get("organization").(string)
project := d.Get("project").(string)
params := &sentry.UpdateProjectKeyParams{
params := &sentryclient.UpdateProjectKeyParams{
Name: d.Get("name").(string),
}

Expand All @@ -159,7 +159,7 @@ func resourceSentryKeyUpdate(d *schema.ResourceData, meta interface{}) error {
}

func resourceSentryKeyDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

id := d.Id()
org := d.Get("organization").(string)
Expand Down
10 changes: 5 additions & 5 deletions sentry/resource_sentry_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"fmt"
"testing"

"github.com/Canva/terraform-provider-sentry/sentryclient"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/fa93hws/go-sentry/sentry"
)

func TestAccSentryKey_basic(t *testing.T) {
var key sentry.ProjectKey
var key sentryclient.ProjectKey

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down Expand Up @@ -47,7 +47,7 @@ func TestAccSentryKey_basic(t *testing.T) {
}

func testAccCheckSentryKeyDestroy(s *terraform.State) error {
client := testAccProvider.Meta().(*sentry.Client)
client := testAccProvider.Meta().(*sentryclient.Client)

for _, rs := range s.RootModule().Resources {
if rs.Type != "sentry_key" {
Expand All @@ -73,7 +73,7 @@ func testAccCheckSentryKeyDestroy(s *terraform.State) error {
return nil
}

func testAccCheckSentryKeyExists(n string, projectKey *sentry.ProjectKey) resource.TestCheckFunc {
func testAccCheckSentryKeyExists(n string, projectKey *sentryclient.ProjectKey) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
Expand All @@ -84,7 +84,7 @@ func testAccCheckSentryKeyExists(n string, projectKey *sentry.ProjectKey) resour
return errors.New("No key ID is set")
}

client := testAccProvider.Meta().(*sentry.Client)
client := testAccProvider.Meta().(*sentryclient.Client)
keys, _, err := client.ProjectKeys.List(
rs.Primary.Attributes["organization"],
rs.Primary.Attributes["project"],
Expand Down
16 changes: 8 additions & 8 deletions sentry/resource_sentry_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package sentry
import (
"log"

"github.com/Canva/terraform-provider-sentry/sentryclient"
"github.com/hashicorp/terraform/helper/schema"
"github.com/fa93hws/go-sentry/sentry"
)

func resourceSentryOrganization() *schema.Resource {
Expand Down Expand Up @@ -39,12 +39,12 @@ func resourceSentryOrganization() *schema.Resource {
}

func resourceSentryOrganizationCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

params := &sentry.CreateOrganizationParams{
params := &sentryclient.CreateOrganizationParams{
Name: d.Get("name").(string),
Slug: d.Get("slug").(string),
AgreeTerms: sentry.Bool(d.Get("agree_terms").(bool)),
AgreeTerms: sentryclient.Bool(d.Get("agree_terms").(bool)),
}
log.Printf("[DEBUG] Creating Sentry organization %s", params.Name)

Expand All @@ -58,7 +58,7 @@ func resourceSentryOrganizationCreate(d *schema.ResourceData, meta interface{})
}

func resourceSentryOrganizationRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

slug := d.Id()
log.Printf("[DEBUG] Reading Sentry organization %s", slug)
Expand All @@ -77,11 +77,11 @@ func resourceSentryOrganizationRead(d *schema.ResourceData, meta interface{}) er
}

func resourceSentryOrganizationUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

slug := d.Id()
log.Printf("[DEBUG] Updating Sentry organization %s", slug)
params := &sentry.UpdateOrganizationParams{
params := &sentryclient.UpdateOrganizationParams{
Name: d.Get("name").(string),
Slug: d.Get("slug").(string),
}
Expand All @@ -96,7 +96,7 @@ func resourceSentryOrganizationUpdate(d *schema.ResourceData, meta interface{})
}

func resourceSentryOrganizationDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

slug := d.Id()
log.Printf("[DEBUG] Deleting Sentry organization %s", slug)
Expand Down
14 changes: 7 additions & 7 deletions sentry/resource_sentry_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"strings"

"github.com/fa93hws/go-sentry/sentry"
"github.com/Canva/terraform-provider-sentry/sentryclient"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down Expand Up @@ -99,11 +99,11 @@ func resourceSentryProject() *schema.Resource {
}

func resourceSentryProjectCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

org := d.Get("organization").(string)
team := d.Get("team").(string)
params := &sentry.CreateProjectParams{
params := &sentryclient.CreateProjectParams{
Name: d.Get("name").(string),
Slug: d.Get("slug").(string),
Platform: d.Get("platform").(string),
Expand All @@ -119,7 +119,7 @@ func resourceSentryProjectCreate(d *schema.ResourceData, meta interface{}) error
}

func resourceSentryProjectRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

slug := d.Id()
org := d.Get("organization").(string)
Expand Down Expand Up @@ -151,11 +151,11 @@ func resourceSentryProjectRead(d *schema.ResourceData, meta interface{}) error {
}

func resourceSentryProjectUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

slug := d.Id()
org := d.Get("organization").(string)
params := &sentry.UpdateProjectParams{
params := &sentryclient.UpdateProjectParams{
Name: d.Get("name").(string),
Slug: d.Get("slug").(string),
}
Expand Down Expand Up @@ -191,7 +191,7 @@ func resourceSentryProjectUpdate(d *schema.ResourceData, meta interface{}) error
}

func resourceSentryProjectDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

slug := d.Id()
org := d.Get("organization").(string)
Expand Down
10 changes: 5 additions & 5 deletions sentry/resource_sentry_project_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package sentry
import (
"log"

"github.com/Canva/terraform-provider-sentry/sentryclient"
"github.com/hashicorp/terraform/helper/schema"
"github.com/fa93hws/go-sentry/sentry"
)

func resourceSentryPlugin() *schema.Resource {
Expand Down Expand Up @@ -43,7 +43,7 @@ func resourceSentryPlugin() *schema.Resource {
}

func resourceSentryPluginCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

plugin := d.Get("plugin").(string)
org := d.Get("organization").(string)
Expand All @@ -66,7 +66,7 @@ func resourceSentryPluginCreate(d *schema.ResourceData, meta interface{}) error
}

func resourceSentryPluginRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

id := d.Id()
org := d.Get("organization").(string)
Expand Down Expand Up @@ -98,7 +98,7 @@ func resourceSentryPluginRead(d *schema.ResourceData, meta interface{}) error {
}

func resourceSentryPluginUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

id := d.Id()
org := d.Get("organization").(string)
Expand All @@ -113,7 +113,7 @@ func resourceSentryPluginUpdate(d *schema.ResourceData, meta interface{}) error
}

func resourceSentryPluginDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*sentry.Client)
client := meta.(*sentryclient.Client)

id := d.Id()
org := d.Get("organization").(string)
Expand Down
Loading

0 comments on commit dd675bb

Please sign in to comment.