Skip to content

Commit

Permalink
BC-13824: Add deployment property to connector spec (#177)
Browse files Browse the repository at this point in the history
* feat: Added new fields to connector

* updated the description of platform and method

---------

Co-authored-by: Suhaan-Bhandary <suhaanbhandary1@gmail.com>
  • Loading branch information
Suhaan-Bhandary-Josh and Suhaan-Bhandary authored Jul 18, 2024
1 parent 789fb83 commit 934649c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
14 changes: 14 additions & 0 deletions banyan/resource_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ func resourceConnector() *schema.Resource {
Type: schema.TypeString,
},
},
"platform": {
Type: schema.TypeString,
Optional: true,
Description: "The platform from which the satellite is deployed.",
},
"method": {
Type: schema.TypeString,
Optional: true,
Description: "The method used for the deployment of the satellite.",
},
},
}
}
Expand Down Expand Up @@ -96,6 +106,10 @@ func connectorFromState(d *schema.ResourceData) (info satellite.Info) {
},
CIDRs: convertSchemaSetToStringSlice(d.Get("cidrs").(*schema.Set)),
Domains: convertSchemaSetToStringSlice(d.Get("domains").(*schema.Set)),
Deployment: &satellite.Deployment{
Platform: d.Get("platform").(string),
Method: d.Get("method").(string),
},
},
}
return spec
Expand Down
6 changes: 6 additions & 0 deletions client/satellite/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ type Spec struct {
PeerAccessTiers []PeerAccessTier `json:"peer_access_tiers"`
DisableSnat bool `json:"disable_snat"`
Domains []string `json:"domains,omitempty"`
Deployment *Deployment `json:"deployment,omitempty"`
}

type Deployment struct {
Platform string `json:"platform"` // Windows, Linux, sonicOS, other
Method string `json:"method"` // app, tar, docker, firmware, terraform, other
}

type PeerAccessTier struct {
Expand Down
7 changes: 6 additions & 1 deletion client/satellite/satellite_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package satellite_test

import (
"testing"

"github.com/banyansecurity/terraform-banyan-provider/client/satellite"
"github.com/banyansecurity/terraform-banyan-provider/client/testutil"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"testing"
)

func Test_CreatSatellite(t *testing.T) {
Expand All @@ -29,6 +30,10 @@ func Test_CreatSatellite(t *testing.T) {
AccessTiers: []string{"us-west1"},
},
},
Deployment: &satellite.Deployment{
Platform: "Linux",
Method: "docker",
},
},
}
got, err := client.Satellite.Create(testSatellite)
Expand Down

0 comments on commit 934649c

Please sign in to comment.