Skip to content

Commit

Permalink
Merge pull request #1155 from citrix/1151-feature-request-add-missing…
Browse files Browse the repository at this point in the history
…-order-parameter-to-gslbservicegroup-bindings

1151 feature request add missing order parameter to gslbservicegroup bindings
  • Loading branch information
sumanth-lingappa authored May 10, 2024
2 parents a4f2c07 + 25c2956 commit 5c93452
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ func resourceCitrixAdcGslbservicegroup_gslbservicegroupmember_binding() *schema.
Computed: true,
ForceNew: true,
},
"order": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
ForceNew: true,
},
},
}
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ func resourceCitrixAdcGslbvserver_gslbservice_binding() *schema.Resource {
Computed: true,
ForceNew: true,
},
"order": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
ForceNew: true,
},
},
}
}
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ func resourceCitrixAdcGslbvserver_gslbservicegroup_binding() *schema.Resource {
Required: true,
ForceNew: true,
},
"order": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
ForceNew: true,
},
},
}
}
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions citrixadc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,18 @@ 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

switch valueTyped := value.(type) {
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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c93452

Please sign in to comment.