Skip to content

Commit 81b8807

Browse files
authored
[feat]: [CDS-100946]: Change APIs for new overrides terraform resource (#1072)
* [feat]: [CDS-100946]: Change APIs for new overrides terraform resource * [feat]: [CDS-100946]: Change APIs for new overrides terraform resource - 2
1 parent eeb35f8 commit 81b8807

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/antihax/optional v1.0.0
77
github.com/aws/aws-sdk-go v1.46.4
88
github.com/docker/docker v24.0.5+incompatible
9-
github.com/harness/harness-go-sdk v0.4.8
9+
github.com/harness/harness-go-sdk v0.4.9
1010
github.com/harness/harness-openapi-go-client v0.0.21
1111
github.com/hashicorp/go-cleanhttp v0.5.2
1212
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
5454
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
5555
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
5656
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
57-
github.com/harness/harness-go-sdk v0.4.8 h1:ufWTQgFKq5xGLGPEm8CMuEHv0v0Gveri2TzDTdPqDMw=
58-
github.com/harness/harness-go-sdk v0.4.8/go.mod h1:a/1HYTgVEuNEoh3Z3IsOHZdlUNxl94KcX57ZSNVGll0=
57+
github.com/harness/harness-go-sdk v0.4.9 h1:dNx0GrAfT4X8UMxYTvL1sp66jeJeN1v8lgjMLBItWI4=
58+
github.com/harness/harness-go-sdk v0.4.9/go.mod h1:a/1HYTgVEuNEoh3Z3IsOHZdlUNxl94KcX57ZSNVGll0=
5959
github.com/harness/harness-openapi-go-client v0.0.21 h1:VtJnpQKZvCAlaCmUPbNR69OT3c5WRdhNN5TOgUwtwZ4=
6060
github.com/harness/harness-openapi-go-client v0.0.21/go.mod h1:u0vqYb994BJGotmEwJevF4L3BNAdU9i8ui2d22gmLPA=
6161
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=

internal/service/platform/overrides/data_source_overrides.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func dataSourceOverridesRead(ctx context.Context, d *schema.ResourceData, meta i
100100
c, ctx := meta.(*internal.Session).GetPlatformClientWithContext(ctx)
101101
identifier := d.Get("identifier").(string)
102102

103-
resp, httpResp, err := c.ServiceOverridesApi.GetServiceOverrides(ctx, identifier, c.AccountId,
103+
resp, httpResp, err := c.OverridesApi.GetOverrides(ctx, identifier, c.AccountId,
104104
&nextgen.ServiceOverridesApiGetServiceOverridesV2Opts{
105105
OrgIdentifier: helpers.BuildField(d, "org_id"),
106106
ProjectIdentifier: helpers.BuildField(d, "project_id"),

internal/service/platform/overrides/resource_overrides.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func resourceOverridesRead(ctx context.Context, d *schema.ResourceData, meta int
180180
identifier := d.Id()
181181
svcGetParams := getOverrideParams(d)
182182

183-
resp, httpResp, err := c.ServiceOverridesApi.GetServiceOverrides(ctx, identifier, c.AccountId, svcGetParams)
183+
resp, httpResp, err := c.OverridesApi.GetOverrides(ctx, identifier, c.AccountId, svcGetParams)
184184
if err != nil {
185185
return helpers.HandleReadApiError(err, d, httpResp)
186186
}
@@ -213,14 +213,14 @@ func resourceOverridesCreateOrUpdate(ctx context.Context, d *schema.ResourceData
213213
if d.Get("import_from_git").(bool) {
214214
importReq := buildOverrideImportRequest(d)
215215
svcImportParam := getOverrideImportParams(importReq, d)
216-
importResp, httpResp, err = c.ServiceOverridesApi.ImportServiceOverrides(ctx, c.AccountId, svcImportParam)
216+
importResp, httpResp, err = c.OverridesApi.ImportOverrides(ctx, c.AccountId, svcImportParam)
217217
} else {
218218
createParam := overrideCreateParam(env, d)
219-
resp, httpResp, err = c.ServiceOverridesApi.CreateServiceOverrideV2(ctx, c.AccountId, createParam)
219+
resp, httpResp, err = c.OverridesApi.CreateOverride(ctx, c.AccountId, createParam)
220220
}
221221
} else {
222222
updateParam := overrideUpdateParam(env, d)
223-
resp, httpResp, err = c.ServiceOverridesApi.UpdateServiceOverrideV2(ctx, c.AccountId, updateParam)
223+
resp, httpResp, err = c.OverridesApi.UpdateOverride(ctx, c.AccountId, updateParam)
224224
}
225225

226226
if err != nil {
@@ -247,7 +247,7 @@ func resourceOverridesCreateOrUpdate(ctx context.Context, d *schema.ResourceData
247247
func resourceOverridesDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
248248
c, ctx := meta.(*internal.Session).GetPlatformClientWithContext(ctx)
249249

250-
_, httpResp, err := c.ServiceOverridesApi.DeleteServiceOverrideV2(ctx, d.Id(), c.AccountId, &nextgen.ServiceOverridesApiDeleteServiceOverrideV2Opts{
250+
_, httpResp, err := c.OverridesApi.DeleteOverride(ctx, d.Id(), c.AccountId, &nextgen.ServiceOverridesApiDeleteServiceOverrideV2Opts{
251251
OrgIdentifier: helpers.BuildField(d, "org_id"),
252252
ProjectIdentifier: helpers.BuildField(d, "project_id"),
253253
})

internal/service/platform/overrides/resource_overrides_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func testAccGetPlatformOverrides(resourceName string, state *terraform.State) (*
124124
orgId := r.Primary.Attributes["org_id"]
125125
projId := r.Primary.Attributes["project_id"]
126126

127-
resp, _, err := c.ServiceOverridesApi.GetServiceOverridesV2(ctx, identifier, c.AccountId,
127+
resp, _, err := c.OverridesApi.GetOverrides(ctx, identifier, c.AccountId,
128128
&nextgen.ServiceOverridesApiGetServiceOverridesV2Opts{
129129
OrgIdentifier: optional.NewString(orgId),
130130
ProjectIdentifier: optional.NewString(projId),

0 commit comments

Comments
 (0)