From 9d211f4578d639961544e571aa37a9bddfa5777e Mon Sep 17 00:00:00 2001 From: Rohit Myali Date: Mon, 2 Sep 2024 11:26:39 +0530 Subject: [PATCH 1/2] Updated vendor directory for adc-nito-go changes for client regarding url encoding Signed-off-by: Rohit Myali --- go.mod | 2 +- go.sum | 6 +- .../service/netscaler_resource.go | 62 +++++++++++-------- vendor/modules.txt | 2 +- 4 files changed, 40 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index c4845de74..2f823a485 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/citrix/terraform-provider-citrixadc go 1.18 require ( - github.com/citrix/adc-nitro-go v0.0.0-20240709171840-0d3d1079d092 + github.com/citrix/adc-nitro-go v0.0.0-20240828101652-94a4ce81c2dc github.com/gruntwork-io/terratest v0.41.9 github.com/hashicorp/terraform-plugin-sdk v1.17.2 github.com/mitchellh/mapstructure v1.5.0 diff --git a/go.sum b/go.sum index 98b3a8f0b..2f5e04cf4 100644 --- a/go.sum +++ b/go.sum @@ -237,10 +237,8 @@ github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXH github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/citrix/adc-nitro-go v0.0.0-20240508064526-011d10c8e5b4 h1:z2BCKSwFOYTy4rkI34lfVuMCmFqOBNzGjL6DzYs8GS4= -github.com/citrix/adc-nitro-go v0.0.0-20240508064526-011d10c8e5b4/go.mod h1:DL1n+MgO15981ahrt+CsQVv43yyUrTdigPq3dIxydD8= -github.com/citrix/adc-nitro-go v0.0.0-20240709171840-0d3d1079d092 h1:PI50Bynj9RIBzg2GK9r3jXQBhtAX21SSYdMB5VgOYFo= -github.com/citrix/adc-nitro-go v0.0.0-20240709171840-0d3d1079d092/go.mod h1:DL1n+MgO15981ahrt+CsQVv43yyUrTdigPq3dIxydD8= +github.com/citrix/adc-nitro-go v0.0.0-20240828101652-94a4ce81c2dc h1:MoBCY3Zp7+LTmzi2rHqeNre2DIhkSBzg5TCWf9fevyQ= +github.com/citrix/adc-nitro-go v0.0.0-20240828101652-94a4ce81c2dc/go.mod h1:DL1n+MgO15981ahrt+CsQVv43yyUrTdigPq3dIxydD8= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= diff --git a/vendor/github.com/citrix/adc-nitro-go/service/netscaler_resource.go b/vendor/github.com/citrix/adc-nitro-go/service/netscaler_resource.go index 70091782c..1036bf879 100644 --- a/vendor/github.com/citrix/adc-nitro-go/service/netscaler_resource.go +++ b/vendor/github.com/citrix/adc-nitro-go/service/netscaler_resource.go @@ -21,9 +21,9 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" - "net/url" + neturl "net/url" "strings" "github.com/hashicorp/go-hclog" @@ -84,24 +84,24 @@ type responseHandlerFunc func(resp *http.Response, logger hclog.Logger) ([]byte, func createResponseHandler(resp *http.Response, logger hclog.Logger) ([]byte, error) { switch resp.Status { case "201 Created", "200 OK": - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) return body, nil case "409 Conflict": - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) return body, errors.New("failed: " + resp.Status + " (" + string(body) + ")") case "207 Multi Status": //This happens in case of Bulk operations, which we do not support yet - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) return body, nil case "400 Bad Request", "401 Unauthorized", "403 Forbidden", "404 Not Found", "405 Method Not Allowed", "406 Not Acceptable", "503 Service Unavailable", "599 Netscaler specific error": - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) logger.Info("error = ", "body", string(body)) return body, errors.New("failed: " + resp.Status + " (" + string(body) + ")") default: - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) return body, err } @@ -110,17 +110,17 @@ func createResponseHandler(resp *http.Response, logger hclog.Logger) ([]byte, er func deleteResponseHandler(resp *http.Response, logger hclog.Logger) ([]byte, error) { switch resp.Status { case "200 OK", "404 Not Found": - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) return body, nil case "400 Bad Request", "401 Unauthorized", "403 Forbidden", "405 Method Not Allowed", "406 Not Acceptable", "409 Conflict", "503 Service Unavailable", "599 Netscaler specific error": - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) logger.Info("delete: error = ", "body", string(body)) return body, errors.New("[INFO] delete failed: " + resp.Status + " (" + string(body) + ")") default: - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) return body, err } @@ -129,20 +129,20 @@ func deleteResponseHandler(resp *http.Response, logger hclog.Logger) ([]byte, er func readResponseHandler(resp *http.Response, logger hclog.Logger) ([]byte, error) { switch resp.Status { case "200 OK": - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) return body, nil case "404 Not Found": - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) logger.Debug("readResponseHandler: 404 not found") return body, errors.New("read: 404 not found: ") case "400 Bad Request", "401 Unauthorized", "403 Forbidden", "405 Method Not Allowed", "406 Not Acceptable", "409 Conflict", "503 Service Unavailable", "599 Netscaler specific error": - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) logger.Info("read: error = ", "body", string(body)) return body, errors.New("[INFO] failed read: " + resp.Status + " (" + string(body) + ")") default: - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) logger.Info("read error = ", "body", string(body)) return body, err @@ -155,7 +155,7 @@ func (c *NitroClient) createHTTPRequest(method string, urlstr string, buff *byte return nil, err } // Get resourceType from url - u, err := url.Parse(urlstr) + u, err := neturl.Parse(urlstr) if err != nil { return nil, err } @@ -272,7 +272,8 @@ func (c *NitroClient) actOnResource(resourceType string, resourceJSON []byte, ac func (c *NitroClient) changeResource(resourceType string, resourceName string, resourceJSON []byte) ([]byte, error) { c.logger.Trace("changing resource", "resourceType", resourceType) - url := c.url + resourceType + "/" + resourceName + "?action=update" + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) + url := c.url + resourceType + "/" + resourceNameEscaped + "?action=update" c.logger.Trace("changeResource", "url", url) return c.doHTTPRequest("POST", url, bytes.NewBuffer(resourceJSON), createResponseHandler) @@ -282,7 +283,8 @@ func (c *NitroClient) changeResource(resourceType string, resourceName string, r func (c *NitroClient) updateResource(resourceType string, resourceName string, resourceJSON []byte) ([]byte, error) { c.logger.Trace("Updating resource ", "resourceType", resourceType) - url := c.url + resourceType + "/" + resourceName + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) + url := c.url + resourceType + "/" + resourceNameEscaped c.logger.Trace("updateResource ", "url", url) return c.doHTTPRequest("PUT", url, bytes.NewBuffer(resourceJSON), createResponseHandler) @@ -303,7 +305,8 @@ func (c *NitroClient) deleteResource(resourceType string, resourceName string) ( c.logger.Trace("Deleting resource", "resourceType", resourceType) var url string if resourceName != "" { - url = c.url + fmt.Sprintf("%s/%s", resourceType, resourceName) + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) + url = c.url + fmt.Sprintf("%s/%s", resourceType, resourceNameEscaped) } else { url = c.url + fmt.Sprintf("%s", resourceType) } @@ -317,7 +320,8 @@ func (c *NitroClient) deleteResourceWithArgs(resourceType string, resourceName s c.logger.Trace("Deleting resource with args", "resourceType", resourceType, "args ", args) var url string if resourceName != "" { - url = c.url + fmt.Sprintf("%s/%s?args=", resourceType, resourceName) + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) + url = c.url + fmt.Sprintf("%s/%s?args=", resourceType, resourceNameEscaped) } else { url = c.url + fmt.Sprintf("%s?args=", resourceType) } @@ -342,8 +346,9 @@ func (c *NitroClient) deleteResourceWithArgsMap(resourceType string, resourceNam func (c *NitroClient) unbindResource(resourceType string, resourceName string, boundResourceType string, boundResource string, bindingFilterName string) ([]byte, error) { c.logger.Trace("Unbinding resource", "resourceType", resourceType, "resourceName", resourceName) bindingName := resourceType + "_" + boundResourceType + "_binding" + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) - url := c.url + "/" + bindingName + "/" + resourceName + "?args=" + bindingFilterName + ":" + boundResource + url := c.url + "/" + bindingName + "/" + resourceNameEscaped + "?args=" + bindingFilterName + ":" + boundResource return c.doHTTPRequest("DELETE", url, bytes.NewBuffer([]byte{}), deleteResponseHandler) @@ -352,10 +357,11 @@ func (c *NitroClient) unbindResource(resourceType string, resourceName string, b func (c *NitroClient) listBoundResources(resourceName string, resourceType string, boundResourceType string, boundResourceFilterName string, boundResourceFilterValue string) ([]byte, error) { c.logger.Trace("listing bound resources of type ", "resourceType", resourceType, "resourceName", resourceName) var url string + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) if boundResourceFilterName == "" { - url = c.url + fmt.Sprintf("%s_%s_binding/%s", resourceType, boundResourceType, resourceName) + url = c.url + fmt.Sprintf("%s_%s_binding/%s", resourceType, boundResourceType, resourceNameEscaped) } else { - url = c.url + fmt.Sprintf("%s_%s_binding/%s?filter=%s:%s", resourceType, boundResourceType, resourceName, boundResourceFilterName, boundResourceFilterValue) + url = c.url + fmt.Sprintf("%s_%s_binding/%s?filter=%s:%s", resourceType, boundResourceType, resourceNameEscaped, boundResourceFilterName, boundResourceFilterValue) } return c.doHTTPRequest("GET", url, bytes.NewBuffer([]byte{}), readResponseHandler) @@ -383,7 +389,8 @@ func (c *NitroClient) listResource(resourceType string, resourceName string) ([] url := c.url + resourceType if resourceName != "" { - url = c.url + fmt.Sprintf("%s/%s", resourceType, resourceName) + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) + url = c.url + fmt.Sprintf("%s/%s", resourceType, resourceNameEscaped) } c.logger.Trace("listResource", "url", url) @@ -396,7 +403,8 @@ func (c *NitroClient) listResourceWithArgs(resourceType string, resourceName str var url string if resourceName != "" { - url = c.url + fmt.Sprintf("%s/%s", resourceType, resourceName) + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) + url = c.url + fmt.Sprintf("%s/%s", resourceType, resourceNameEscaped) } else { url = c.url + fmt.Sprintf("%s", resourceType) } @@ -488,7 +496,8 @@ func (c *NitroClient) listStat(resourceType, resourceName string) ([]byte, error url := c.statsURL + resourceType if resourceName != "" { - url = c.statsURL + fmt.Sprintf("%s/%s", resourceType, resourceName) + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) + url = c.statsURL + fmt.Sprintf("%s/%s", resourceType, resourceNameEscaped) } c.logger.Trace("listStat", "url", url) @@ -501,7 +510,8 @@ func (c *NitroClient) listStatWithArgs(resourceType string, resourceName string, var url string if len(resourceName) > 0 { - url = c.statsURL + fmt.Sprintf("%s/%s", resourceType, resourceName) + resourceNameEscaped := neturl.PathEscape(neturl.PathEscape(resourceName)) + url = c.statsURL + fmt.Sprintf("%s/%s", resourceType, resourceNameEscaped) } else { url = c.statsURL + fmt.Sprintf("%s", resourceType) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 7ba4b4ee2..e523477cb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -98,7 +98,7 @@ github.com/bgentry/go-netrc/netrc # github.com/bgentry/speakeasy v0.1.0 ## explicit github.com/bgentry/speakeasy -# github.com/citrix/adc-nitro-go v0.0.0-20240709171840-0d3d1079d092 +# github.com/citrix/adc-nitro-go v0.0.0-20240828101652-94a4ce81c2dc ## explicit; go 1.14 github.com/citrix/adc-nitro-go/resource/config/aaa github.com/citrix/adc-nitro-go/resource/config/adm From e518c92e7696fd523e9af1b0e9bb5c92dc1a5d6a Mon Sep 17 00:00:00 2001 From: Rohit Myali Date: Mon, 2 Sep 2024 11:36:31 +0530 Subject: [PATCH 2/2] Removed resource name encoding in resource file and handled it in client(adc-nitro-go) Signed-off-by: Rohit Myali --- ...ource_citrixadc_aaapreauthenticationaction.go | 11 +++-------- ...resource_citrixadc_appfwhtmlerrorpage_test.go | 2 ++ .../resource_citrixadc_appfwjsoncontenttype.go | 7 ++----- ...resource_citrixadc_appfwjsonerrorpage_test.go | 1 + ...ce_citrixadc_appfwmultipartformcontenttype.go | 9 +++------ ...trixadc_appfwmultipartformcontenttype_test.go | 9 ++++----- .../resource_citrixadc_appfwsignatures_test.go | 1 + .../resource_citrixadc_appfwxmlcontenttype.go | 7 ++----- .../resource_citrixadc_appfwxmlschema_test.go | 1 + .../resource_citrixadc_auditsyslogpolicy.go | 11 +++-------- citrixadc/resource_citrixadc_channel.go | 5 ++--- citrixadc/resource_citrixadc_channel_test.go | 5 ++--- ...egroup_gslbservicegroupmember_binding_test.go | 10 +++++++++- ...itrixadc_hanode_routemonitor6_binding_test.go | 1 + citrixadc/resource_citrixadc_linkset.go | 16 ++++------------ ...resource_citrixadc_linkset_channel_binding.go | 2 +- ...rce_citrixadc_linkset_channel_binding_test.go | 2 +- citrixadc/resource_citrixadc_onlinkipv6prefix.go | 5 ++--- .../resource_citrixadc_onlinkipv6prefix_test.go | 3 +-- citrixadc/resource_citrixadc_radiusnode.go | 9 +++------ citrixadc/resource_citrixadc_radiusnode_test.go | 5 ++--- citrixadc/resource_citrixadc_systemfile.go | 2 +- ...citrixadc_videooptimizationdetectionaction.go | 10 +++------- ...citrixadc_videooptimizationdetectionpolicy.go | 10 +++------- ..._citrixadc_vpnglobal_appcontroller_binding.go | 2 +- 25 files changed, 58 insertions(+), 88 deletions(-) diff --git a/citrixadc/resource_citrixadc_aaapreauthenticationaction.go b/citrixadc/resource_citrixadc_aaapreauthenticationaction.go index 62c2bd55b..3fa4dfddb 100644 --- a/citrixadc/resource_citrixadc_aaapreauthenticationaction.go +++ b/citrixadc/resource_citrixadc_aaapreauthenticationaction.go @@ -8,7 +8,6 @@ import ( "fmt" "log" - "net/url" ) func resourceCitrixAdcAaapreauthenticationaction() *schema.Resource { @@ -80,10 +79,9 @@ func readAaapreauthenticationactionFunc(d *schema.ResourceData, meta interface{} log.Printf("[DEBUG] citrixadc-provider: In readAaapreauthenticationactionFunc") client := meta.(*NetScalerNitroClient).client aaapreauthenticationactionName := d.Id() - aaapreauthenticationactionName_pathescaped := url.PathEscape(aaapreauthenticationactionName) log.Printf("[DEBUG] citrixadc-provider: Reading aaapreauthenticationaction state %s", aaapreauthenticationactionName) - data, err := client.FindResource(service.Aaapreauthenticationaction.Type(), aaapreauthenticationactionName_pathescaped) + data, err := client.FindResource(service.Aaapreauthenticationaction.Type(), aaapreauthenticationactionName) if err != nil { log.Printf("[WARN] citrixadc-provider: Clearing aaapreauthenticationaction state %s", aaapreauthenticationactionName) d.SetId("") @@ -105,8 +103,6 @@ func updateAaapreauthenticationactionFunc(d *schema.ResourceData, meta interface client := meta.(*NetScalerNitroClient).client aaapreauthenticationactionName := d.Get("name").(string) - aaapreauthenticationactionName_pathescaped := url.PathEscape(aaapreauthenticationactionName) - aaapreauthenticationaction := aaa.Aaapreauthenticationaction{ Name: d.Get("name").(string), } @@ -133,7 +129,7 @@ func updateAaapreauthenticationactionFunc(d *schema.ResourceData, meta interface } if hasChange { - _, err := client.UpdateResource(service.Aaapreauthenticationaction.Type(), aaapreauthenticationactionName_pathescaped, &aaapreauthenticationaction) + _, err := client.UpdateResource(service.Aaapreauthenticationaction.Type(), aaapreauthenticationactionName, &aaapreauthenticationaction) if err != nil { return fmt.Errorf("Error updating aaapreauthenticationaction %s", aaapreauthenticationactionName) } @@ -145,8 +141,7 @@ func deleteAaapreauthenticationactionFunc(d *schema.ResourceData, meta interface log.Printf("[DEBUG] citrixadc-provider: In deleteAaapreauthenticationactionFunc") client := meta.(*NetScalerNitroClient).client aaapreauthenticationactionName := d.Id() - aaapreauthenticationactionName_pathescaped := url.PathEscape(aaapreauthenticationactionName) - err := client.DeleteResource(service.Aaapreauthenticationaction.Type(), aaapreauthenticationactionName_pathescaped) + err := client.DeleteResource(service.Aaapreauthenticationaction.Type(), aaapreauthenticationactionName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_appfwhtmlerrorpage_test.go b/citrixadc/resource_citrixadc_appfwhtmlerrorpage_test.go index c388a9e44..3d8c66281 100644 --- a/citrixadc/resource_citrixadc_appfwhtmlerrorpage_test.go +++ b/citrixadc/resource_citrixadc_appfwhtmlerrorpage_test.go @@ -38,6 +38,8 @@ const testAccAppfwhtmlerrorpage_basic = ` ` func TestAccAppfwhtmlerrorpage_basic(t *testing.T) { + t.Skip("TODO: Need to find a way to test this resource!") + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, diff --git a/citrixadc/resource_citrixadc_appfwjsoncontenttype.go b/citrixadc/resource_citrixadc_appfwjsoncontenttype.go index be5410a10..f73b75362 100644 --- a/citrixadc/resource_citrixadc_appfwjsoncontenttype.go +++ b/citrixadc/resource_citrixadc_appfwjsoncontenttype.go @@ -7,7 +7,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "log" - "net/url" ) func resourceCitrixAdcAppfwjsoncontenttype() *schema.Resource { @@ -62,9 +61,8 @@ func readAppfwjsoncontenttypeFunc(d *schema.ResourceData, meta interface{}) erro log.Printf("[DEBUG] citrixadc-provider: In readAppfwjsoncontenttypeFunc") client := meta.(*NetScalerNitroClient).client appfwjsoncontenttypeName := d.Id() - appfwjsoncontenttypeNameEscaped := url.PathEscape(url.QueryEscape(appfwjsoncontenttypeName)) log.Printf("[DEBUG] citrixadc-provider: Reading appfwjsoncontenttype state %s", appfwjsoncontenttypeName) - data, err := client.FindResource(service.Appfwjsoncontenttype.Type(), appfwjsoncontenttypeNameEscaped) + data, err := client.FindResource(service.Appfwjsoncontenttype.Type(), appfwjsoncontenttypeName) if err != nil { log.Printf("[WARN] citrixadc-provider: Clearing appfwjsoncontenttype state %s", appfwjsoncontenttypeName) d.SetId("") @@ -81,8 +79,7 @@ func deleteAppfwjsoncontenttypeFunc(d *schema.ResourceData, meta interface{}) er log.Printf("[DEBUG] citrixadc-provider: In deleteAppfwjsoncontenttypeFunc") client := meta.(*NetScalerNitroClient).client appfwjsoncontenttypeName := d.Id() - appfwjsoncontenttypeNameEscaped := url.PathEscape(url.QueryEscape(appfwjsoncontenttypeName)) - err := client.DeleteResource(service.Appfwjsoncontenttype.Type(), appfwjsoncontenttypeNameEscaped) + err := client.DeleteResource(service.Appfwjsoncontenttype.Type(), appfwjsoncontenttypeName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_appfwjsonerrorpage_test.go b/citrixadc/resource_citrixadc_appfwjsonerrorpage_test.go index 0a45e6e5c..6960aea3b 100644 --- a/citrixadc/resource_citrixadc_appfwjsonerrorpage_test.go +++ b/citrixadc/resource_citrixadc_appfwjsonerrorpage_test.go @@ -37,6 +37,7 @@ const testAccAppfwjsonerrorpage_basic = ` ` func TestAccAppfwjsonerrorpage_basic(t *testing.T) { + t.Skip("TODO: Need to find a way to test this resource!") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, diff --git a/citrixadc/resource_citrixadc_appfwmultipartformcontenttype.go b/citrixadc/resource_citrixadc_appfwmultipartformcontenttype.go index 28a142b7d..8f17b9b78 100644 --- a/citrixadc/resource_citrixadc_appfwmultipartformcontenttype.go +++ b/citrixadc/resource_citrixadc_appfwmultipartformcontenttype.go @@ -5,7 +5,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "log" - "net/url" ) func resourceCitrixAdcAppfwmultipartformcontenttype() *schema.Resource { @@ -63,10 +62,9 @@ func readAppfwmultipartformcontenttypeFunc(d *schema.ResourceData, meta interfac client := meta.(*NetScalerNitroClient).client appfwmultipartformcontenttypeName := d.Id() log.Printf("[DEBUG] citrixadc-provider: Reading appfwmultipartformcontenttype state %s", appfwmultipartformcontenttypeName) - appfwmultipartformcontenttypeNameEscaped := url.PathEscape(url.QueryEscape(appfwmultipartformcontenttypeName)) - data, err := client.FindResource("appfwmultipartformcontenttype", appfwmultipartformcontenttypeNameEscaped) + data, err := client.FindResource("appfwmultipartformcontenttype", appfwmultipartformcontenttypeName) if err != nil { - log.Printf("[WARN] citrixadc-provider: Clearing appfwmultipartformcontenttype state %s", appfwmultipartformcontenttypeNameEscaped) + log.Printf("[WARN] citrixadc-provider: Clearing appfwmultipartformcontenttype state %s", appfwmultipartformcontenttypeName) d.SetId("") return nil } @@ -81,8 +79,7 @@ func deleteAppfwmultipartformcontenttypeFunc(d *schema.ResourceData, meta interf log.Printf("[DEBUG] citrixadc-provider: In deleteAppfwmultipartformcontenttypeFunc") client := meta.(*NetScalerNitroClient).client appfwmultipartformcontenttypeName := d.Id() - appfwmultipartformcontenttypeNameEscaped := url.PathEscape(url.QueryEscape(appfwmultipartformcontenttypeName)) - err := client.DeleteResource("appfwmultipartformcontenttype", appfwmultipartformcontenttypeNameEscaped) + err := client.DeleteResource("appfwmultipartformcontenttype", appfwmultipartformcontenttypeName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_appfwmultipartformcontenttype_test.go b/citrixadc/resource_citrixadc_appfwmultipartformcontenttype_test.go index ae4c41d46..ccad12304 100644 --- a/citrixadc/resource_citrixadc_appfwmultipartformcontenttype_test.go +++ b/citrixadc/resource_citrixadc_appfwmultipartformcontenttype_test.go @@ -19,7 +19,6 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" - "net/url" "testing" ) @@ -68,8 +67,8 @@ func testAccCheckAppfwmultipartformcontenttypeExist(n string, id *string) resour } nsClient := testAccProvider.Meta().(*NetScalerNitroClient).client - appfwmultipartformcontenttypeNameEscaped := url.PathEscape(url.QueryEscape(rs.Primary.ID)) - data, err := nsClient.FindResource("appfwmultipartformcontenttype", appfwmultipartformcontenttypeNameEscaped) + appfwmultipartformcontenttypeName := rs.Primary.ID + data, err := nsClient.FindResource("appfwmultipartformcontenttype", appfwmultipartformcontenttypeName) if err != nil { return err @@ -95,8 +94,8 @@ func testAccCheckAppfwmultipartformcontenttypeDestroy(s *terraform.State) error return fmt.Errorf("No name is set") } - appfwmultipartformcontenttypeNameEscaped := url.PathEscape(url.QueryEscape(rs.Primary.ID)) - _, err := nsClient.FindResource("appfwmultipartformcontenttype", appfwmultipartformcontenttypeNameEscaped) + appfwmultipartformcontenttypeName := rs.Primary.ID + _, err := nsClient.FindResource("appfwmultipartformcontenttype", appfwmultipartformcontenttypeName) if err == nil { return fmt.Errorf("appfwmultipartformcontenttype %s still exists", rs.Primary.ID) diff --git a/citrixadc/resource_citrixadc_appfwsignatures_test.go b/citrixadc/resource_citrixadc_appfwsignatures_test.go index d22f4fbb1..e13905bfc 100644 --- a/citrixadc/resource_citrixadc_appfwsignatures_test.go +++ b/citrixadc/resource_citrixadc_appfwsignatures_test.go @@ -38,6 +38,7 @@ const testAccAppfwsignatures_basic = ` ` func TestAccAppfwsignatures_basic(t *testing.T) { + t.Skip("TODO: Need to find a way to test this resource!") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, diff --git a/citrixadc/resource_citrixadc_appfwxmlcontenttype.go b/citrixadc/resource_citrixadc_appfwxmlcontenttype.go index 599297fd8..06f536985 100644 --- a/citrixadc/resource_citrixadc_appfwxmlcontenttype.go +++ b/citrixadc/resource_citrixadc_appfwxmlcontenttype.go @@ -7,7 +7,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "log" - "net/url" ) func resourceCitrixAdcAppfwxmlcontenttype() *schema.Resource { @@ -62,9 +61,8 @@ func readAppfwxmlcontenttypeFunc(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] citrixadc-provider: In readAppfwxmlcontenttypeFunc") client := meta.(*NetScalerNitroClient).client appfwxmlcontenttypeName := d.Id() - appfwxmlcontenttypeNameEscaped := url.PathEscape(url.QueryEscape(appfwxmlcontenttypeName)) log.Printf("[DEBUG] citrixadc-provider: Reading appfwxmlcontenttype state %s", appfwxmlcontenttypeName) - data, err := client.FindResource(service.Appfwxmlcontenttype.Type(), appfwxmlcontenttypeNameEscaped) + data, err := client.FindResource(service.Appfwxmlcontenttype.Type(), appfwxmlcontenttypeName) if err != nil { log.Printf("[WARN] citrixadc-provider: Clearing appfwxmlcontenttype state %s", appfwxmlcontenttypeName) d.SetId("") @@ -81,8 +79,7 @@ func deleteAppfwxmlcontenttypeFunc(d *schema.ResourceData, meta interface{}) err log.Printf("[DEBUG] citrixadc-provider: In deleteAppfwxmlcontenttypeFunc") client := meta.(*NetScalerNitroClient).client appfwxmlcontenttypeName := d.Id() - appfwxmlcontenttypeNameEscaped := url.PathEscape(url.QueryEscape(appfwxmlcontenttypeName)) - err := client.DeleteResource(service.Appfwxmlcontenttype.Type(), appfwxmlcontenttypeNameEscaped) + err := client.DeleteResource(service.Appfwxmlcontenttype.Type(), appfwxmlcontenttypeName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_appfwxmlschema_test.go b/citrixadc/resource_citrixadc_appfwxmlschema_test.go index 847094d21..14e071918 100644 --- a/citrixadc/resource_citrixadc_appfwxmlschema_test.go +++ b/citrixadc/resource_citrixadc_appfwxmlschema_test.go @@ -38,6 +38,7 @@ const testAccAppfwxmlschema_basic = ` ` func TestAccAppfwxmlschema_basic(t *testing.T) { + t.Skip("TODO: Need to find a way to test this resource!") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, diff --git a/citrixadc/resource_citrixadc_auditsyslogpolicy.go b/citrixadc/resource_citrixadc_auditsyslogpolicy.go index 70fa67d74..801a4d1a6 100644 --- a/citrixadc/resource_citrixadc_auditsyslogpolicy.go +++ b/citrixadc/resource_citrixadc_auditsyslogpolicy.go @@ -130,9 +130,8 @@ func readAuditsyslogpolicyFunc(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] citrixadc-provider: In readAuditsyslogpolicyFunc") client := meta.(*NetScalerNitroClient).client auditsyslogpolicyName := d.Id() - auditsyslogpolicyNameEscaped := url.QueryEscape(auditsyslogpolicyName) log.Printf("[DEBUG] citrixadc-provider: Reading auditsyslogpolicy state %s", auditsyslogpolicyName) - data, err := client.FindResource(service.Auditsyslogpolicy.Type(), auditsyslogpolicyNameEscaped) + data, err := client.FindResource(service.Auditsyslogpolicy.Type(), auditsyslogpolicyName) if err != nil { log.Printf("[WARN] citrixadc-provider: Clearing auditsyslogpolicy state %s", auditsyslogpolicyName) d.SetId("") @@ -176,10 +175,8 @@ func updateAuditsyslogpolicyFunc(d *schema.ResourceData, meta interface{}) error hasChange = true } - auditsyslogpolicyNameEscaped := url.QueryEscape(auditsyslogpolicyName) - if hasChange { - _, err := client.UpdateResource(service.Auditsyslogpolicy.Type(), auditsyslogpolicyNameEscaped, &auditsyslogpolicy) + _, err := client.UpdateResource(service.Auditsyslogpolicy.Type(), auditsyslogpolicyName, &auditsyslogpolicy) if err != nil { return fmt.Errorf("Error updating auditsyslogpolicy %s: %s", auditsyslogpolicyName, err.Error()) } @@ -197,8 +194,6 @@ func deleteAuditsyslogpolicyFunc(d *schema.ResourceData, meta interface{}) error client := meta.(*NetScalerNitroClient).client auditsyslogpolicyName := d.Id() - auditsyslogpolicyNameEscaped := url.QueryEscape(auditsyslogpolicyName) - // Unbind from global if appropriate if v, ok := d.GetOk("globalbinding"); ok { // There is only one element @@ -209,7 +204,7 @@ func deleteAuditsyslogpolicyFunc(d *schema.ResourceData, meta interface{}) error } } - err := client.DeleteResource(service.Auditsyslogpolicy.Type(), auditsyslogpolicyNameEscaped) + err := client.DeleteResource(service.Auditsyslogpolicy.Type(), auditsyslogpolicyName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_channel.go b/citrixadc/resource_citrixadc_channel.go index a7cac2afc..48f9c96a7 100644 --- a/citrixadc/resource_citrixadc_channel.go +++ b/citrixadc/resource_citrixadc_channel.go @@ -8,7 +8,6 @@ import ( "fmt" "log" - "net/url" ) func resourceCitrixAdcChannel() *schema.Resource { @@ -175,7 +174,7 @@ func readChannelFunc(d *schema.ResourceData, meta interface{}) error { client := meta.(*NetScalerNitroClient).client channelName := d.Id() log.Printf("[DEBUG] citrixadc-provider: Reading channel state %s", channelName) - data, err := client.FindResource(service.Channel.Type(), url.QueryEscape(url.QueryEscape(channelName))) + data, err := client.FindResource(service.Channel.Type(), channelName) if err != nil { log.Printf("[WARN] citrixadc-provider: Clearing channel state %s", channelName) d.SetId("") @@ -326,7 +325,7 @@ func deleteChannelFunc(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] citrixadc-provider: In deleteChannelFunc") client := meta.(*NetScalerNitroClient).client channelName := d.Id() - err := client.DeleteResource(service.Channel.Type(), url.QueryEscape(url.QueryEscape(channelName))) + err := client.DeleteResource(service.Channel.Type(), channelName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_channel_test.go b/citrixadc/resource_citrixadc_channel_test.go index bb1fea1b4..70a0e9e29 100644 --- a/citrixadc/resource_citrixadc_channel_test.go +++ b/citrixadc/resource_citrixadc_channel_test.go @@ -20,7 +20,6 @@ import ( "github.com/citrix/adc-nitro-go/service" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" - "net/url" "testing" ) @@ -91,7 +90,7 @@ func testAccCheckChannelExist(n string, id *string) resource.TestCheckFunc { } nsClient := testAccProvider.Meta().(*NetScalerNitroClient).client - data, err := nsClient.FindResource(service.Channel.Type(), url.QueryEscape(url.QueryEscape(rs.Primary.ID))) + data, err := nsClient.FindResource(service.Channel.Type(), rs.Primary.ID) if err != nil { return err @@ -117,7 +116,7 @@ func testAccCheckChannelDestroy(s *terraform.State) error { return fmt.Errorf("No name is set") } - _, err := nsClient.FindResource(service.Channel.Type(), url.QueryEscape(url.QueryEscape(rs.Primary.ID))) + _, err := nsClient.FindResource(service.Channel.Type(), rs.Primary.ID) if err == nil { return fmt.Errorf("channel %s still exists", rs.Primary.ID) } diff --git a/citrixadc/resource_citrixadc_gslbservicegroup_gslbservicegroupmember_binding_test.go b/citrixadc/resource_citrixadc_gslbservicegroup_gslbservicegroupmember_binding_test.go index 2920738b1..66900b546 100644 --- a/citrixadc/resource_citrixadc_gslbservicegroup_gslbservicegroupmember_binding_test.go +++ b/citrixadc/resource_citrixadc_gslbservicegroup_gslbservicegroupmember_binding_test.go @@ -41,10 +41,14 @@ const testAccGslbservicegroup_gslbservicegroupmember_binding_basic = ` siteipaddress = "172.31.96.234" sessionexchange = "DISABLED" } + resource "citrixadc_server" "tf_server" { + name = "tf_server" + ipaddress = "192.168.11.13" + } resource "citrixadc_gslbservicegroup_gslbservicegroupmember_binding" "tf_binding" { servicegroupname = citrixadc_gslbservicegroup.tf_gslbservicegroup.servicegroupname - servername = "10.10.10.10" + servername = citrixadc_server.tf_server.name port = 60 } @@ -65,6 +69,10 @@ const testAccGslbservicegroup_gslbservicegroupmember_binding_basic_step2 = ` siteipaddress = "172.31.96.234" sessionexchange = "DISABLED" } + resource "citrixadc_server" "tf_server" { + name = "tf_server" + ipaddress = "192.168.11.13" + } ` func TestAccGslbservicegroup_gslbservicegroupmember_binding_basic(t *testing.T) { diff --git a/citrixadc/resource_citrixadc_hanode_routemonitor6_binding_test.go b/citrixadc/resource_citrixadc_hanode_routemonitor6_binding_test.go index b25b48b73..1c4c411ac 100644 --- a/citrixadc/resource_citrixadc_hanode_routemonitor6_binding_test.go +++ b/citrixadc/resource_citrixadc_hanode_routemonitor6_binding_test.go @@ -49,6 +49,7 @@ const testAccHanode_routemonitor6_binding_basic_step2 = ` ` func TestAccHanode_routemonitor6_binding_basic(t *testing.T) { + t.Skip("TODO: Need to find a way to test this resource!") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, diff --git a/citrixadc/resource_citrixadc_linkset.go b/citrixadc/resource_citrixadc_linkset.go index ec9596177..487129c29 100644 --- a/citrixadc/resource_citrixadc_linkset.go +++ b/citrixadc/resource_citrixadc_linkset.go @@ -69,10 +69,7 @@ func readLinksetFunc(d *schema.ResourceData, meta interface{}) error { client := meta.(*NetScalerNitroClient).client linksetName := d.Id() log.Printf("[DEBUG] citrixadc-provider: Reading linkset state %s", linksetName) - // double encode value part as it contains `/` - //linksetNameEscaped := url.QueryEscape(url.QueryEscape(linksetName)) - linksetNameEscaped := url.PathEscape(url.QueryEscape(linksetName)) - data, err := client.FindResource(service.Linkset.Type(), linksetNameEscaped) + data, err := client.FindResource(service.Linkset.Type(), linksetName) err = readLinksetInterfaceBindings(d, meta) if err != nil { @@ -89,9 +86,7 @@ func deleteLinksetFunc(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] citrixadc-provider: In deleteLinksetFunc") client := meta.(*NetScalerNitroClient).client linksetName := d.Id() - // double encode value part as it contains `/` - linksetNameEscaped := url.QueryEscape(url.QueryEscape(linksetName)) - err := client.DeleteResource(service.Linkset.Type(), linksetNameEscaped) + err := client.DeleteResource(service.Linkset.Type(), linksetName) if err != nil { return err } @@ -114,9 +109,8 @@ func deleteSingleLinksetInterfaceBinding(d *schema.ResourceData, meta interface{ args = append(args, s) log.Printf("args is %v", args) - linksetNameEscaped := url.QueryEscape(url.QueryEscape(linksetName)) - if err := client.DeleteResourceWithArgs(service.Linkset_interface_binding.Type(), linksetNameEscaped, args); err != nil { + if err := client.DeleteResourceWithArgs(service.Linkset_interface_binding.Type(), linksetName, args); err != nil { log.Printf("[DEBUG] citrixadc-provider: Error deleting interface binding %v\n", ifnum) return err } @@ -164,10 +158,8 @@ func readLinksetInterfaceBindings(d *schema.ResourceData, meta interface{}) erro log.Printf("[DEBUG] citrixadc-provider: In readLinksetInterfaceBindings") client := meta.(*NetScalerNitroClient).client linksetName := d.Get("linkset_id").(string) - // double encode value part as it contains `/` - linksetNameEscaped := url.QueryEscape(url.QueryEscape(linksetName)) - bindings, _ := client.FindResourceArray(service.Linkset_interface_binding.Type(), linksetNameEscaped) + bindings, _ := client.FindResourceArray(service.Linkset_interface_binding.Type(), linksetName) log.Printf("bindings %v\n", bindings) processedBindings := make([]interface{}, len(bindings)) diff --git a/citrixadc/resource_citrixadc_linkset_channel_binding.go b/citrixadc/resource_citrixadc_linkset_channel_binding.go index ec8ae3efc..067169d97 100644 --- a/citrixadc/resource_citrixadc_linkset_channel_binding.go +++ b/citrixadc/resource_citrixadc_linkset_channel_binding.go @@ -133,7 +133,7 @@ func deleteLinkset_channel_bindingFunc(d *schema.ResourceData, meta interface{}) args := make([]string, 0) args = append(args, fmt.Sprintf("ifnum:%v", url.QueryEscape(ifnum))) - err := client.DeleteResourceWithArgs(service.Linkset_channel_binding.Type(), url.QueryEscape(url.QueryEscape(name)), args) + err := client.DeleteResourceWithArgs(service.Linkset_channel_binding.Type(), name, args) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_linkset_channel_binding_test.go b/citrixadc/resource_citrixadc_linkset_channel_binding_test.go index 9f6f13e68..b889ef7ac 100644 --- a/citrixadc/resource_citrixadc_linkset_channel_binding_test.go +++ b/citrixadc/resource_citrixadc_linkset_channel_binding_test.go @@ -186,7 +186,7 @@ func testAccCheckLinkset_channel_bindingDestroy(s *terraform.State) error { return fmt.Errorf("No name is set") } - _, err := nsClient.FindResource(service.Linkset_channel_binding.Type(), url.QueryEscape(url.QueryEscape(rs.Primary.ID))) + _, err := nsClient.FindResource(service.Linkset_channel_binding.Type(), rs.Primary.ID) if err == nil { return fmt.Errorf("linkset_channel_binding %s still exists", rs.Primary.ID) } diff --git a/citrixadc/resource_citrixadc_onlinkipv6prefix.go b/citrixadc/resource_citrixadc_onlinkipv6prefix.go index 915839d12..edc17331b 100644 --- a/citrixadc/resource_citrixadc_onlinkipv6prefix.go +++ b/citrixadc/resource_citrixadc_onlinkipv6prefix.go @@ -8,7 +8,6 @@ import ( "fmt" "log" - "net/url" ) func resourceCitrixAdcOnlinkipv6prefix() *schema.Resource { @@ -96,7 +95,7 @@ func readOnlinkipv6prefixFunc(d *schema.ResourceData, meta interface{}) error { client := meta.(*NetScalerNitroClient).client onlinkipv6prefixName := d.Id() log.Printf("[DEBUG] citrixadc-provider: Reading onlinkipv6prefix state %s", onlinkipv6prefixName) - data, err := client.FindResource(service.Onlinkipv6prefix.Type(), url.QueryEscape(url.QueryEscape(onlinkipv6prefixName))) + data, err := client.FindResource(service.Onlinkipv6prefix.Type(), onlinkipv6prefixName) if err != nil { log.Printf("[WARN] citrixadc-provider: Clearing onlinkipv6prefix state %s", onlinkipv6prefixName) d.SetId("") @@ -168,7 +167,7 @@ func deleteOnlinkipv6prefixFunc(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] citrixadc-provider: In deleteOnlinkipv6prefixFunc") client := meta.(*NetScalerNitroClient).client onlinkipv6prefixName := d.Id() - err := client.DeleteResource(service.Onlinkipv6prefix.Type(), url.QueryEscape(url.QueryEscape(onlinkipv6prefixName))) + err := client.DeleteResource(service.Onlinkipv6prefix.Type(), onlinkipv6prefixName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_onlinkipv6prefix_test.go b/citrixadc/resource_citrixadc_onlinkipv6prefix_test.go index 666f7bd24..145aa9c85 100644 --- a/citrixadc/resource_citrixadc_onlinkipv6prefix_test.go +++ b/citrixadc/resource_citrixadc_onlinkipv6prefix_test.go @@ -20,7 +20,6 @@ import ( "github.com/citrix/adc-nitro-go/service" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" - "net/url" "testing" ) @@ -89,7 +88,7 @@ func testAccCheckOnlinkipv6prefixExist(n string, id *string) resource.TestCheckF } nsClient := testAccProvider.Meta().(*NetScalerNitroClient).client - data, err := nsClient.FindResource(service.Onlinkipv6prefix.Type(), url.QueryEscape(url.QueryEscape(rs.Primary.ID))) + data, err := nsClient.FindResource(service.Onlinkipv6prefix.Type(), rs.Primary.ID) if err != nil { return err diff --git a/citrixadc/resource_citrixadc_radiusnode.go b/citrixadc/resource_citrixadc_radiusnode.go index 5b06a71d2..30c3b9840 100644 --- a/citrixadc/resource_citrixadc_radiusnode.go +++ b/citrixadc/resource_citrixadc_radiusnode.go @@ -7,7 +7,6 @@ import ( "fmt" "log" - "net/url" ) func resourceCitrixAdcRadiusnode() *schema.Resource { @@ -62,8 +61,7 @@ func readRadiusnodeFunc(d *schema.ResourceData, meta interface{}) error { client := meta.(*NetScalerNitroClient).client radiusnodeName := d.Id() log.Printf("[DEBUG] citrixadc-provider: Reading radiusnode state %s", radiusnodeName) - radiusnodeescaped := url.PathEscape(url.QueryEscape(radiusnodeName)) - data, err := client.FindResource("radiusnode", radiusnodeescaped) + data, err := client.FindResource("radiusnode", radiusnodeName) if err != nil { log.Printf("[WARN] citrixadc-provider: Clearing radiusnode state %s", radiusnodeName) d.SetId("") @@ -80,7 +78,6 @@ func updateRadiusnodeFunc(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] citrixadc-provider: In updateRadiusnodeFunc") client := meta.(*NetScalerNitroClient).client radiusnodeName := d.Get("nodeprefix").(string) - radiusnodeescaped := url.PathEscape(url.QueryEscape(radiusnodeName)) radiusnode := basic.Radiusnode{ Nodeprefix: d.Get("nodeprefix").(string), @@ -93,7 +90,7 @@ func updateRadiusnodeFunc(d *schema.ResourceData, meta interface{}) error { } if hasChange { - _, err := client.UpdateResource("radiusnode", radiusnodeescaped, &radiusnode) + _, err := client.UpdateResource("radiusnode", radiusnodeName, &radiusnode) if err != nil { return fmt.Errorf("Error updating radiusnode %s", radiusnodeName) } @@ -105,7 +102,7 @@ func deleteRadiusnodeFunc(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] citrixadc-provider: In deleteRadiusnodeFunc") client := meta.(*NetScalerNitroClient).client radiusnodeName := d.Id() - err := client.DeleteResource("radiusnode", url.QueryEscape(url.QueryEscape(radiusnodeName))) + err := client.DeleteResource("radiusnode", radiusnodeName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_radiusnode_test.go b/citrixadc/resource_citrixadc_radiusnode_test.go index 536546a60..fd6e27d4b 100644 --- a/citrixadc/resource_citrixadc_radiusnode_test.go +++ b/citrixadc/resource_citrixadc_radiusnode_test.go @@ -19,7 +19,6 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" - "net/url" "testing" ) @@ -67,7 +66,7 @@ func testAccCheckRadiusnodeExist(n string, id *string) resource.TestCheckFunc { } nsClient := testAccProvider.Meta().(*NetScalerNitroClient).client - data, err := nsClient.FindResource("radiusnode", url.PathEscape(url.QueryEscape(rs.Primary.ID))) + data, err := nsClient.FindResource("radiusnode", rs.Primary.ID) if err != nil { return err @@ -93,7 +92,7 @@ func testAccCheckRadiusnodeDestroy(s *terraform.State) error { return fmt.Errorf("No name is set") } - _, err := nsClient.FindResource("radiusnode", url.PathEscape(url.QueryEscape(rs.Primary.ID))) + _, err := nsClient.FindResource("radiusnode", rs.Primary.ID) if err == nil { return fmt.Errorf("radiusnode %s still exists", rs.Primary.ID) } diff --git a/citrixadc/resource_citrixadc_systemfile.go b/citrixadc/resource_citrixadc_systemfile.go index c723d0ee2..18c46e42c 100644 --- a/citrixadc/resource_citrixadc_systemfile.go +++ b/citrixadc/resource_citrixadc_systemfile.go @@ -150,7 +150,7 @@ func deleteSystemfileFunc(d *schema.ResourceData, meta interface{}) error { client := meta.(*NetScalerNitroClient).client argsMap := make(map[string]string) argsMap["filelocation"] = url.QueryEscape(d.Get("filelocation").(string)) - filename := url.PathEscape(d.Get("filename").(string)) + filename := d.Get("filename").(string) err := client.DeleteResourceWithArgsMap("systemfile", filename, argsMap) if err != nil { return err diff --git a/citrixadc/resource_citrixadc_videooptimizationdetectionaction.go b/citrixadc/resource_citrixadc_videooptimizationdetectionaction.go index a7df6b1b7..80b996739 100644 --- a/citrixadc/resource_citrixadc_videooptimizationdetectionaction.go +++ b/citrixadc/resource_citrixadc_videooptimizationdetectionaction.go @@ -7,7 +7,6 @@ import ( "fmt" "log" - "net/url" ) func resourceCitrixAdcVideooptimizationdetectionaction() *schema.Resource { @@ -72,9 +71,8 @@ func readVideooptimizationdetectionactionFunc(d *schema.ResourceData, meta inter log.Printf("[DEBUG] citrixadc-provider: In readVideooptimizationdetectionactionFunc") client := meta.(*NetScalerNitroClient).client videooptimizationdetectionactionName := d.Id() - videooptimizationdetectionactionName_pathescaped := url.PathEscape(videooptimizationdetectionactionName) log.Printf("[DEBUG] citrixadc-provider: Reading videooptimizationdetectionaction state %s", videooptimizationdetectionactionName) - data, err := client.FindResource("videooptimizationdetectionaction", videooptimizationdetectionactionName_pathescaped) + data, err := client.FindResource("videooptimizationdetectionaction", videooptimizationdetectionactionName) if err != nil { log.Printf("[WARN] citrixadc-provider: Clearing videooptimizationdetectionaction state %s", videooptimizationdetectionactionName) d.SetId("") @@ -94,7 +92,6 @@ func updateVideooptimizationdetectionactionFunc(d *schema.ResourceData, meta int log.Printf("[DEBUG] citrixadc-provider: In updateVideooptimizationdetectionactionFunc") client := meta.(*NetScalerNitroClient).client videooptimizationdetectionactionName := d.Get("name").(string) - videooptimizationdetectionactionName_pathescaped := url.PathEscape(videooptimizationdetectionactionName) videooptimizationdetectionaction := videooptimization.Videooptimizationdetectionaction{ Name: d.Get("name").(string), @@ -117,7 +114,7 @@ func updateVideooptimizationdetectionactionFunc(d *schema.ResourceData, meta int } if hasChange { - _, err := client.UpdateResource("videooptimizationdetectionaction", videooptimizationdetectionactionName_pathescaped, &videooptimizationdetectionaction) + _, err := client.UpdateResource("videooptimizationdetectionaction", videooptimizationdetectionactionName, &videooptimizationdetectionaction) if err != nil { return fmt.Errorf("Error updating videooptimizationdetectionaction %s", videooptimizationdetectionactionName) } @@ -129,8 +126,7 @@ func deleteVideooptimizationdetectionactionFunc(d *schema.ResourceData, meta int log.Printf("[DEBUG] citrixadc-provider: In deleteVideooptimizationdetectionactionFunc") client := meta.(*NetScalerNitroClient).client videooptimizationdetectionactionName := d.Id() - videooptimizationdetectionactionName_pathescaped := url.PathEscape(videooptimizationdetectionactionName) - err := client.DeleteResource("videooptimizationdetectionaction", videooptimizationdetectionactionName_pathescaped) + err := client.DeleteResource("videooptimizationdetectionaction", videooptimizationdetectionactionName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_videooptimizationdetectionpolicy.go b/citrixadc/resource_citrixadc_videooptimizationdetectionpolicy.go index 8aafb3a3b..694e0cd2c 100644 --- a/citrixadc/resource_citrixadc_videooptimizationdetectionpolicy.go +++ b/citrixadc/resource_citrixadc_videooptimizationdetectionpolicy.go @@ -7,7 +7,6 @@ import ( "fmt" "log" - "net/url" ) func resourceCitrixAdcVideooptimizationdetectionpolicy() *schema.Resource { @@ -90,9 +89,8 @@ func readVideooptimizationdetectionpolicyFunc(d *schema.ResourceData, meta inter log.Printf("[DEBUG] citrixadc-provider: In readVideooptimizationdetectionpolicyFunc") client := meta.(*NetScalerNitroClient).client videooptimizationdetectionpolicyName := d.Id() - videooptimizationdetectionpolicyName_pathescaped := url.PathEscape(videooptimizationdetectionpolicyName) log.Printf("[DEBUG] citrixadc-provider: Reading videooptimizationdetectionpolicy state %s", videooptimizationdetectionpolicyName) - data, err := client.FindResource("videooptimizationdetectionpolicy", videooptimizationdetectionpolicyName_pathescaped) + data, err := client.FindResource("videooptimizationdetectionpolicy", videooptimizationdetectionpolicyName) if err != nil { log.Printf("[WARN] citrixadc-provider: Clearing videooptimizationdetectionpolicy state %s", videooptimizationdetectionpolicyName) d.SetId("") @@ -115,7 +113,6 @@ func updateVideooptimizationdetectionpolicyFunc(d *schema.ResourceData, meta int log.Printf("[DEBUG] citrixadc-provider: In updateVideooptimizationdetectionpolicyFunc") client := meta.(*NetScalerNitroClient).client videooptimizationdetectionpolicyName := d.Get("name").(string) - videooptimizationdetectionpolicyName_pathescaped := url.PathEscape(videooptimizationdetectionpolicyName) videooptimizationdetectionpolicy := videooptimization.Videooptimizationdetectionpolicy{ Name: d.Get("name").(string), @@ -158,7 +155,7 @@ func updateVideooptimizationdetectionpolicyFunc(d *schema.ResourceData, meta int } if hasChange { - _, err := client.UpdateResource("videooptimizationdetectionpolicy", videooptimizationdetectionpolicyName_pathescaped, &videooptimizationdetectionpolicy) + _, err := client.UpdateResource("videooptimizationdetectionpolicy", videooptimizationdetectionpolicyName, &videooptimizationdetectionpolicy) if err != nil { return fmt.Errorf("Error updating videooptimizationdetectionpolicy %s", videooptimizationdetectionpolicyName) } @@ -170,8 +167,7 @@ func deleteVideooptimizationdetectionpolicyFunc(d *schema.ResourceData, meta int log.Printf("[DEBUG] citrixadc-provider: In deleteVideooptimizationdetectionpolicyFunc") client := meta.(*NetScalerNitroClient).client videooptimizationdetectionpolicyName := d.Id() - videooptimizationdetectionpolicyName_pathescaped := url.PathEscape(videooptimizationdetectionpolicyName) - err := client.DeleteResource("videooptimizationdetectionpolicy", videooptimizationdetectionpolicyName_pathescaped) + err := client.DeleteResource("videooptimizationdetectionpolicy", videooptimizationdetectionpolicyName) if err != nil { return err } diff --git a/citrixadc/resource_citrixadc_vpnglobal_appcontroller_binding.go b/citrixadc/resource_citrixadc_vpnglobal_appcontroller_binding.go index a9eaa47ae..b779a7cc7 100644 --- a/citrixadc/resource_citrixadc_vpnglobal_appcontroller_binding.go +++ b/citrixadc/resource_citrixadc_vpnglobal_appcontroller_binding.go @@ -38,7 +38,7 @@ func resourceCitrixAdcVpnglobal_appcontroller_binding() *schema.Resource { func createVpnglobal_appcontroller_bindingFunc(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] citrixadc-provider: In createVpnglobal_appcontroller_bindingFunc") client := meta.(*NetScalerNitroClient).client - appcontroller := url.QueryEscape(d.Get("appcontroller").(string)) + appcontroller := d.Get("appcontroller").(string) vpnglobal_appcontroller_binding := vpn.Vpnglobalappcontrollerbinding{ Appcontroller: d.Get("appcontroller").(string), Gotopriorityexpression: d.Get("gotopriorityexpression").(string),