Skip to content

Commit

Permalink
Merge pull request zambien#11 from Ticketmaster/master
Browse files Browse the repository at this point in the history
Fix gofmt issues for build.
  • Loading branch information
zambien authored Apr 25, 2018
2 parents c948e41 + b17a937 commit 0540cd8
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 43 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.iml
.idea
terraform-provider-apigee*
terraform-provider-apigee*
vendor
18 changes: 12 additions & 6 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)

default: build

build: fmtcheck
go install
build: vendor fmtcheck
@rm -rf build/
@mkdir -p build/
CGO_ENABLED=0 go build -ldflags '-w -extldflags "-static"' -o build/terraform-provider-apigee

GLIDE := $(shell command -v glide 2> /dev/null)
ifndef GLIDE
$(error "glide is not available. Install using `curl https://glide.sh/get | sh`")
endif
vendor: glide.yaml ## Install vendor dependencies
glide update --no-recursive

test: fmtcheck
go test -i $(TEST) || exit 1
Expand Down Expand Up @@ -32,9 +41,6 @@ fmtcheck:
errcheck:
@sh -c "'$(CURDIR)/scripts/errcheck.sh'"

vendor-status:
@govendor status

test-compile:
@if [ "$(TEST)" = "./..." ]; then \
echo "ERROR: Set TEST to a specific package. For example,"; \
Expand All @@ -43,4 +49,4 @@ test-compile:
fi
go test -c $(TEST) $(TESTARGS)

.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile
.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile
8 changes: 4 additions & 4 deletions apigee/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ func Provider() terraform.ResourceProvider {
ResourcesMap: map[string]*schema.Resource{
"apigee_api_proxy": resourceApiProxy(),
"apigee_api_proxy_deployment": resourceApiProxyDeployment(),
"apigee_company": resourceCompany(),
"apigee_company_app": resourceCompanyApp(),
"apigee_developer": resourceDeveloper(),
"apigee_developer_app": resourceDeveloperApp(),
"apigee_company": resourceCompany(),
"apigee_company_app": resourceCompanyApp(),
"apigee_developer": resourceDeveloper(),
"apigee_developer_app": resourceDeveloperApp(),
"apigee_product": resourceProduct(),
"apigee_target_server": resourceTargetServer(),
},
Expand Down
2 changes: 1 addition & 1 deletion apigee/resource_api_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func resourceApiProxyCreate(d *schema.ResourceData, meta interface{}) error {

client := meta.(*apigee.EdgeClient)

u1 := uuid.NewV4()
u1, _ := uuid.NewV4()

proxyRev, _, err := client.Proxies.Import(d.Get("name").(string), d.Get("bundle").(string))

Expand Down
3 changes: 2 additions & 1 deletion apigee/resource_api_proxy_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ func resourceApiProxyDeploymentCreate(d *schema.ResourceData, meta interface{})
}
}

d.SetId(uuid.NewV4().String())
id, _ := uuid.NewV4()
d.SetId(id.String())
d.Set("revision", proxyDep.Revision.String())

