Skip to content

Commit

Permalink
Fix login credential type identifier parsing
Browse files Browse the repository at this point in the history
Values used for type identifier parsing were incorrect

Signed-off-by: Kobi Samoray <[email protected]>
  • Loading branch information
ksamoray committed Oct 5, 2023
1 parent d341d2e commit f8b1d73
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nsxt/resource_nsxt_compute_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct
credType := base.(model.LoginCredential).CredentialType

switch credType {
case "saml_login":
case model.SamlTokenLoginCredential__TYPE_IDENTIFIER:
entry, errs := converter.ConvertToGolang(credential, model.SamlTokenLoginCredentialBindingType())
if errs != nil {
return errs[0]
Expand All @@ -416,7 +416,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct
elem["thumbprint"] = credEntry.Thumbprint
elem["token"] = credEntry.Token

case "session_login":
case model.SessionLoginCredential__TYPE_IDENTIFIER:
entry, errs := converter.ConvertToGolang(credential, model.SessionLoginCredentialBindingType())
if errs != nil {
return errs[0]
Expand All @@ -425,7 +425,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct
elem["session_id"] = credEntry.SessionId
elem["thumbprint"] = credEntry.Thumbprint

case "username_password_login":
case model.UsernamePasswordLoginCredential__TYPE_IDENTIFIER:
entry, errs := converter.ConvertToGolang(credential, model.UsernamePasswordLoginCredentialBindingType())
if errs != nil {
return errs[0]
Expand All @@ -435,7 +435,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct
elem["thumbprint"] = credEntry.Thumbprint
elem["password"] = credEntry.Password

case "verifiable_asymmetric_login":
case model.VerifiableAsymmetricLoginCredential__TYPE_IDENTIFIER:
entry, errs := converter.ConvertToGolang(credential, model.VerifiableAsymmetricLoginCredentialBindingType())
if errs != nil {
return errs[0]
Expand All @@ -449,7 +449,7 @@ func setCredentialValuesInSchema(d *schema.ResourceData, credential *data.Struct
return errors.New("no valid credential found")
}

d.Set("credential", elem)
d.Set("credential", []interface{}{elem})
return nil
}

Expand Down

0 comments on commit f8b1d73

Please sign in to comment.