Skip to content

Commit

Permalink
misc: addressed lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sheensantoscapadngan committed Sep 13, 2024
1 parent 0d30e1c commit f8aed84
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/pkg/strings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package pkg

import "strings"

func StringSplitAndTrim(input string, seperator string) []string {
splittedStrings := strings.Split(input, seperator)
func StringSplitAndTrim(input string, separator string) []string {
splittedStrings := strings.Split(input, separator)
for i := 0; i < len(splittedStrings); i++ {
splittedStrings[i] = strings.TrimSpace(splittedStrings[i])
}
Expand Down
20 changes: 18 additions & 2 deletions internal/provider/resource/identity_oidc_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,15 @@ func (r *IdentityOidcAuthResource) Create(ctx context.Context, req resource.Crea

boundClaimsMap := make(map[string]string)
for key, value := range plan.BoundClaims.Elements() {
boundClaimsMap[key] = value.(types.String).ValueString()
if strVal, ok := value.(types.String); ok {
boundClaimsMap[key] = strVal.ValueString()
} else {
resp.Diagnostics.AddError(
"Error creating identity oidc auth",
"Bound claims value is not a string",
)
return
}
}

newIdentityOidcAuth, err := r.client.CreateIdentityOidcAuth(infisical.CreateIdentityOidcAuthRequest{
Expand Down Expand Up @@ -340,7 +348,15 @@ func (r *IdentityOidcAuthResource) Update(ctx context.Context, req resource.Upda

boundClaimsMap := make(map[string]string)
for key, value := range plan.BoundClaims.Elements() {
boundClaimsMap[key] = value.(types.String).ValueString()
if strVal, ok := value.(types.String); ok {
boundClaimsMap[key] = strVal.ValueString()
} else {
resp.Diagnostics.AddError(
"Error updating identity oidc auth",
"Bound claims value is not a string",
)
return
}
}

updatedIdentityOidcAuth, err := r.client.UpdateIdentityOidcAuth(infisical.UpdateIdentityOidcAuthRequest{
Expand Down

0 comments on commit f8aed84

Please sign in to comment.