From 1ce18b932f58a6901252cbc7e59745211a7449eb Mon Sep 17 00:00:00 2001 From: Domenic Simone Date: Thu, 12 Oct 2023 13:21:09 +1100 Subject: [PATCH] feat: spaceID on ssh key account --- octopusdeploy/resource_dynamic_worker_pool.go | 5 ++--- octopusdeploy/resource_sshkey_account.go | 8 ++++---- octopusdeploy/resource_static_worker_pool.go | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/octopusdeploy/resource_dynamic_worker_pool.go b/octopusdeploy/resource_dynamic_worker_pool.go index 5b9678320..4d060e118 100644 --- a/octopusdeploy/resource_dynamic_worker_pool.go +++ b/octopusdeploy/resource_dynamic_worker_pool.go @@ -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) } @@ -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) } diff --git a/octopusdeploy/resource_sshkey_account.go b/octopusdeploy/resource_sshkey_account.go index d41a95c8e..0aab32202 100644 --- a/octopusdeploy/resource_sshkey_account.go +++ b/octopusdeploy/resource_sshkey_account.go @@ -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) } @@ -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) } @@ -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") } @@ -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) } diff --git a/octopusdeploy/resource_static_worker_pool.go b/octopusdeploy/resource_static_worker_pool.go index bf5d82d62..881e9d6dc 100644 --- a/octopusdeploy/resource_static_worker_pool.go +++ b/octopusdeploy/resource_static_worker_pool.go @@ -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) } @@ -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) }