Skip to content

Commit

Permalink
chore: updated humanitec client and update code to use new SDK operat…
Browse files Browse the repository at this point in the history
…ion ids (#61)
  • Loading branch information
astromechza authored Jan 25, 2024
1 parent 45af72b commit c311beb
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 52 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/hashicorp/terraform-plugin-go v0.20.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0
github.com/humanitec/humanitec-go-autogen v0.0.0-20240108055932-686b39d75090
github.com/humanitec/humanitec-go-autogen v0.0.0-20240125162713-ab58fb4e601e
github.com/stretchr/testify v1.8.4
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/humanitec/humanitec-go-autogen v0.0.0-20240108055932-686b39d75090 h1:2/rQ2TfT/w2NTJCMiwaWupNPiP8g9TbXZktEmTYckj4=
github.com/humanitec/humanitec-go-autogen v0.0.0-20240108055932-686b39d75090/go.mod h1:pIhrOozOV1z0sQewcCfEdsQjoaCBi7K6TixbKzE2TPI=
github.com/humanitec/humanitec-go-autogen v0.0.0-20240125162713-ab58fb4e601e h1:tBHMUWLtZOTx049PI6DpRJscwKdVw5dPKNkqBMxFulg=
github.com/humanitec/humanitec-go-autogen v0.0.0-20240125162713-ab58fb4e601e/go.mod h1:pIhrOozOV1z0sQewcCfEdsQjoaCBi7K6TixbKzE2TPI=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/humanitec_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestNewHumanitecClientWrite(t *testing.T) {
assert.NoError(err)

name := "changed"
_, err = humSvc.PatchCurrentUser(ctx, client.PatchCurrentUserJSONRequestBody{
_, err = humSvc.UpdateCurrentUserWithResponse(ctx, client.UpdateCurrentUserJSONRequestBody{
Name: &name,
})
assert.NoError(err)
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/humanitec_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (h *HumanitecData) fetchResourceDrivers(ctx context.Context) (map[string]*c
return h.driversByType, diags
}

httpResp, err := h.Client.GetOrgsOrgIdResourcesDriversWithResponse(ctx, h.OrgID)
httpResp, err := h.Client.ListResourceDriversWithResponse(ctx, h.OrgID)
if err != nil {
diags.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to get resource drivers, got error: %s", err))
return nil, diags
Expand Down Expand Up @@ -68,7 +68,7 @@ func (h *HumanitecData) fetchResourceTypes(ctx context.Context) (map[string]*cli
return h.typesByType, diags
}

httpResp, err := h.Client.GetOrgsOrgIdResourcesTypesWithResponse(ctx, h.OrgID)
httpResp, err := h.Client.ListResourceTypesWithResponse(ctx, h.OrgID)
if err != nil {
diags.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to get resource types, got error: %s", err))
return nil, diags
Expand Down
16 changes: 8 additions & 8 deletions internal/provider/resource_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ func (r *ResourceAccountResource) Create(ctx context.Context, req resource.Creat
return
}

httpResp, err := r.client.PostOrgsOrgIdResourcesAccountsWithResponse(ctx, r.orgId, client.PostOrgsOrgIdResourcesAccountsJSONRequestBody{
Id: &id,
Name: &name,
Type: &accountType,
Credentials: &credentials,
httpResp, err := r.client.CreateResourceAccountWithResponse(ctx, r.orgId, client.CreateResourceAccountRequestRequest{
Id: id,
Name: name,
Type: accountType,
Credentials: credentials,
})
if err != nil {
resp.Diagnostics.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to create resource account, got error: %s", err))
Expand Down Expand Up @@ -164,7 +164,7 @@ func (r *ResourceAccountResource) Read(ctx context.Context, req resource.ReadReq
return
}

httpResp, err := r.client.GetOrgsOrgIdResourcesAccountsAccIdWithResponse(ctx, r.orgId, data.ID.ValueString())
httpResp, err := r.client.GetResourceAccountWithResponse(ctx, r.orgId, data.ID.ValueString())
if err != nil {
resp.Diagnostics.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to read resource account, got error: %s", err))
return
Expand Down Expand Up @@ -200,7 +200,7 @@ func (r *ResourceAccountResource) Update(ctx context.Context, req resource.Updat
return
}

httpResp, err := r.client.PatchOrgsOrgIdResourcesAccountsAccIdWithResponse(ctx, r.orgId, data.ID.ValueString(), client.PatchOrgsOrgIdResourcesAccountsAccIdJSONRequestBody{
httpResp, err := r.client.PatchResourceAccountWithResponse(ctx, r.orgId, data.ID.ValueString(), client.PatchResourceAccountJSONRequestBody{
Name: &name,
Credentials: &credentials,
})
Expand Down Expand Up @@ -237,7 +237,7 @@ func (r *ResourceAccountResource) Delete(ctx context.Context, req resource.Delet
}

err := retry.RetryContext(ctx, deleteTimeout, func() *retry.RetryError {
httpResp, err := r.client.DeleteOrgsOrgIdResourcesAccountsAccIdWithResponse(ctx, r.orgId, data.ID.ValueString())
httpResp, err := r.client.DeleteResourceAccountWithResponse(ctx, r.orgId, data.ID.ValueString())
if err != nil {
return retry.NonRetryableError(err)
}
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/resource_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (r *ResourceApplication) Create(ctx context.Context, req resource.CreateReq
}
}

httpResp, err := r.client.PostOrgsOrgIdAppsWithResponse(ctx, r.orgId, client.PostOrgsOrgIdAppsJSONRequestBody{
httpResp, err := r.client.CreateApplicationWithResponse(ctx, r.orgId, client.CreateApplicationJSONRequestBody{
Id: id,
Name: name,
Env: env,
Expand Down Expand Up @@ -191,12 +191,12 @@ func (r *ResourceApplication) Read(ctx context.Context, req resource.ReadRequest
return
}

var httpResp *client.GetOrgsOrgIdAppsAppIdResponse
var httpResp *client.GetApplicationResponse

err := retry.RetryContext(ctx, readTimeout, func() *retry.RetryError {
var err error

httpResp, err = r.client.GetOrgsOrgIdAppsAppIdWithResponse(ctx, r.orgId, data.ID.ValueString())
httpResp, err = r.client.GetApplicationWithResponse(ctx, r.orgId, data.ID.ValueString())
if err != nil {
return retry.NonRetryableError(err)
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func (r *ResourceApplication) Delete(ctx context.Context, req resource.DeleteReq
// Remove the app
appID := data.ID.ValueString()
err := retry.RetryContext(ctx, deleteTimeout, func() *retry.RetryError {
httpResp, err := r.client.DeleteOrgsOrgIdAppsAppIdWithResponse(ctx, r.orgId, appID)
httpResp, err := r.client.DeleteApplicationWithResponse(ctx, r.orgId, appID)
if err != nil {
return retry.NonRetryableError(err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/resource_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestAccResourceApplicationDeletedOutManually(t *testing.T) {
resource.TestCheckResourceAttr("humanitec_application.app_test", "name", "test-app-1"),
func(_ *terraform.State) error {
// Manually delete the application via the API
resp, err := client.DeleteOrgsOrgIdAppsAppIdWithResponse(ctx, orgID, id)
resp, err := client.DeleteApplicationWithResponse(ctx, orgID, id)
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/resource_application_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ func (r *ResourceApplicationUser) Create(ctx context.Context, req resource.Creat
appID := data.AppID.ValueString()
role := data.Role.ValueString()

var httpResp *client.PostOrgsOrgIdAppsAppIdUsersResponse
var httpResp *client.CreateUserRoleInAppResponse
err := retry.RetryContext(ctx, createTimeout, func() *retry.RetryError {
var err error
httpResp, err = r.client.PostOrgsOrgIdAppsAppIdUsersWithResponse(ctx, r.orgId, appID, client.PostOrgsOrgIdAppsAppIdUsersJSONRequestBody{
httpResp, err = r.client.CreateUserRoleInAppWithResponse(ctx, r.orgId, appID, client.CreateUserRoleInAppJSONRequestBody{
Id: &userID,
Role: &role,
})
Expand Down Expand Up @@ -186,10 +186,10 @@ func (r *ResourceApplicationUser) Read(ctx context.Context, req resource.ReadReq
return
}

var httpResp *client.GetOrgsOrgIdAppsAppIdUsersUserIdResponse
var httpResp *client.GetUserRoleInAppResponse
err := retry.RetryContext(ctx, defaultApplicationUserReadTimeout, func() *retry.RetryError {
var err error
httpResp, err = r.client.GetOrgsOrgIdAppsAppIdUsersUserIdWithResponse(ctx, r.orgId, data.AppID.ValueString(), data.UserID.ValueString())
httpResp, err = r.client.GetUserRoleInAppWithResponse(ctx, r.orgId, data.AppID.ValueString(), data.UserID.ValueString())
if err != nil {
return retry.NonRetryableError(err)
}
Expand Down Expand Up @@ -235,7 +235,7 @@ func (r *ResourceApplicationUser) Update(ctx context.Context, req resource.Updat
appID := data.AppID.ValueString()
role := data.Role.ValueString()

httpResp, err := r.client.PatchOrgsOrgIdAppsAppIdUsersUserIdWithResponse(ctx, r.orgId, appID, userID, client.PatchOrgsOrgIdAppsAppIdUsersUserIdJSONRequestBody{
httpResp, err := r.client.UpdateUserRoleInAppWithResponse(ctx, r.orgId, appID, userID, client.UpdateUserRoleInAppJSONRequestBody{
Role: &role,
})
if err != nil {
Expand Down Expand Up @@ -268,7 +268,7 @@ func (r *ResourceApplicationUser) Delete(ctx context.Context, req resource.Delet
userID := data.UserID.ValueString()
applicationID := data.AppID.ValueString()

httpResp, err := r.client.DeleteOrgsOrgIdAppsAppIdUsersUserIdWithResponse(ctx, r.orgId, applicationID, userID)
httpResp, err := r.client.DeleteUserRoleInAppWithResponse(ctx, r.orgId, applicationID, userID)
if err != nil {
resp.Diagnostics.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to delete resource application user, got error: %s", err))
return
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/resource_definition_criteria_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (r *ResourceDefinitionCriteriaResource) Create(ctx context.Context, req res
return
}

httpResp, err := r.client().PostOrgsOrgIdResourcesDefsDefIdCriteriaWithResponse(ctx, r.orgId(), data.ResourceDefinitionID.ValueString(), client.PostOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody{
httpResp, err := r.client().CreateResourceDefinitionCriteriaWithResponse(ctx, r.orgId(), data.ResourceDefinitionID.ValueString(), client.CreateResourceDefinitionCriteriaJSONRequestBody{
AppId: data.AppID.ValueStringPointer(),
EnvId: data.EnvID.ValueStringPointer(),
EnvType: data.EnvType.ValueStringPointer(),
Expand Down Expand Up @@ -204,7 +204,7 @@ func (r *ResourceDefinitionCriteriaResource) Read(ctx context.Context, req resou
return
}

httpResp, err := r.client().GetOrgsOrgIdResourcesDefsDefIdWithResponse(ctx, r.orgId(), data.ResourceDefinitionID.ValueString())
httpResp, err := r.client().GetResourceDefinitionWithResponse(ctx, r.orgId(), data.ResourceDefinitionID.ValueString())
if err != nil {
resp.Diagnostics.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to read resource definition, got error: %s", err))
return
Expand Down Expand Up @@ -299,7 +299,7 @@ func (r *ResourceDefinitionCriteriaResource) Delete(ctx context.Context, req res
force := data.ForceDelete.ValueBool()

err := retry.RetryContext(ctx, deleteTimeout, func() *retry.RetryError {
httpResp, err := r.client().DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdWithResponse(ctx, r.orgId(), data.ResourceDefinitionID.ValueString(), data.ID.ValueString(), &client.DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdParams{
httpResp, err := r.client().DeleteResourceDefinitionCriteriaWithResponse(ctx, r.orgId(), data.ResourceDefinitionID.ValueString(), data.ID.ValueString(), &client.DeleteResourceDefinitionCriteriaParams{
Force: &force,
})
if err != nil {
Expand Down
23 changes: 11 additions & 12 deletions internal/provider/resource_definition_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func parseResourceDefinitionResponse(ctx context.Context, driverInputSchema map[
data.ID = types.StringValue(res.Id)
data.Name = types.StringValue(res.Name)
data.Type = types.StringValue(res.Type)
data.DriverType = parseOptionalString(res.DriverType)
data.DriverType = types.StringValue(res.DriverType)
data.DriverAccount = parseOptionalString(res.DriverAccount)
if data.Criteria != nil {
data.Criteria = parseCriteriaInput(res.Criteria)
Expand Down Expand Up @@ -421,15 +421,14 @@ func parseResourceDefinitionResponse(ctx context.Context, driverInputSchema map[
return diags
}

func criteriaFromModel(data *DefinitionResourceModel) *[]client.MatchingCriteriaRequest {
func criteriaFromModel(data *DefinitionResourceModel) *[]client.MatchingCriteriaRuleRequest {
if data.Criteria == nil {
return nil
}

criteria := []client.MatchingCriteriaRequest{}
criteria := []client.MatchingCriteriaRuleRequest{}
for _, c := range *data.Criteria {
criteria = append(criteria, client.MatchingCriteriaRequest{
Id: c.ID.ValueStringPointer(),
criteria = append(criteria, client.MatchingCriteriaRuleRequest{
AppId: c.AppID.ValueStringPointer(),
EnvId: c.EnvID.ValueStringPointer(),
EnvType: c.EnvType.ValueStringPointer(),
Expand Down Expand Up @@ -619,7 +618,7 @@ func (r *ResourceDefinitionResource) Create(ctx context.Context, req resource.Cr
return
}

httpResp, err := r.client().PostOrgsOrgIdResourcesDefsWithResponse(ctx, r.orgId(), client.PostOrgsOrgIdResourcesDefsJSONRequestBody{
httpResp, err := r.client().CreateResourceDefinitionWithResponse(ctx, r.orgId(), client.CreateResourceDefinitionRequestRequest{
Criteria: criteria,
Provision: provision,
DriverAccount: data.DriverAccount.ValueStringPointer(),
Expand Down Expand Up @@ -658,7 +657,7 @@ func (r *ResourceDefinitionResource) Read(ctx context.Context, req resource.Read
return
}

httpResp, err := r.client().GetOrgsOrgIdResourcesDefsDefIdWithResponse(ctx, r.orgId(), data.ID.ValueString())
httpResp, err := r.client().GetResourceDefinitionWithResponse(ctx, r.orgId(), data.ID.ValueString())
if err != nil {
resp.Diagnostics.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to read resource definition, got error: %s", err))
return
Expand All @@ -675,7 +674,7 @@ func (r *ResourceDefinitionResource) Read(ctx context.Context, req resource.Read
return
}

driverInputSchema, diag := r.data.DriverInputSchemaByDriverTypeOrType(ctx, *httpResp.JSON200.DriverType, httpResp.JSON200.Type)
driverInputSchema, diag := r.data.DriverInputSchemaByDriverTypeOrType(ctx, httpResp.JSON200.DriverType, httpResp.JSON200.Type)
resp.Diagnostics.Append(diag...)
if resp.Diagnostics.HasError() {
return
Expand Down Expand Up @@ -766,7 +765,7 @@ func (r *ResourceDefinitionResource) Update(ctx context.Context, req resource.Up

// Add criteria
for _, c := range addedCriteria {
httpResp, err := r.client().PostOrgsOrgIdResourcesDefsDefIdCriteriaWithResponse(ctx, r.orgId(), defID, client.PostOrgsOrgIdResourcesDefsDefIdCriteriaJSONRequestBody{
httpResp, err := r.client().CreateResourceDefinitionCriteriaWithResponse(ctx, r.orgId(), defID, client.CreateResourceDefinitionCriteriaJSONRequestBody{
AppId: c.AppID.ValueStringPointer(),
EnvId: c.EnvID.ValueStringPointer(),
EnvType: c.EnvType.ValueStringPointer(),
Expand All @@ -792,7 +791,7 @@ func (r *ResourceDefinitionResource) Update(ctx context.Context, req resource.Up
continue
}

httpResp, err := r.client().DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdWithResponse(ctx, r.orgId(), defID, criteriaID, &client.DeleteOrgsOrgIdResourcesDefsDefIdCriteriaCriteriaIdParams{
httpResp, err := r.client().DeleteResourceDefinitionCriteriaWithResponse(ctx, r.orgId(), defID, criteriaID, &client.DeleteResourceDefinitionCriteriaParams{
Force: &force,
})
if err != nil {
Expand All @@ -808,7 +807,7 @@ func (r *ResourceDefinitionResource) Update(ctx context.Context, req resource.Up

provision := provisionFromModel(data.Provision)

httpResp, err := r.client().PutOrgsOrgIdResourcesDefsDefIdWithResponse(ctx, r.orgId(), defID, client.PutOrgsOrgIdResourcesDefsDefIdJSONRequestBody{
httpResp, err := r.client().UpdateResourceDefinitionWithResponse(ctx, r.orgId(), defID, client.UpdateResourceDefinitionRequestRequest{
DriverAccount: data.DriverAccount.ValueStringPointer(),
DriverInputs: driverInputs,
Name: name,
Expand Down Expand Up @@ -852,7 +851,7 @@ func (r *ResourceDefinitionResource) Delete(ctx context.Context, req resource.De
force := data.ForceDelete.ValueBool()

err := retry.RetryContext(ctx, deleteTimeout, func() *retry.RetryError {
httpResp, err := r.client().DeleteOrgsOrgIdResourcesDefsDefIdWithResponse(ctx, r.orgId(), data.ID.ValueString(), &client.DeleteOrgsOrgIdResourcesDefsDefIdParams{
httpResp, err := r.client().DeleteResourceDefinitionWithResponse(ctx, r.orgId(), data.ID.ValueString(), &client.DeleteResourceDefinitionParams{
Force: &force,
})
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/resource_environment_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (r *ResourceEnvironmentType) Create(ctx context.Context, req resource.Creat

id := data.ID.ValueString()

httpResp, err := r.client.PostOrgsOrgIdEnvTypesWithResponse(ctx, r.orgId, client.PostOrgsOrgIdEnvTypesJSONRequestBody{
httpResp, err := r.client.CreateEnvironmentTypeWithResponse(ctx, r.orgId, client.CreateEnvironmentTypeJSONRequestBody{
Id: id,
Description: data.Description.ValueStringPointer(),
})
Expand Down Expand Up @@ -130,7 +130,7 @@ func (r *ResourceEnvironmentType) Read(ctx context.Context, req resource.ReadReq
return
}

httpResp, err := r.client.GetOrgsOrgIdEnvTypesEnvTypeIdWithResponse(ctx, r.orgId, data.ID.ValueString())
httpResp, err := r.client.GetEnvironmentTypeWithResponse(ctx, r.orgId, data.ID.ValueString())
if err != nil {
resp.Diagnostics.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to read environment type, got error: %s", err))
return
Expand Down Expand Up @@ -160,7 +160,7 @@ func (r *ResourceEnvironmentType) Delete(ctx context.Context, req resource.Delet
return
}

httpResp, err := r.client.DeleteOrgsOrgIdEnvTypesEnvTypeIdWithResponse(ctx, r.orgId, data.ID.ValueString())
httpResp, err := r.client.DeleteEnvironmentTypeWithResponse(ctx, r.orgId, data.ID.ValueString())
if err != nil {
resp.Diagnostics.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to delete environment type, got error: %s", err))
return
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/resource_environment_type_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ func (r *ResourceEnvironmentTypeUser) Create(ctx context.Context, req resource.C
envTypeID := data.EnvTypeID.ValueString()
role := data.Role.ValueString()

var httpResp *client.PostOrgsOrgIdEnvTypesEnvTypeUsersResponse
var httpResp *client.CreateUserRoleInEnvTypeResponse
err := retry.RetryContext(ctx, createTimeout, func() *retry.RetryError {
var err error
httpResp, err = r.client.PostOrgsOrgIdEnvTypesEnvTypeUsersWithResponse(ctx, r.orgId, envTypeID, client.PostOrgsOrgIdEnvTypesEnvTypeUsersJSONRequestBody{
httpResp, err = r.client.CreateUserRoleInEnvTypeWithResponse(ctx, r.orgId, envTypeID, client.CreateUserRoleInEnvTypeJSONRequestBody{
Id: &userID,
Role: &role,
})
Expand Down Expand Up @@ -186,10 +186,10 @@ func (r *ResourceEnvironmentTypeUser) Read(ctx context.Context, req resource.Rea
return
}

var httpResp *client.GetOrgsOrgIdEnvTypesEnvTypeUsersUserIdResponse
var httpResp *client.GetUserRoleInEnvTypeResponse
err := retry.RetryContext(ctx, defaultEnvironmentTypeUserReadTimeout, func() *retry.RetryError {
var err error
httpResp, err = r.client.GetOrgsOrgIdEnvTypesEnvTypeUsersUserIdWithResponse(ctx, r.orgId, data.EnvTypeID.ValueString(), data.UserID.ValueString())
httpResp, err = r.client.GetUserRoleInEnvTypeWithResponse(ctx, r.orgId, data.EnvTypeID.ValueString(), data.UserID.ValueString())
if err != nil {
return retry.NonRetryableError(err)
}
Expand Down Expand Up @@ -235,7 +235,7 @@ func (r *ResourceEnvironmentTypeUser) Update(ctx context.Context, req resource.U
envTypeID := data.EnvTypeID.ValueString()
role := data.Role.ValueString()

httpResp, err := r.client.PatchOrgsOrgIdEnvTypesEnvTypeUsersUserIdWithResponse(ctx, r.orgId, envTypeID, userID, client.PatchOrgsOrgIdAppsAppIdUsersUserIdJSONRequestBody{
httpResp, err := r.client.UpdateUserRoleInEnvTypeWithResponse(ctx, r.orgId, envTypeID, userID, client.UpdateUserRoleInEnvTypeJSONRequestBody{
Role: &role,
})
if err != nil {
Expand Down Expand Up @@ -268,7 +268,7 @@ func (r *ResourceEnvironmentTypeUser) Delete(ctx context.Context, req resource.D
userID := data.UserID.ValueString()
applicationID := data.EnvTypeID.ValueString()

httpResp, err := r.client.DeleteOrgsOrgIdEnvTypesEnvTypeUsersUserIdWithResponse(ctx, r.orgId, applicationID, userID)
httpResp, err := r.client.DeleteUserRoleInEnvTypeWithResponse(ctx, r.orgId, applicationID, userID)
if err != nil {
resp.Diagnostics.AddError(HUM_CLIENT_ERR, fmt.Sprintf("Unable to delete resource environment type user, got error: %s", err))
return
Expand Down
Loading

0 comments on commit c311beb

Please sign in to comment.