return resourceApiProxyDeploymentRead(d, meta)
Expand Down
12 changes: 6 additions & 6 deletions apigee/resource_company.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func resourceCompanyCreate(d *schema.ResourceData, meta interface{}) error {

client := meta.(*apigee.EdgeClient)

u1 := uuid.NewV4()
u1, _ := uuid.NewV4()
d.SetId(u1.String())

CompanyData, err := setCompanyData(d)
Expand Down Expand Up @@ -157,12 +157,12 @@ func setCompanyData(d *schema.ResourceData) (apigee.Company, error) {
}

Company := apigee.Company{
Name: d.Get("name").(string),
DisplayName: d.Get("display_name").(string),
Attributes: attributes,
Name: d.Get("name").(string),
DisplayName: d.Get("display_name").(string),
Attributes: attributes,

Apps: apps,
Status: d.Get("status").(string),
Apps: apps,
Status: d.Get("status").(string),
}

return Company, nil
Expand Down
12 changes: 6 additions & 6 deletions apigee/resource_company_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func resourceCompanyAppCreate(d *schema.ResourceData, meta interface{}) error {

client := meta.(*apigee.EdgeClient)

u1 := uuid.NewV4()
u1, _ := uuid.NewV4()
d.SetId(u1.String())

CompanyAppData, err := setCompanyAppData(d)
Expand Down Expand Up @@ -178,11 +178,11 @@ func setCompanyAppData(d *schema.ResourceData) (apigee.CompanyApp, error) {
}

CompanyApp := apigee.CompanyApp{
Name: d.Get("name").(string),
Attributes: attributes,
ApiProducts: apiProducts,
Scopes: scopes,
CallbackUrl: d.Get("callback_url").(string),
Name: d.Get("name").(string),
Attributes: attributes,
ApiProducts: apiProducts,
Scopes: scopes,
CallbackUrl: d.Get("callback_url").(string),
}

return CompanyApp, nil
Expand Down
14 changes: 7 additions & 7 deletions apigee/resource_developer.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func resourceDeveloperCreate(d *schema.ResourceData, meta interface{}) error {

client := meta.(*apigee.EdgeClient)

u1 := uuid.NewV4()
u1, _ := uuid.NewV4()
d.SetId(u1.String())

DeveloperData, err := setDeveloperData(d)
Expand Down Expand Up @@ -162,12 +162,12 @@ func setDeveloperData(d *schema.ResourceData) (apigee.Developer, error) {
}

Developer := apigee.Developer{
Email: d.Get("email").(string),
FirstName: d.Get("first_name").(string),
LastName: d.Get("last_name").(string),
UserName: d.Get("user_name").(string),
Attributes: attributes,
Apps: apps,
Email: d.Get("email").(string),
FirstName: d.Get("first_name").(string),
LastName: d.Get("last_name").(string),
UserName: d.Get("user_name").(string),
Attributes: attributes,
Apps: apps,
}

return Developer, nil
Expand Down
14 changes: 7 additions & 7 deletions apigee/resource_developer_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func resourceDeveloperAppCreate(d *schema.ResourceData, meta interface{}) error

client := meta.(*apigee.EdgeClient)

u1 := uuid.NewV4()
u1, _ := uuid.NewV4()
d.SetId(u1.String())

DeveloperAppData, err := setDeveloperAppData(d)
Expand Down Expand Up @@ -186,12 +186,12 @@ func setDeveloperAppData(d *schema.ResourceData) (apigee.DeveloperApp, error) {
}

DeveloperApp := apigee.DeveloperApp{
Name: d.Get("name").(string),
Attributes: attributes,
ApiProducts: apiProducts,
KeyExpiresIn: d.Get("key_expires_in").(int),
Scopes: scopes,
CallbackUrl: d.Get("callback_url").(string),
Name: d.Get("name").(string),
Attributes: attributes,
ApiProducts: apiProducts,
KeyExpiresIn: d.Get("key_expires_in").(int),
Scopes: scopes,
CallbackUrl: d.Get("callback_url").(string),
}

return DeveloperApp, nil
Expand Down
2 changes: 1 addition & 1 deletion apigee/resource_developer_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"github.com/hashicorp/terraform/terraform"
"github.com/zambien/go-apigee-edge"
"log"
"regexp"
"strings"
"testing"
"regexp"
)

func TestAccDeveloperApp_Updated(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion apigee/resource_product.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func resourceProductCreate(d *schema.ResourceData, meta interface{}) error {

client := meta.(*apigee.EdgeClient)

u1 := uuid.NewV4()
u1, _ := uuid.NewV4()
d.SetId(u1.String())

ProductData, err := setProductData(d)
Expand Down
2 changes: 1 addition & 1 deletion apigee/resource_target_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func resourceTargetServerCreate(d *schema.ResourceData, meta interface{}) error

client := meta.(*apigee.EdgeClient)

u1 := uuid.NewV4()
u1, _ := uuid.NewV4()
d.SetId(u1.String())

targetServerData, err := setTargetServerData(d)
Expand Down
10 changes: 10 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package: github.com/zambien/terraform-provider-apigee
import:
- package: github.com/hashicorp/terraform
subpackages:
- helper/schema
- plugin
- terraform
- package: github.com/satori/go.uuid
- package: github.com/zambien/go-apigee-edge
- package: github.com/bgentry/go-netrc/netrc
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
"./apigee"
"github.com/hashicorp/terraform/plugin"
"github.com/hashicorp/terraform/terraform"
"github.com/zambien/terraform-provider-apigee/apigee"
)

func main() {
Expand Down

0 comments on commit 0540cd8

Please sign in to comment.