Skip to content

Commit

Permalink
fix: Addressing PR comments for service token response map
Browse files Browse the repository at this point in the history
  • Loading branch information
srushti-patl committed Dec 23, 2024
1 parent be82990 commit 53091c3
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions internal/resources/fabric/service_token/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,18 +252,35 @@ func setServiceTokensData(d *schema.ResourceData, routeFilters *fabricv4.Service
func serviceTokenResponseMap(token *fabricv4.ServiceToken) map[string]interface{} {
serviceToken := make(map[string]interface{})
serviceToken["type"] = string(token.GetType())
serviceToken["href"] = token.GetHref()
serviceToken["uuid"] = token.GetUuid()
expirationDateTime := token.GetExpirationDateTime()
const TimeFormat = "2006-01-02T15:04:05.000Z"
serviceToken["expiration_date_time"] = expirationDateTime.Format(TimeFormat)
serviceToken["state"] = token.GetState()
serviceToken["description"] = token.GetDescription()

if token.Href != nil {
serviceToken["href"] = token.GetHref()
}
if token.Uuid != nil {
serviceToken["uuid"] = token.GetUuid()
}
if token.State != nil {
serviceToken["state"] = token.GetState()
}
if token.IssuerSide != nil {
serviceToken["issuer_side"] = token.GetIssuerSide()
}
if token.Name != nil {
serviceToken["name"] = token.GetName()
}
if token.Description != nil {
serviceToken["description"] = token.GetDescription()
}
if token.Connection != nil {
connection := token.GetConnection()
serviceToken["service_token_connection"] = connectionGoToTerraform(&connection)
}
if token.Notifications != nil {
notifications := token.GetNotifications()
serviceToken["notifications"] = equinix_fabric_schema.NotificationsGoToTerraform(notifications)
}
if token.Account != nil {
account := token.GetAccount()
serviceToken["account"] = equinix_fabric_schema.AccountGoToTerraform(&account)
Expand Down

0 comments on commit 53091c3

Please sign in to comment.