From 5dcf2c9181371a099a128ca82aa87c0e710a7a23 Mon Sep 17 00:00:00 2001 From: George Nikolopoulos Date: Thu, 18 Jun 2020 17:58:14 +0300 Subject: [PATCH 1/3] Add resouce policyexpression with examples Signed-off-by: George Nikolopoulos --- citrixadc/provider.go | 1 + .../resource_citrixadc_policyexpression.go | 155 ++++++++++++++ ...esource_citrixadc_policyexpression_test.go | 190 ++++++++++++++++++ examples/policyexpression/provider.tf | 3 + examples/policyexpression/resources.tf | 11 + 5 files changed, 360 insertions(+) create mode 100644 citrixadc/resource_citrixadc_policyexpression.go create mode 100644 citrixadc/resource_citrixadc_policyexpression_test.go create mode 100644 examples/policyexpression/provider.tf create mode 100644 examples/policyexpression/resources.tf diff --git a/citrixadc/provider.go b/citrixadc/provider.go index 1d4c584d1..a2bc2714c 100644 --- a/citrixadc/provider.go +++ b/citrixadc/provider.go @@ -133,6 +133,7 @@ func providerResources() map[string]*schema.Resource { "citrixadc_pinger": resourceCitrixAdcPinger(), "citrixadc_nsrpcnode": resourceCitrixAdcNsrpcnode(), "citrixadc_routerdynamicrouting": resourceCitrixAdcRouterdynamicrouting(), + "citrixadc_policyexpression": resourceCitrixAdcPolicyexpression(), } } diff --git a/citrixadc/resource_citrixadc_policyexpression.go b/citrixadc/resource_citrixadc_policyexpression.go new file mode 100644 index 000000000..1837a3d82 --- /dev/null +++ b/citrixadc/resource_citrixadc_policyexpression.go @@ -0,0 +1,155 @@ +package citrixadc + +import ( + "github.com/chiradeep/go-nitro/config/policy" + + "github.com/chiradeep/go-nitro/netscaler" + "github.com/hashicorp/terraform/helper/schema" + + "fmt" + "log" +) + +func resourceCitrixAdcPolicyexpression() *schema.Resource { + return &schema.Resource{ + SchemaVersion: 1, + Create: createPolicyexpressionFunc, + Read: readPolicyexpressionFunc, + Update: updatePolicyexpressionFunc, + Delete: deletePolicyexpressionFunc, + Schema: map[string]*schema.Schema{ + "clientsecuritymessage": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "comment": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + } +} + +func createPolicyexpressionFunc(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] citrixadc-provider: In createPolicyexpressionFunc") + client := meta.(*NetScalerNitroClient).client + policyexpressionName := d.Get("name").(string) + policyexpression := policy.Policyexpression{ + Clientsecuritymessage: d.Get("clientsecuritymessage").(string), + Comment: d.Get("comment").(string), + Description: d.Get("description").(string), + Name: d.Get("name").(string), + Value: d.Get("value").(string), + } + + _, err := client.AddResource(netscaler.Policyexpression.Type(), policyexpressionName, &policyexpression) + if err != nil { + return err + } + + d.SetId(policyexpressionName) + + err = readPolicyexpressionFunc(d, meta) + if err != nil { + log.Printf("[ERROR] netscaler-provider: ?? we just created this policyexpression but we can't read it ?? %s", policyexpressionName) + return nil + } + return nil +} + +func readPolicyexpressionFunc(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] citrixadc-provider: In readPolicyexpressionFunc") + client := meta.(*NetScalerNitroClient).client + policyexpressionName := d.Id() + log.Printf("[DEBUG] citrixadc-provider: Reading policyexpression state %s", policyexpressionName) + data, err := client.FindResource(netscaler.Policyexpression.Type(), policyexpressionName) + if err != nil { + log.Printf("[WARN] citrixadc-provider: Clearing policyexpression state %s", policyexpressionName) + d.SetId("") + return nil + } + d.Set("name", data["name"]) + d.Set("clientsecuritymessage", data["clientsecuritymessage"]) + d.Set("comment", data["comment"]) + d.Set("description", data["description"]) + d.Set("name", data["name"]) + d.Set("value", data["value"]) + + return nil + +} + +func updatePolicyexpressionFunc(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] citrixadc-provider: In updatePolicyexpressionFunc") + client := meta.(*NetScalerNitroClient).client + policyexpressionName := d.Get("name").(string) + + policyexpression := policy.Policyexpression{ + Name: d.Get("name").(string), + } + hasChange := false + if d.HasChange("clientsecuritymessage") { + log.Printf("[DEBUG] citrixadc-provider: Clientsecuritymessage has changed for policyexpression %s, starting update", policyexpressionName) + policyexpression.Clientsecuritymessage = d.Get("clientsecuritymessage").(string) + hasChange = true + } + if d.HasChange("comment") { + log.Printf("[DEBUG] citrixadc-provider: Comment has changed for policyexpression %s, starting update", policyexpressionName) + policyexpression.Comment = d.Get("comment").(string) + hasChange = true + } + if d.HasChange("description") { + log.Printf("[DEBUG] citrixadc-provider: Description has changed for policyexpression %s, starting update", policyexpressionName) + policyexpression.Description = d.Get("description").(string) + hasChange = true + } + if d.HasChange("name") { + log.Printf("[DEBUG] citrixadc-provider: Name has changed for policyexpression %s, starting update", policyexpressionName) + policyexpression.Name = d.Get("name").(string) + hasChange = true + } + if d.HasChange("value") { + log.Printf("[DEBUG] citrixadc-provider: Value has changed for policyexpression %s, starting update", policyexpressionName) + policyexpression.Value = d.Get("value").(string) + hasChange = true + } + + if hasChange { + _, err := client.UpdateResource(netscaler.Policyexpression.Type(), policyexpressionName, &policyexpression) + if err != nil { + return fmt.Errorf("Error updating policyexpression %s: %s", policyexpressionName, err.Error()) + } + } + return readPolicyexpressionFunc(d, meta) +} + +func deletePolicyexpressionFunc(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] citrixadc-provider: In deletePolicyexpressionFunc") + client := meta.(*NetScalerNitroClient).client + policyexpressionName := d.Id() + err := client.DeleteResource(netscaler.Policyexpression.Type(), policyexpressionName) + if err != nil { + return err + } + + d.SetId("") + + return nil +} diff --git a/citrixadc/resource_citrixadc_policyexpression_test.go b/citrixadc/resource_citrixadc_policyexpression_test.go new file mode 100644 index 000000000..b98a44b07 --- /dev/null +++ b/citrixadc/resource_citrixadc_policyexpression_test.go @@ -0,0 +1,190 @@ +/* +Copyright 2016 Citrix Systems, Inc + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package citrixadc + +import ( + "fmt" + "github.com/chiradeep/go-nitro/netscaler" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" + "testing" +) + +func TestAccPolicyexpression_advanced(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckPolicyexpressionDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccPolicyexpression_advanced_step1, + Check: resource.ComposeTestCheckFunc( + testAccCheckPolicyexpressionExist("citrixadc_policyexpression.tf_advanced_policyexpression", nil), + ), + }, + resource.TestStep{ + Config: testAccPolicyexpression_advanced_step2, + Check: resource.ComposeTestCheckFunc( + testAccCheckPolicyexpressionExist("citrixadc_policyexpression.tf_advanced_policyexpression", nil), + ), + }, + resource.TestStep{ + Config: testAccPolicyexpression_advanced_step3, + Check: resource.ComposeTestCheckFunc( + testAccCheckPolicyexpressionExist("citrixadc_policyexpression.tf_advanced_policyexpression", nil), + ), + }, + }, + }) +} + +func TestAccPolicyexpression_classic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckPolicyexpressionDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccPolicyexpression_classic_step1, + Check: resource.ComposeTestCheckFunc( + testAccCheckPolicyexpressionExist("citrixadc_policyexpression.tf_classic_policyexpression", nil), + ), + }, + resource.TestStep{ + Config: testAccPolicyexpression_classic_step2, + Check: resource.ComposeTestCheckFunc( + testAccCheckPolicyexpressionExist("citrixadc_policyexpression.tf_classic_policyexpression", nil), + ), + }, + resource.TestStep{ + Config: testAccPolicyexpression_classic_step3, + Check: resource.ComposeTestCheckFunc( + testAccCheckPolicyexpressionExist("citrixadc_policyexpression.tf_classic_policyexpression", nil), + ), + }, + }, + }) +} + +func testAccCheckPolicyexpressionExist(n string, id *string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No lb vserver name is set") + } + + if id != nil { + if *id != "" && *id != rs.Primary.ID { + return fmt.Errorf("Resource ID has changed!") + } + + *id = rs.Primary.ID + } + + nsClient := testAccProvider.Meta().(*NetScalerNitroClient).client + data, err := nsClient.FindResource(netscaler.Policyexpression.Type(), rs.Primary.ID) + + if err != nil { + return err + } + + if data == nil { + return fmt.Errorf("LB vserver %s not found", n) + } + + return nil + } +} + +func testAccCheckPolicyexpressionDestroy(s *terraform.State) error { + nsClient := testAccProvider.Meta().(*NetScalerNitroClient).client + + for _, rs := range s.RootModule().Resources { + if rs.Type != "citrixadc_policyexpression" { + continue + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No name is set") + } + + _, err := nsClient.FindResource(netscaler.Policyexpression.Type(), rs.Primary.ID) + if err == nil { + return fmt.Errorf("LB vserver %s still exists", rs.Primary.ID) + } + + } + + return nil +} + +const testAccPolicyexpression_advanced_step1 = ` + +resource "citrixadc_policyexpression" "tf_advanced_policyexpression" { + name = "tf_advanced_policyexrpession" + value = "HTTP.REQ.URL.SUFFIX.EQ(\"cgi\")" + comment = "comment" +} +` + +const testAccPolicyexpression_advanced_step2 = ` + +resource "citrixadc_policyexpression" "tf_advanced_policyexpression" { + name = "tf_advanced_policyexrpession" + value = "HTTP.REQ.URL.SUFFIX.EQ(\"cginew\")" + comment = "comment" +} +` + +const testAccPolicyexpression_advanced_step3 = ` + +resource "citrixadc_policyexpression" "tf_advanced_policyexpression" { + name = "tf_advanced_policyexrpession_new" + value = "HTTP.REQ.URL.SUFFIX.EQ(\"cginew\")" + comment = "comment" +} +` + +const testAccPolicyexpression_classic_step1 = ` + +resource "citrixadc_policyexpression" "tf_classic_policyexpression" { + name = "tf_classic_policyexrpession" + value = "HEADER Cookie EXISTS" + clientsecuritymessage = "security message" +} +` + +const testAccPolicyexpression_classic_step2 = ` + +resource "citrixadc_policyexpression" "tf_classic_policyexpression" { + name = "tf_classic_policyexrpession" + value = "METHOD != GET" + clientsecuritymessage = "security message" +} +` + +const testAccPolicyexpression_classic_step3 = ` + +resource "citrixadc_policyexpression" "tf_classic_policyexpression" { + name = "tf_classic_policyexrpession_new" + value = "METHOD != GET" + clientsecuritymessage = "new security message" +} +` diff --git a/examples/policyexpression/provider.tf b/examples/policyexpression/provider.tf new file mode 100644 index 000000000..3d4508593 --- /dev/null +++ b/examples/policyexpression/provider.tf @@ -0,0 +1,3 @@ +provider "citrixadc" { + endpoint = "http://localhost:8080" +} diff --git a/examples/policyexpression/resources.tf b/examples/policyexpression/resources.tf new file mode 100644 index 000000000..14fe6b31d --- /dev/null +++ b/examples/policyexpression/resources.tf @@ -0,0 +1,11 @@ +resource "citrixadc_policyexpression" "tf_advanced_policyexpression" { + name = "tf_advanced_policyexrpession" + value = "HTTP.REQ.URL.SUFFIX.EQ(\"cgi\")" + comment = "comment" +} + +resource "citrixadc_policyexpression" "tf_classic_policyexpression" { + name = "tf_classic_policyexrpession" + value = "HEADER Cookie EXISTS" + clientsecuritymessage = "security message" +} From 80049d1e6d897f509079523b33a8dc9d05570b40 Mon Sep 17 00:00:00 2001 From: George Nikolopoulos Date: Mon, 22 Jun 2020 19:01:38 +0300 Subject: [PATCH 2/3] Add resouce systemextramgmtcpu with examples Signed-off-by: George Nikolopoulos --- citrixadc/provider.go | 1 + .../resource_citrixadc_systemextramgmtcpu.go | 141 ++++++++++++++++++ ...ource_citrixadc_systemextramgmtcpu_test.go | 101 +++++++++++++ examples/systemextramgmtcpu/provider.tf | 3 + examples/systemextramgmtcpu/resources.tf | 4 + 5 files changed, 250 insertions(+) create mode 100644 citrixadc/resource_citrixadc_systemextramgmtcpu.go create mode 100644 citrixadc/resource_citrixadc_systemextramgmtcpu_test.go create mode 100644 examples/systemextramgmtcpu/provider.tf create mode 100644 examples/systemextramgmtcpu/resources.tf diff --git a/citrixadc/provider.go b/citrixadc/provider.go index a2bc2714c..a16254820 100644 --- a/citrixadc/provider.go +++ b/citrixadc/provider.go @@ -134,6 +134,7 @@ func providerResources() map[string]*schema.Resource { "citrixadc_nsrpcnode": resourceCitrixAdcNsrpcnode(), "citrixadc_routerdynamicrouting": resourceCitrixAdcRouterdynamicrouting(), "citrixadc_policyexpression": resourceCitrixAdcPolicyexpression(), + "citrixadc_systemextramgmtcpu": resourceCitrixAdcSystemextramgmtcpu(), } } diff --git a/citrixadc/resource_citrixadc_systemextramgmtcpu.go b/citrixadc/resource_citrixadc_systemextramgmtcpu.go new file mode 100644 index 000000000..79c67b58a --- /dev/null +++ b/citrixadc/resource_citrixadc_systemextramgmtcpu.go @@ -0,0 +1,141 @@ +package citrixadc + +import ( + "github.com/chiradeep/go-nitro/config/ns" + "github.com/chiradeep/go-nitro/config/system" + "github.com/chiradeep/go-nitro/netscaler" + + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/helper/schema" + + _ "fmt" + "log" +) + +func resourceCitrixAdcSystemextramgmtcpu() *schema.Resource { + return &schema.Resource{ + SchemaVersion: 1, + Create: createSystemextramgmtcpuFunc, + Read: readSystemextramgmtcpuFunc, + Delete: schema.Noop, + Update: schema.Noop, + Schema: map[string]*schema.Schema{ + "enabled": &schema.Schema{ + Type: schema.TypeBool, + Required: true, + ForceNew: true, + }, + "reboot": &schema.Schema{ + Type: schema.TypeBool, + Default: true, + Optional: true, + }, + "reachable_timeout": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Default: "10m", + ForceNew: true, + }, + "reachable_poll_delay": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Default: "60s", + ForceNew: true, + }, + "reachable_poll_interval": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Default: "60s", + ForceNew: true, + }, + "reachable_poll_timeout": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Default: "20s", + ForceNew: true, + }, + }, + } +} + +func createSystemextramgmtcpuFunc(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] citrixadc-provider: In createSystemextramgmtcpuFunc") + client := meta.(*NetScalerNitroClient).client + systemextramgmtcpuName := resource.PrefixedUniqueId("tf-systemextramgmtcpu-") + + systemextramgmtcpu := system.Systemextramgmtcpu{} + + var action string + if d.Get("enabled").(bool) { + action = "enable" + } else { + action = "disable" + } + + err := client.ActOnResource("systemextramgmtcpu", &systemextramgmtcpu, action) + if err != nil { + return err + } + + if d.Get("reboot").(bool) { + var err error + err = systemextramgmtcpuRebootAdcInstance(d, meta) + if err != nil { + return err + } + + // Reusing wait function from rebooter resource + err = rebooterWaitReachable(d, meta) + if err != nil { + return err + } + } + + d.SetId(systemextramgmtcpuName) + + err = readSystemextramgmtcpuFunc(d, meta) + if err != nil { + log.Printf("[ERROR] netscaler-provider: ?? we just created this systemextramgmtcpu but we can't read it ?? %s", systemextramgmtcpuName) + return nil + } + return nil +} + +func readSystemextramgmtcpuFunc(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] citrixadc-provider: In readSystemextramgmtcpuFunc") + client := meta.(*NetScalerNitroClient).client + systemextramgmtcpuName := d.Id() + log.Printf("[DEBUG] citrixadc-provider: Reading systemextramgmtcpu state %s", systemextramgmtcpuName) + findParams := netscaler.FindParams{ + ResourceType: "systemextramgmtcpu", + } + dataarray, err := client.FindResourceArrayWithParams(findParams) + if err != nil { + log.Printf("[ERROR] citrixadc-provider: Error reading state: %s", err.Error()) + log.Printf("[WARN] citrixadc-provider: Clearing systemextramgmtcpu state %s", systemextramgmtcpuName) + d.SetId("") + return nil + } + data := dataarray[0] + if data["effectivestate"].(string) == "ENABLED" { + d.Set("enabled", true) + } else { + d.Set("enabled", false) + } + + return nil + +} + +func systemextramgmtcpuRebootAdcInstance(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] citrixadc-provider: In systemextramgmtcpuRebootAdcInstance") + + client := meta.(*NetScalerNitroClient).client + reboot := ns.Reboot{ + Warm: true, + } + if err := client.ActOnResource("reboot", &reboot, ""); err != nil { + return err + } + return nil +} diff --git a/citrixadc/resource_citrixadc_systemextramgmtcpu_test.go b/citrixadc/resource_citrixadc_systemextramgmtcpu_test.go new file mode 100644 index 000000000..454c61b83 --- /dev/null +++ b/citrixadc/resource_citrixadc_systemextramgmtcpu_test.go @@ -0,0 +1,101 @@ +/* +Copyright 2016 Citrix Systems, Inc + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package citrixadc + +import ( + "fmt" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" + "testing" +) + +func TestAccSystemextramgmtcpu_basic(t *testing.T) { + if isCpxRun { + t.Skip("CPX does not support the feature") + // TODO actually we need a VPX with 12 cores licensed to test this resource + // otherwise the systemextramgmtcpu enable action is a noop + } + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccSystemextramgmtcpu_basic_step1, + Check: resource.ComposeTestCheckFunc( + testAccCheckSystemextramgmtcpuExist("citrixadc_systemextramgmtcpu.tf_extramgmtcpu", nil), + ), + }, + resource.TestStep{ + Config: testAccSystemextramgmtcpu_basic_step2, + Check: resource.ComposeTestCheckFunc( + testAccCheckSystemextramgmtcpuExist("citrixadc_systemextramgmtcpu.tf_extramgmtcpu", nil), + ), + }, + }, + }) +} + +func testAccCheckSystemextramgmtcpuExist(n string, id *string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No lb vserver name is set") + } + + if id != nil { + if *id != "" && *id != rs.Primary.ID { + return fmt.Errorf("Resource ID has changed!") + } + + *id = rs.Primary.ID + } + + nsClient := testAccProvider.Meta().(*NetScalerNitroClient).client + data, err := nsClient.FindResource("systemextramgmtcpu", rs.Primary.ID) + + if err != nil { + return err + } + + if data == nil { + return fmt.Errorf("LB vserver %s not found", n) + } + + return nil + } +} + +const testAccSystemextramgmtcpu_basic_step1 = ` + +resource "citrixadc_systemextramgmtcpu" "tf_extramgmtcpu" { + enabled = true + reboot = true +} + +` + +const testAccSystemextramgmtcpu_basic_step2 = ` + +resource "citrixadc_systemextramgmtcpu" "tf_extramgmtcpu" { + enabled = false + reboot = true +} + +` diff --git a/examples/systemextramgmtcpu/provider.tf b/examples/systemextramgmtcpu/provider.tf new file mode 100644 index 000000000..3d4508593 --- /dev/null +++ b/examples/systemextramgmtcpu/provider.tf @@ -0,0 +1,3 @@ +provider "citrixadc" { + endpoint = "http://localhost:8080" +} diff --git a/examples/systemextramgmtcpu/resources.tf b/examples/systemextramgmtcpu/resources.tf new file mode 100644 index 000000000..79a94f21b --- /dev/null +++ b/examples/systemextramgmtcpu/resources.tf @@ -0,0 +1,4 @@ +resource "citrixadc_systemextramgmtcpu" "tf_extramgmtcpu" { + enabled = true + reboot = true +} From 2aff42ea9ea932182598dd0f99f13f7cc767dd5b Mon Sep 17 00:00:00 2001 From: George Nikolopoulos Date: Mon, 22 Jun 2020 19:03:18 +0300 Subject: [PATCH 3/3] Add NITRO dependencies in vendor Signed-off-by: George Nikolopoulos --- .../go-nitro/config/policy/policydataset.go | 9 +++++ .../config/policy/policydataset_binding.go | 5 +++ .../policy/policydataset_value_binding.go | 8 +++++ .../config/policy/policyevaluation.go | 35 +++++++++++++++++++ .../config/policy/policyexpression.go | 16 +++++++++ .../config/policy/policyhttpcallout.go | 26 ++++++++++++++ .../go-nitro/config/policy/policymap.go | 10 ++++++ .../go-nitro/config/policy/policyparam.go | 5 +++ .../go-nitro/config/policy/policypatset.go | 8 +++++ .../config/policy/policypatset_binding.go | 5 +++ .../policy/policypatset_pattern_binding.go | 11 ++++++ .../go-nitro/config/policy/policystringmap.go | 6 ++++ .../config/policy/policystringmap_binding.go | 5 +++ .../policy/policystringmap_pattern_binding.go | 7 ++++ .../go-nitro/config/policy/policyurlset.go | 16 +++++++++ vendor/modules.txt | 1 + 16 files changed, 173 insertions(+) create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policydataset.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policydataset_binding.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policydataset_value_binding.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policyevaluation.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policyexpression.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policyhttpcallout.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policymap.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policyparam.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policypatset.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policypatset_binding.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policypatset_pattern_binding.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap_binding.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap_pattern_binding.go create mode 100644 vendor/github.com/chiradeep/go-nitro/config/policy/policyurlset.go diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policydataset.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policydataset.go new file mode 100644 index 000000000..0e2353e7f --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policydataset.go @@ -0,0 +1,9 @@ +package policy + +type Policydataset struct { + Comment string `json:"comment,omitempty"` + Description string `json:"description,omitempty"` + Indextype string `json:"indextype,omitempty"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policydataset_binding.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policydataset_binding.go new file mode 100644 index 000000000..2b4e36b7d --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policydataset_binding.go @@ -0,0 +1,5 @@ +package policy + +type Policydatasetbinding struct { + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policydataset_value_binding.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policydataset_value_binding.go new file mode 100644 index 000000000..c164433ab --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policydataset_value_binding.go @@ -0,0 +1,8 @@ +package policy + +type Policydatasetvaluebinding struct { + Comment string `json:"comment,omitempty"` + Index int `json:"index,omitempty"` + Name string `json:"name,omitempty"` + Value string `json:"value,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policyevaluation.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policyevaluation.go new file mode 100644 index 000000000..6729b7d40 --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policyevaluation.go @@ -0,0 +1,35 @@ +package policy + +type Policyevaluation struct { + Action string `json:"action,omitempty"` + Expression string `json:"expression,omitempty"` + Input string `json:"input,omitempty"` + Istruncatedrefresult bool `json:"istruncatedrefresult,omitempty"` + Pitactionerrorresult string `json:"pitactionerrorresult,omitempty"` + Pitactionevaltime int `json:"pitactionevaltime,omitempty"` + Pitboolerrorresult string `json:"pitboolerrorresult,omitempty"` + Pitboolevaltime int `json:"pitboolevaltime,omitempty"` + Pitboolresult bool `json:"pitboolresult,omitempty"` + Pitdoubleerrorresult string `json:"pitdoubleerrorresult,omitempty"` + Pitdoubleevaltime int `json:"pitdoubleevaltime,omitempty"` + Pitdoubleresult float64 `json:"pitdoubleresult,omitempty"` + Pitmodifiedinputdata string `json:"pitmodifiedinputdata,omitempty"` + Pitnewoffsetarray interface{} `json:"pitnewoffsetarray,omitempty"` + Pitnumerrorresult string `json:"pitnumerrorresult,omitempty"` + Pitnumevaltime int `json:"pitnumevaltime,omitempty"` + Pitnumresult int `json:"pitnumresult,omitempty"` + Pitoffseterrorresult string `json:"pitoffseterrorresult,omitempty"` + Pitoffsetevaltime int `json:"pitoffsetevaltime,omitempty"` + Pitoffsetlengtharray interface{} `json:"pitoffsetlengtharray,omitempty"` + Pitoffsetresult int `json:"pitoffsetresult,omitempty"` + Pitoffsetresultlen int `json:"pitoffsetresultlen,omitempty"` + Pitoldoffsetarray interface{} `json:"pitoldoffsetarray,omitempty"` + Pitoperationperformerarray interface{} `json:"pitoperationperformerarray,omitempty"` + Pitreferrorresult string `json:"pitreferrorresult,omitempty"` + Pitrefevaltime int `json:"pitrefevaltime,omitempty"` + Pitrefresult string `json:"pitrefresult,omitempty"` + Pitulongerrorresult string `json:"pitulongerrorresult,omitempty"` + Pitulongevaltime int `json:"pitulongevaltime,omitempty"` + Pitulongresult int `json:"pitulongresult,omitempty"` + Type string `json:"type,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policyexpression.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policyexpression.go new file mode 100644 index 000000000..3367a83eb --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policyexpression.go @@ -0,0 +1,16 @@ +package policy + +type Policyexpression struct { + Builtin interface{} `json:"builtin,omitempty"` + Clientsecuritymessage string `json:"clientsecuritymessage,omitempty"` + Comment string `json:"comment,omitempty"` + Description string `json:"description,omitempty"` + Feature string `json:"feature,omitempty"` + Hits int `json:"hits,omitempty"` + Isdefault bool `json:"isdefault,omitempty"` + Name string `json:"name,omitempty"` + Pihits int `json:"pihits,omitempty"` + Type string `json:"type,omitempty"` + Type1 string `json:"type1,omitempty"` + Value string `json:"value,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policyhttpcallout.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policyhttpcallout.go new file mode 100644 index 000000000..8f0422682 --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policyhttpcallout.go @@ -0,0 +1,26 @@ +package policy + +type Policyhttpcallout struct { + Bodyexpr string `json:"bodyexpr,omitempty"` + Cacheforsecs int `json:"cacheforsecs,omitempty"` + Comment string `json:"comment,omitempty"` + Effectivestate string `json:"effectivestate,omitempty"` + Fullreqexpr string `json:"fullreqexpr,omitempty"` + Headers interface{} `json:"headers,omitempty"` + Hits int `json:"hits,omitempty"` + Hostexpr string `json:"hostexpr,omitempty"` + Httpmethod string `json:"httpmethod,omitempty"` + Ipaddress string `json:"ipaddress,omitempty"` + Name string `json:"name,omitempty"` + Parameters interface{} `json:"parameters,omitempty"` + Port int `json:"port,omitempty"` + Recursivecallout int `json:"recursivecallout,omitempty"` + Resultexpr string `json:"resultexpr,omitempty"` + Returntype string `json:"returntype,omitempty"` + Scheme string `json:"scheme,omitempty"` + Svrstate string `json:"svrstate,omitempty"` + Undefhits int `json:"undefhits,omitempty"` + Undefreason string `json:"undefreason,omitempty"` + Urlstemexpr string `json:"urlstemexpr,omitempty"` + Vserver string `json:"vserver,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policymap.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policymap.go new file mode 100644 index 000000000..e8eb70c84 --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policymap.go @@ -0,0 +1,10 @@ +package policy + +type Policymap struct { + Mappolicyname string `json:"mappolicyname,omitempty"` + Sd string `json:"sd,omitempty"` + Su string `json:"su,omitempty"` + Targetname string `json:"targetname,omitempty"` + Td string `json:"td,omitempty"` + Tu string `json:"tu,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policyparam.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policyparam.go new file mode 100644 index 000000000..6af343dc6 --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policyparam.go @@ -0,0 +1,5 @@ +package policy + +type Policyparam struct { + Timeout int `json:"timeout,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policypatset.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policypatset.go new file mode 100644 index 000000000..8bebced44 --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policypatset.go @@ -0,0 +1,8 @@ +package policy + +type Policypatset struct { + Comment string `json:"comment,omitempty"` + Description string `json:"description,omitempty"` + Indextype string `json:"indextype,omitempty"` + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policypatset_binding.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policypatset_binding.go new file mode 100644 index 000000000..ec730987f --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policypatset_binding.go @@ -0,0 +1,5 @@ +package policy + +type Policypatsetbinding struct { + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policypatset_pattern_binding.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policypatset_pattern_binding.go new file mode 100644 index 000000000..45968dc47 --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policypatset_pattern_binding.go @@ -0,0 +1,11 @@ +package policy + +type Policypatsetpatternbinding struct { + Builtin interface{} `json:"builtin,omitempty"` + Charset string `json:"charset,omitempty"` + Comment string `json:"comment,omitempty"` + Feature string `json:"feature,omitempty"` + Index int `json:"index,omitempty"` + Name string `json:"name,omitempty"` + String string `json:"String,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap.go new file mode 100644 index 000000000..b8185f03b --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap.go @@ -0,0 +1,6 @@ +package policy + +type Policystringmap struct { + Comment string `json:"comment,omitempty"` + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap_binding.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap_binding.go new file mode 100644 index 000000000..a9cd7815e --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap_binding.go @@ -0,0 +1,5 @@ +package policy + +type Policystringmapbinding struct { + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap_pattern_binding.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap_pattern_binding.go new file mode 100644 index 000000000..7375e9753 --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policystringmap_pattern_binding.go @@ -0,0 +1,7 @@ +package policy + +type Policystringmappatternbinding struct { + Key string `json:"key,omitempty"` + Name string `json:"name,omitempty"` + Value string `json:"value,omitempty"` +} diff --git a/vendor/github.com/chiradeep/go-nitro/config/policy/policyurlset.go b/vendor/github.com/chiradeep/go-nitro/config/policy/policyurlset.go new file mode 100644 index 000000000..810fb7d9e --- /dev/null +++ b/vendor/github.com/chiradeep/go-nitro/config/policy/policyurlset.go @@ -0,0 +1,16 @@ +package policy + +type Policyurlset struct { + Canaryurl string `json:"canaryurl,omitempty"` + Comment string `json:"comment,omitempty"` + Delimiter string `json:"delimiter,omitempty"` + Imported bool `json:"imported,omitempty"` + Interval int `json:"interval,omitempty"` + Name string `json:"name,omitempty"` + Overwrite bool `json:"overwrite,omitempty"` + Patterncount int `json:"patterncount,omitempty"` + Privateset bool `json:"privateset,omitempty"` + Rowseparator string `json:"rowseparator,omitempty"` + Subdomainexactmatch bool `json:"subdomainexactmatch,omitempty"` + Url string `json:"url,omitempty"` +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 9653a56e4..0ba928466 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -69,6 +69,7 @@ github.com/chiradeep/go-nitro/config/gslb github.com/chiradeep/go-nitro/config/lb github.com/chiradeep/go-nitro/config/network github.com/chiradeep/go-nitro/config/ns +github.com/chiradeep/go-nitro/config/policy github.com/chiradeep/go-nitro/config/responder github.com/chiradeep/go-nitro/config/rewrite github.com/chiradeep/go-nitro/config/router