From 50d5d58ef507f88cfcdc847591e8e850124f890c Mon Sep 17 00:00:00 2001 From: Rohit Myali Date: Wed, 8 May 2024 12:30:15 +0530 Subject: [PATCH 1/2] Updated vendor directory to fetch latest adc-nitro-go changes to gslb resource Signed-off-by: Rohit Myali --- go.mod | 2 +- go.sum | 4 ++-- .../gslb/gslbservicegroup_gslbservicegroupmember_binding.go | 4 ++++ .../config/gslb/gslbservicegroup_lbmonitor_binding.go | 4 ++++ .../resource/config/gslb/gslbvserver_domain_binding.go | 4 ++++ .../resource/config/gslb/gslbvserver_gslbservice_binding.go | 4 ++++ .../config/gslb/gslbvserver_gslbservicegroup_binding.go | 4 ++++ .../config/gslb/gslbvserver_spilloverpolicy_binding.go | 4 ++++ vendor/modules.txt | 2 +- 9 files changed, 28 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index cba2e9f17..9dbdaa5b7 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-20240418055406-f56b8450e153 + github.com/citrix/adc-nitro-go v0.0.0-20240508064526-011d10c8e5b4 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 543006167..45607cbe9 100644 --- a/go.sum +++ b/go.sum @@ -237,8 +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-20240418055406-f56b8450e153 h1:vT0JNCh29/zux1TcIO0acg/1tCWrRtMlW8962Qy6PqI= -github.com/citrix/adc-nitro-go v0.0.0-20240418055406-f56b8450e153/go.mod h1:DL1n+MgO15981ahrt+CsQVv43yyUrTdigPq3dIxydD8= +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/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/resource/config/gslb/gslbservicegroup_gslbservicegroupmember_binding.go b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbservicegroup_gslbservicegroupmember_binding.go index 9b1be3d86..ca543d199 100644 --- a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbservicegroup_gslbservicegroupmember_binding.go +++ b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbservicegroup_gslbservicegroupmember_binding.go @@ -89,6 +89,10 @@ type Gslbservicegroupgslbservicegroupmemberbinding struct { * Name of the GSLB service group. */ Servicegroupname string `json:"servicegroupname,omitempty"` + /** + * Order number to be assigned to the gslb servicegroup member. + */ + Order int `json:"order,omitempty"` } \ No newline at end of file diff --git a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbservicegroup_lbmonitor_binding.go b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbservicegroup_lbmonitor_binding.go index d6a4c891d..b67749502 100644 --- a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbservicegroup_lbmonitor_binding.go +++ b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbservicegroup_lbmonitor_binding.go @@ -68,6 +68,10 @@ type Gslbservicegrouplbmonitorbinding struct { * The site's prefix string. When the GSLB service group is bound to a GSLB virtual server, a GSLB site domain is generated internally for each bound serviceitem-domain pair by concatenating the site prefix of the service item and the name of the domain. If the special string NONE is specified, the site-prefix string is unset. When implementing HTTP redirect site persistence, the Citrix ADC redirects GSLB requests to GSLB services by using their site domains. */ Siteprefix string `json:"siteprefix,omitempty"` + /** + * Order number to be assigned to the gslb servicegroup member. + */ + Order int `json:"order,omitempty"` } \ No newline at end of file diff --git a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_domain_binding.go b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_domain_binding.go index f558a3638..27ac53cb8 100644 --- a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_domain_binding.go +++ b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_domain_binding.go @@ -56,6 +56,10 @@ type Gslbvserverdomainbinding struct { * The cookie domain for the GSLB site. Used when inserting the GSLB site cookie in the HTTP response. */ Cookiedomainflag bool `json:"cookie_domainflag,omitempty"` + /** + * Order number to be assigned to the service when it is bound to the lb vserver. + */ + Order int `json:"order,omitempty"` } \ No newline at end of file diff --git a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_gslbservice_binding.go b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_gslbservice_binding.go index 1cb36b10a..307bd7251 100644 --- a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_gslbservice_binding.go +++ b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_gslbservice_binding.go @@ -92,6 +92,10 @@ type Gslbvservergslbservicebinding struct { * Name of the virtual server on which to perform the binding operation. */ Name string `json:"name,omitempty"` + /** + * Order number to be assigned to the service when it is bound to the lb vserver. + */ + Order int `json:"order,omitempty"` } \ No newline at end of file diff --git a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_gslbservicegroup_binding.go b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_gslbservicegroup_binding.go index 503f88cb7..014edfed4 100644 --- a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_gslbservicegroup_binding.go +++ b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_gslbservicegroup_binding.go @@ -28,6 +28,10 @@ type Gslbvservergslbservicegroupbinding struct { * Name of the virtual server on which to perform the binding operation. */ Name string `json:"name,omitempty"` + /** + * Order number to be assigned to the service when it is bound to the lb vserver. + */ + Order int `json:"order,omitempty"` } \ No newline at end of file diff --git a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_spilloverpolicy_binding.go b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_spilloverpolicy_binding.go index 3ae02b014..8b127f5c3 100644 --- a/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_spilloverpolicy_binding.go +++ b/vendor/github.com/citrix/adc-nitro-go/resource/config/gslb/gslbvserver_spilloverpolicy_binding.go @@ -50,6 +50,10 @@ type Gslbvserverspilloverpolicybinding struct { * Name of the virtual server on which to perform the binding operation. */ Name string `json:"name,omitempty"` + /** + * Order number to be assigned to the service when it is bound to the lb vserver. + */ + Order int `json:"order,omitempty"` } \ No newline at end of file diff --git a/vendor/modules.txt b/vendor/modules.txt index 8ee116e50..fe75f3f8b 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-20240418055406-f56b8450e153 +# github.com/citrix/adc-nitro-go v0.0.0-20240508064526-011d10c8e5b4 ## explicit; go 1.14 github.com/citrix/adc-nitro-go/resource/config/aaa github.com/citrix/adc-nitro-go/resource/config/adm From 25c29567e6516ee0deb1b56090efc9cde914b1ed Mon Sep 17 00:00:00 2001 From: Rohit Myali Date: Thu, 9 May 2024 11:47:53 +0530 Subject: [PATCH 2/2] Supported 'order' attribute to gslb binding resources Signed-off-by: Rohit Myali --- ..._gslbservicegroup_gslbservicegroupmember_binding.go | 10 +++++++++- ...source_citrixadc_gslbvserver_gslbservice_binding.go | 8 ++++++++ ...e_citrixadc_gslbvserver_gslbservicegroup_binding.go | 8 ++++++++ citrixadc/utils.go | 6 ++++-- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/citrixadc/resource_citrixadc_gslbservicegroup_gslbservicegroupmember_binding.go b/citrixadc/resource_citrixadc_gslbservicegroup_gslbservicegroupmember_binding.go index ac5c8064d..749b6e09f 100644 --- a/citrixadc/resource_citrixadc_gslbservicegroup_gslbservicegroupmember_binding.go +++ b/citrixadc/resource_citrixadc_gslbservicegroup_gslbservicegroupmember_binding.go @@ -82,6 +82,12 @@ func resourceCitrixAdcGslbservicegroup_gslbservicegroupmember_binding() *schema. Computed: true, ForceNew: true, }, + "order": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ForceNew: true, + }, }, } } @@ -121,6 +127,7 @@ func createGslbservicegroup_gslbservicegroupmember_bindingFunc(d *schema.Resourc Siteprefix: d.Get("siteprefix").(string), State: d.Get("state").(string), Weight: d.Get("weight").(int), + Order: d.Get("order").(int), } _, err := client.AddResource("gslbservicegroup_gslbservicegroupmember_binding", bindingId, &gslbservicegroup_gslbservicegroupmember_binding) @@ -209,7 +216,8 @@ func readGslbservicegroup_gslbservicegroupmember_bindingFunc(d *schema.ResourceD d.Set("servicegroupname", data["servicegroupname"]) d.Set("siteprefix", data["siteprefix"]) d.Set("state", data["state"]) - d.Set("weight", data["weight"]) + setToInt("weight", d, data["weight"]) + setToInt("order", d, data["order"]) return nil diff --git a/citrixadc/resource_citrixadc_gslbvserver_gslbservice_binding.go b/citrixadc/resource_citrixadc_gslbvserver_gslbservice_binding.go index a9e17f207..30e7267a5 100644 --- a/citrixadc/resource_citrixadc_gslbvserver_gslbservice_binding.go +++ b/citrixadc/resource_citrixadc_gslbvserver_gslbservice_binding.go @@ -42,6 +42,12 @@ func resourceCitrixAdcGslbvserver_gslbservice_binding() *schema.Resource { Computed: true, ForceNew: true, }, + "order": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ForceNew: true, + }, }, } } @@ -58,6 +64,7 @@ func createGslbvserver_gslbservice_bindingFunc(d *schema.ResourceData, meta inte Name: d.Get("name").(string), Servicename: d.Get("servicename").(string), Weight: d.Get("weight").(int), + Order: d.Get("order").(int), } err := client.UpdateUnnamedResource(service.Gslbvserver_gslbservice_binding.Type(), &gslbvserver_gslbservice_binding) @@ -131,6 +138,7 @@ func readGslbvserver_gslbservice_bindingFunc(d *schema.ResourceData, meta interf d.Set("name", data["name"]) d.Set("servicename", data["servicename"]) setToInt("weight", d, data["weight"]) + setToInt("order", d, data["order"]) return nil diff --git a/citrixadc/resource_citrixadc_gslbvserver_gslbservicegroup_binding.go b/citrixadc/resource_citrixadc_gslbvserver_gslbservicegroup_binding.go index 2febb7eab..6a7bc4cd6 100644 --- a/citrixadc/resource_citrixadc_gslbvserver_gslbservicegroup_binding.go +++ b/citrixadc/resource_citrixadc_gslbvserver_gslbservicegroup_binding.go @@ -30,6 +30,12 @@ func resourceCitrixAdcGslbvserver_gslbservicegroup_binding() *schema.Resource { Required: true, ForceNew: true, }, + "order": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ForceNew: true, + }, }, } } @@ -44,6 +50,7 @@ func createGslbvserver_gslbservicegroup_bindingFunc(d *schema.ResourceData, meta gslbvserver_gslbservicegroup_binding := gslb.Gslbvservergslbservicegroupbinding{ Name: d.Get("name").(string), Servicegroupname: d.Get("servicegroupname").(string), + Order: d.Get("order").(int), } err := client.UpdateUnnamedResource("gslbvserver_gslbservicegroup_binding", &gslbvserver_gslbservicegroup_binding) @@ -115,6 +122,7 @@ func readGslbvserver_gslbservicegroup_bindingFunc(d *schema.ResourceData, meta i d.Set("name", data["name"]) d.Set("servicegroupname", data["servicegroupname"]) + setToInt("order", d, data["order"]) return nil diff --git a/citrixadc/utils.go b/citrixadc/utils.go index db7137e98..9e6a920fc 100644 --- a/citrixadc/utils.go +++ b/citrixadc/utils.go @@ -53,6 +53,8 @@ func stringListToIntList(in []interface{}) []int { // Check if the attribute is int, if not convert to int and set the value func setToInt(attributeName string, d *schema.ResourceData, value interface{}) { + log.Printf("[DEBUG] netscaler-provider: In setToInt for attribute %s", attributeName) + var v int var err error @@ -60,9 +62,9 @@ func setToInt(attributeName string, d *schema.ResourceData, value interface{}) { case int: v = valueTyped case string: - v, _ = strconv.Atoi(valueTyped) + v, err = strconv.Atoi(valueTyped) case nil: - v = 0 + return default: log.Printf("[DEBUG] got unexpected type %T for int", value) return