Skip to content

Commit

Permalink
Added async Create function
Browse files Browse the repository at this point in the history
  • Loading branch information
ramaniprateek committed Jan 12, 2024
1 parent fe253e3 commit a2cefee
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
13 changes: 10 additions & 3 deletions bigip/resource_bigip_as3.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,16 @@ func resourceBigipAs3Create(ctx context.Context, d *schema.ResourceData, meta in
return diag.FromErr(fmt.Errorf("could not generate random tenant name"))
}

err, res := client.PostPerAppBigIp(as3Json, tenant)
err, taskID := client.PostPerAppBigIp(as3Json, tenant)

Check failure on line 198 in bigip/resource_bigip_as3.go

View workflow job for this annotation

GitHub Actions / golint

client.PostPerAppBigIp undefined (type *"github.com/f5devcentral/go-bigip".BigIP has no field or method PostPerAppBigIp)

Check failure on line 198 in bigip/resource_bigip_as3.go

View workflow job for this annotation

GitHub Actions / golint

client.PostPerAppBigIp undefined (type *"github.com/f5devcentral/go-bigip".BigIP has no field or method PostPerAppBigIp)

log.Printf("[DEBUG] res from deployment :%+v", res)
log.Printf("[DEBUG] task Id from deployment :%+v", taskID)

if err != nil {
return diag.FromErr(fmt.Errorf("posting as3 config failed for tenants:(%s) with error: %v", tenantFilter, err))
}
tenantCount = append(tenantCount, tenant)
_ = d.Set("tenant_list", tenant)
_ = d.Set("task_id", taskID)
_ = d.Set("per_app_mode", true)
} else {
log.Printf("[INFO] Creating As3 config for tenants:%+v", tenantList)
Expand Down Expand Up @@ -445,9 +446,15 @@ func contains(s []string, str string) bool {

func GenerateRandomString(length int) (string, error) {
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
charLen := 0
randomString := make([]byte, length)
for i := range randomString {
randomIndex, err := rand.Int(rand.Reader, big.NewInt(int64(len(charset))))
if i == 0 {
charLen = 52
} else {
charLen = len(charset)
}
randomIndex, err := rand.Int(rand.Reader, big.NewInt(int64(charLen)))
if err != nil {
return "", err
}
Expand Down
35 changes: 29 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 a2cefee

Please sign in to comment.