Skip to content

Resource Owner Fields Return Complete User Records On GET Requests #795

@naphelps

Description

@naphelps

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:

Checklist:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions