Skip to content

Commit a2cefee

Browse files
committed
Added async Create function
1 parent fe253e3 commit a2cefee

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

bigip/resource_bigip_as3.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,16 @@ func resourceBigipAs3Create(ctx context.Context, d *schema.ResourceData, meta in
195195
return diag.FromErr(fmt.Errorf("could not generate random tenant name"))
196196
}
197197

198-
err, res := client.PostPerAppBigIp(as3Json, tenant)
198+
err, taskID := client.PostPerAppBigIp(as3Json, tenant)
199199

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

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

446447
func GenerateRandomString(length int) (string, error) {
447448
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
449+
charLen := 0
448450
randomString := make([]byte, length)
449451
for i := range randomString {
450-
randomIndex, err := rand.Int(rand.Reader, big.NewInt(int64(len(charset))))
452+
if i == 0 {
453+
charLen = 52
454+
} else {
455+
charLen = len(charset)
456+
}
457+
randomIndex, err := rand.Int(rand.Reader, big.NewInt(int64(charLen)))
451458
if err != nil {
452459
return "", err
453460
}

vendor/github.com/f5devcentral/go-bigip/as3bigip.go

Lines changed: 29 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)