Skip to content

Commit

Permalink
Merge pull request #18 from manifoldco/jelmer-go-manifold-integrations
Browse files Browse the repository at this point in the history
Use go-manifold integration package for integrations.
  • Loading branch information
jbowes authored Nov 20, 2017
2 parents 85baa9f + 8ba85fb commit ea8d6d8
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 139 deletions.
130 changes: 23 additions & 107 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

[[constraint]]
name = "github.com/manifoldco/go-manifold"
version = "0.8.5"
version = "v0.9.0"
6 changes: 3 additions & 3 deletions manifold/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package manifold

import (
manifold "github.com/manifoldco/go-manifold"
"github.com/manifoldco/kubernetes-credentials/helpers/client"
"github.com/manifoldco/go-manifold/integrations"
)

func newWrapper(team string, cfgs ...manifold.ConfigFunc) (*client.Client, error) {
func newWrapper(team string, cfgs ...manifold.ConfigFunc) (*integrations.Client, error) {
cl := manifold.New(cfgs...)
kube, err := client.New(cl, func(s string) *string { return &s }(team))
kube, err := integrations.NewClient(cl, func(s string) *string { return &s }(team))
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions manifold/data_source_manifold_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/hashicorp/terraform/helper/schema"

"github.com/manifoldco/kubernetes-credentials/helpers/client"
"github.com/manifoldco/go-manifold/integrations"
)

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

func dataSourceManifoldProjectRead(d *schema.ResourceData, meta interface{}) error {
cl := meta.(*client.Client)
cl := meta.(*integrations.Client)
ctx := context.Background()

projectLabel, projectID, err := getProjectInformation(cl, d.Get("project").(string), true)
Expand All @@ -79,14 +79,14 @@ func dataSourceManifoldProjectRead(d *schema.ResourceData, meta interface{}) err
}

resourceList := d.Get("resource").(*schema.Set).List()
filteredResources := resourceSpecsFromList(resourceList)
filteredResources := resourcesFromList(resourceList)

cv, err := cl.GetResourcesCredentialValues(ctx, projectLabel, filteredResources)
if err != nil {
return err
}

credMap, err := client.FlattenResourcesCredentialValues(cv)
credMap, err := integrations.FlattenResourcesCredentialValues(cv)
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions manifold/data_source_manifold_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/hashicorp/terraform/helper/schema"

"github.com/manifoldco/kubernetes-credentials/helpers/client"
"github.com/manifoldco/kubernetes-credentials/primitives"
"github.com/manifoldco/go-manifold/integrations"
"github.com/manifoldco/go-manifold/integrations/primitives"
)

func dataSourceManifoldResource() *schema.Resource {
Expand Down Expand Up @@ -62,17 +62,17 @@ func dataSourceManifoldResource() *schema.Resource {
}

func dataSourceManifoldResourceRead(d *schema.ResourceData, meta interface{}) error {
cl := meta.(*client.Client)
cl := meta.(*integrations.Client)
ctx := context.Background()

projectLabel, _, err := getProjectInformation(cl, d.Get("project").(string), false)
if err != nil {
return err
}

rs := &primitives.ResourceSpec{
rs := &primitives.Resource{
Name: d.Get("resource").(string),
Credentials: credentialSpecsFromList(d.Get("credential").(*schema.Set).List()),
Credentials: credentialsFromList(d.Get("credential").(*schema.Set).List()),
}
resource, err := cl.GetResource(ctx, projectLabel, rs)
if err != nil {
Expand All @@ -84,7 +84,7 @@ func dataSourceManifoldResourceRead(d *schema.ResourceData, meta interface{}) er
return err
}

credMap, err := client.FlattenResourceCredentialValues(cv)
credMap, err := integrations.FlattenResourceCredentialValues(cv)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit ea8d6d8

Please sign in to comment.