Skip to content

Commit

Permalink
Read Method Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ramaniprateek committed Jan 31, 2024
1 parent 827e046 commit d2ea11c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
21 changes: 16 additions & 5 deletions bigip/resource_bigip_as3.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,17 @@ func resourceBigipAs3Read(ctx context.Context, d *schema.ResourceData, meta inte
log.Printf("[DEBUG] Tenants in AS3 get call : %s", name)
log.Printf("[DEBUG] Applications in AS3 get call : %s", applicationList)
if name != "" {
as3Resp, err := client.GetAs3(name, applicationList)
as3Resp, err := client.GetAs3(name, applicationList, d.Get("per_app_mode").(bool))

Check failure on line 295 in bigip/resource_bigip_as3.go

View workflow job for this annotation

GitHub Actions / golint

too many arguments in call to client.GetAs3
if d.Get("per_app_mode").(bool) {
as3Json := make(map[string]interface{})
_ = json.Unmarshal([]byte(as3Resp), &as3Json)
out, _ := json.Marshal(as3Json)
as3Dec := string(out)
applicationList = client.GetAppsList(fmt.Sprintf("%v", as3Dec))

Check failure on line 301 in bigip/resource_bigip_as3.go

View workflow job for this annotation

GitHub Actions / golint

client.GetAppsList undefined (type *"github.com/f5devcentral/go-bigip".BigIP has no field or method GetAppsList)
log.Printf("[DEBUG] Application List from retreived the GET call in Read function : %s", applicationList)
_ = d.Set("application_list", applicationList)
}

log.Printf("[DEBUG] AS3 json retreived from the GET call in Read function : %s", as3Resp)
if err != nil {
log.Printf("[ERROR] Unable to retrieve json ")
Expand Down Expand Up @@ -329,8 +339,8 @@ func resourceBigipAs3Update(ctx context.Context, d *schema.ResourceData, meta in
defer m.Unlock()
as3Json := d.Get("as3_json").(string)
log.Printf("[INFO] Updating As3 Config :%s", as3Json)
tenantList, _, _ := client.GetTenantList(as3Json)

tenantList, _, applicationList := client.GetTenantList(as3Json)
_ = d.Set("application_list", applicationList)
perApplication, err := client.CheckSetting()

Check failure on line 344 in bigip/resource_bigip_as3.go

View workflow job for this annotation

GitHub Actions / golint

client.CheckSetting undefined (type *"github.com/f5devcentral/go-bigip".BigIP has no field or method CheckSetting)
if err != nil {
return diag.FromErr(err)
Expand All @@ -340,13 +350,14 @@ func resourceBigipAs3Update(ctx context.Context, d *schema.ResourceData, meta in
if perApplication && len(tenantList) == 0 {
oldTenantList := d.Get("tenant_list").(string)
log.Printf("[INFO] Updating As3 Config for tenant:%s with Per-Application Mode:%v", oldTenantList, perApplication)
err, res := client.PostPerAppBigIp(as3Json, oldTenantList)
log.Printf("[DEBUG] res from PostPerAppBigIp:%+v", res)
err, task_id := client.PostPerAppBigIp(as3Json, oldTenantList)
log.Printf("[DEBUG] task_id from PostPerAppBigIp:%+v", task_id)
if err != nil {
return diag.FromErr(fmt.Errorf("posting as3 config failed for tenant:(%s) with error: %v", oldTenantList, err))
}
// tenantCount = append(tenantCount, tenant)
_ = d.Set("tenant_list", oldTenantList)
_ = d.Set("task_id", task_id)
} else {
if !perApplication {
return diag.FromErr(fmt.Errorf("Per-Application should be true in Big-IP Setting"))
Expand Down
26 changes: 20 additions & 6 deletions vendor/github.com/f5devcentral/go-bigip/as3bigip.go

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

0 comments on commit d2ea11c

Please sign in to comment.