Skip to content

Commit

Permalink
Added sslpolicy bindings for sslvserver
Browse files Browse the repository at this point in the history
Signed-off-by: George Nikolopoulos <[email protected]>
  • Loading branch information
George Nikolopoulos committed Apr 27, 2020
1 parent c5be8b5 commit bbd900d
Show file tree
Hide file tree
Showing 6 changed files with 761 additions and 0 deletions.
60 changes: 60 additions & 0 deletions citrixadc/resource_citrixadc_csvserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,51 @@ func resourceCitrixAdcCsvserver() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"sslpolicybinding": {
Type: schema.TypeSet,
Optional: true,
Computed: false,
Set: sslpolicybindingMappingHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"gotopriorityexpression": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"invoke": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
"labelname": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"labeltype": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"policyname": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"priority": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"type": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
},
},
},
},
}
}
Expand Down Expand Up @@ -556,6 +601,11 @@ func createCsvserverFunc(d *schema.ResourceData, meta interface{}) error {
log.Printf("[DEBUG] netscaler-provider: lbvserver %s has been bound to csvserver %s", lbVserverName, csvserverName)
}

// update sslpolicy bindings
if err := updateSslpolicyBindings(d, meta, csvserverName); err != nil {
return err
}

d.SetId(csvserverName)

err = readCsvserverFunc(d, meta)
Expand Down Expand Up @@ -647,6 +697,10 @@ func readCsvserverFunc(d *schema.ResourceData, meta interface{}) error {
return err
}

if err := readSslpolicyBindings(d, meta, csvserverName); err != nil {
return err
}

dataSsl, _ := client.FindResource(netscaler.Sslvserver.Type(), csvserverName)
d.Set("sslprofile", dataSsl["sslprofile"])

Expand Down Expand Up @@ -1149,6 +1203,12 @@ func updateCsvserverFunc(d *schema.ResourceData, meta interface{}) error {
}
}

if d.HasChange("sslpolicybinding") {
if err := updateSslpolicyBindings(d, meta, csvserverName); err != nil {
return err
}
}

if stateChange {
err := doCsvserverStateChange(d, client)
if err != nil {
Expand Down
Loading

0 comments on commit bbd900d

Please sign in to comment.