Skip to content

Commit

Permalink
feat: spaceID on ssh key account
Browse files Browse the repository at this point in the history
  • Loading branch information
domenicsim1 committed Oct 12, 2023
1 parent 5030b9e commit 1ce18b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions octopusdeploy/resource_dynamic_worker_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func resourceDynamicWorkerPoolCreate(ctx context.Context, d *schema.ResourceData
log.Printf("[INFO] creating dynamic worker pool: %#v", workerPool)

client := m.(*client.Client)
createdWorkerPool, err := workerpools.Add(client, workerPool.SpaceID, workerPool)
createdWorkerPool, err := workerpools.Add(client, workerPool)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -83,10 +83,9 @@ func resourceDynamicWorkerPoolUpdate(ctx context.Context, d *schema.ResourceData
workerPool := expandDynamicWorkerPool(d)

log.Printf("[INFO] updating dynamic worker pool (%s)", d.Id())
spaceID := d.Get("space_id").(string)

client := m.(*client.Client)
updatedWorkerPool, err := workerpools.Update(client, spaceID, workerPool)
updatedWorkerPool, err := workerpools.Update(client, workerPool)
if err != nil {
return diag.FromErr(err)
}
Expand Down
8 changes: 4 additions & 4 deletions octopusdeploy/resource_sshkey_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func resourceSSHKeyAccountCreate(ctx context.Context, d *schema.ResourceData, m
log.Printf("[INFO] creating SSH key account: %#v", account)

client := m.(*client.Client)
createdAccount, err := client.Accounts.Add(account)
createdAccount, err := accounts.Add(client, account)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -48,7 +48,7 @@ func resourceSSHKeyAccountDelete(ctx context.Context, d *schema.ResourceData, m
log.Printf("[INFO] deleting SSH key account (%s)", d.Id())

client := m.(*client.Client)
if err := client.Accounts.DeleteByID(d.Id()); err != nil {
if err := accounts.DeleteByID(client, d.Get("space_id").(string), d.Id()); err != nil {
return diag.FromErr(err)
}

Expand All @@ -62,7 +62,7 @@ func resourceSSHKeyAccountRead(ctx context.Context, d *schema.ResourceData, m in
log.Printf("[INFO] reading SSH key account (%s)", d.Id())

client := m.(*client.Client)
accountResource, err := client.Accounts.GetByID(d.Id())
accountResource, err := accounts.GetByID(client, d.Get("space_id").(string), d.Id())
if err != nil {
return errors.ProcessApiError(ctx, d, err, "SSH key account")
}
Expand All @@ -81,7 +81,7 @@ func resourceSSHKeyAccountUpdate(ctx context.Context, d *schema.ResourceData, m

account := expandSSHKeyAccount(d)
client := m.(*client.Client)
updatedAccount, err := client.Accounts.Update(account)
updatedAccount, err := accounts.Update(client, account)
if err != nil {
return diag.FromErr(err)
}
Expand Down
4 changes: 2 additions & 2 deletions octopusdeploy/resource_static_worker_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func resourceStaticWorkerPoolCreate(ctx context.Context, d *schema.ResourceData,
log.Printf("[INFO] creating static worker pool: %#v", workerPool)

client := m.(*client.Client)
createdWorkerPool, err := workerpools.Add(client, workerPool.SpaceID, workerPool)
createdWorkerPool, err := workerpools.Add(client, workerPool)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -85,7 +85,7 @@ func resourceStaticWorkerPoolUpdate(ctx context.Context, d *schema.ResourceData,
log.Printf("[INFO] updating static worker pool (%s)", d.Id())

client := m.(*client.Client)
updatedWorkerPool, err := workerpools.Update(client, workerPool.SpaceID, workerPool)
updatedWorkerPool, err := workerpools.Update(client, workerPool)
if err != nil {
return diag.FromErr(err)
}
Expand Down

0 comments on commit 1ce18b9

Please sign in to comment.