-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Currently for any resource on the system, that resource's owner is only expressed as a String reference to the User's Organization and Username. We would like to change all of these owner fields, across all resource types, to return a JSON object containing a more complete representation of a User entity.
Resources to change:
- Agreement Bots
- Deployment Patterns
- Deployment Policies
- Management Policies
- Nodes
- Services
Current GET Request:
{
...
"owner": "myorg/user1"
...
}
Proposed GET Request: [Note] UUIDs cannot currently be used in any request to the Exchange.
{
...
"owner": {
"created_at": "2020-08-25T14:04:21.707Z[UTC]" # String, Timestamp
"email": "nphelps@us.ibm.com" # String
"identity_provider": "Open Horizon" # String
"modified_at": "2020-08-25T14:04:21.707Z[UTC]" # String, Timestamp
"modified_by": "be72e356-929d-63ca-9b73-f07765cc6aa1" # String, UUID
"organization": "myorg" # String
"user": "ad75g356-939d-43fa-9b73-f94765cc3aa2" # String, UUID
"username": "naphelps" # String
}
...
}
Exchange case classes:
case class ....(...
owner: SomeUserCaseClass,
...)
case class SomeUserCaseClass(created_at: String,
email: String = "",
identity_provider: String = "Open Horizon",
modified_at: String,
modified_by: String = "",
organization: String,
user: String,
username: String) {
def this(...) = {
this(... timestamp and uuid conversions to strings here ...)
}
}
...
fixFormatting(tuple._1.modifiedAt.toInstant
.atZone(ZoneId.of("UTC"))
.withZoneSameInstant(ZoneId.of("UTC"))
.toString),
...
References:
- https://github.com/open-horizon/exchange-api/blob/master/src/main/scala/org/openhorizon/exchangeapi/table/user/Users.scala
.join(UsersTQ.map(users => (users.organization, users.user, users.username))) .map(nodes => (HttpCode.OK, GetNodesResponse((result.map(node => node._1 -> new NodeTable(node._2)).toMap), 0))
Checklist:
-
exchange-api/src/main/scala/org/openhorizon/exchangeapi/table/agreementbot/Agbot.scala
Line 9 in 248cc50
owner: String, -
var owner: String, -
exchange-api/src/main/scala/org/openhorizon/exchangeapi/table/deploymentpattern/Pattern.scala
Line 6 in 248cc50
case class Pattern(owner: String, -
exchange-api/src/main/scala/org/openhorizon/exchangeapi/table/deploymentpolicy/BusinessPolicy.scala
Line 14 in 248cc50
owner: String, -
Line 15 in 248cc50
owner: String, -
exchange-api/src/main/scala/org/openhorizon/exchangeapi/table/service/Service.scala
Line 18 in 248cc50
owner: String,