diff --git a/README.md b/README.md
index dc256d37..5ab17da6 100644
--- a/README.md
+++ b/README.md
@@ -555,6 +555,7 @@ The following parameters are supported. See Common Reference for a list of addit
* [list](#listorgs)
* [get](#getorg)
+* [setmart](#setmart)
### list
@@ -576,6 +577,20 @@ The following parameters are supported. See Common Reference for a list of addit
* `--org -o` (required) Apigee organization name
+### setmart
+
+Configure MART endpoint for an Apigee Org
+
+```
+apigeecli org get -o org -m http://endpoint
+```
+Parameters
+The following parameters are supported. See Common Reference for a list of additional parameters.
+
+* `--org -o` (required) Apigee organization name
+* `--mart -m` (required) MART endpoint
+* `--whitelist -w` (optional) Enable/disable whitelisting of GCP IP for source connections to MART
+
---
## products
diff --git a/cmd/org/setmart/setmart.go b/cmd/org/setmart/setmart.go
index a663d801..9a778807 100644
--- a/cmd/org/setmart/setmart.go
+++ b/cmd/org/setmart/setmart.go
@@ -14,9 +14,18 @@ var Cmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
u, _ := url.Parse(shared.BaseURL)
orgname := "\"name\":\"" + shared.RootArgs.Org + "\","
- martprop := "{\"name\":\"features.mart.server.endpoint\","
- martpropvalue := "\"value\":\"" + mart + "\"}"
- props := "\"properties\": {" + "\"property\": [" + martprop + martpropvalue + "]}"
+ hybridprop := "{\"name\" : \"features.hybrid.enabled\", \"value\" : \"true\"},"
+ martprop := "{\"name\":\"features.mart.server.endpoint\", \"value\":\"" + mart + "\"}"
+
+ props := "\"properties\": {" + "\"property\": [" + hybridprop + martprop
+
+ if whitelist {
+ whitelistprop := "{\"name\":\"features.mart.server.endpoint\", \"value\" : \"true\"}"
+ props = props + "," + whitelistprop
+ }
+
+ props = props + "]}"
+
payload := "{" + orgname + props + "}"
u.Path = path.Join(u.Path, shared.RootArgs.Org)
return shared.HttpClient(u.String(), payload)
@@ -24,6 +33,7 @@ var Cmd = &cobra.Command{
}
var mart string
+var whitelist bool
func init() {
@@ -31,6 +41,9 @@ func init() {
"", "Apigee organization name")
Cmd.Flags().StringVarP(&mart, "mart", "m",
"", "MART Endpoint")
+ Cmd.Flags().BoolVarP(&whitelist, "whitelist", "w",
+ false, "Whitelist GCP Source IP")
_ = Cmd.MarkFlagRequired("org")
+ _ = Cmd.MarkFlagRequired("mart")
}
diff --git a/main_test.go b/main_test.go
index 1b24bc64..673af248 100644
--- a/main_test.go
+++ b/main_test.go
@@ -46,6 +46,15 @@ func TestSetMart(t *testing.T) {
}
}
+func TestSetMartWhiteList(t *testing.T) {
+ mart := os.Getenv("MART")
+ cmd := exec.Command(apigeecli, "orgs", "setmart", "-o", org, "-m", mart, "-w", "false", "-t", token)
+ err := cmd.Run()
+ if err != nil {
+ t.Fatal(err)
+ }
+}
+
// env tests
func TestListEnvs(t *testing.T) {
cmd := exec.Command(apigeecli, "envs", "list", "-o", org, "-t", token)