Skip to content

Commit

Permalink
Fix Conversion APIs (#41)
Browse files Browse the repository at this point in the history
Monday mornings...
  • Loading branch information
spjmurray authored Jun 3, 2024
1 parent 05b5d27 commit e54d96a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions charts/core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Helm chart for deploying Unikorn Core

type: application

version: v0.1.34
appVersion: v0.1.34
version: v0.1.35
appVersion: v0.1.35

icon: https://assets.unikorn-cloud.org/images/logos/dark-on-light/icon.svg
14 changes: 9 additions & 5 deletions pkg/server/conversion/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,32 +69,36 @@ func ResourceReadMetadata(in metav1.Object, status openapi.ResourceProvisioningS

// OrganizationScopedResourceReadMetadata extracts organization scoped metdata from a resource
// for GET APIS.
func OrganizationScopedResourceReadMetadata(in metav1.Object, status openapi.ResourceProvisioningStatus, organizationID string) openapi.OrganizationScopedResourceReadMetadata {
func OrganizationScopedResourceReadMetadata(in metav1.Object, status openapi.ResourceProvisioningStatus) openapi.OrganizationScopedResourceReadMetadata {
labels := in.GetLabels()

temp := ResourceReadMetadata(in, status)

out := openapi.OrganizationScopedResourceReadMetadata{
Id: temp.Id,
Name: temp.Name,
CreationTime: temp.CreationTime,
ProvisioningStatus: temp.ProvisioningStatus,
OrganizationId: organizationID,
OrganizationId: labels[constants.OrganizationLabel],
}

return out
}

// ProjectScopedResourceReadMetadata extracts project scoped metdata from a resource for
// GET APIs.
func ProjectScopedResourceReadMetadata(in metav1.Object, status openapi.ResourceProvisioningStatus, organizationID, projectID string) openapi.ProjectScopedResourceReadMetadata {
temp := OrganizationScopedResourceReadMetadata(in, status, organizationID)
func ProjectScopedResourceReadMetadata(in metav1.Object, status openapi.ResourceProvisioningStatus) openapi.ProjectScopedResourceReadMetadata {
labels := in.GetLabels()

temp := OrganizationScopedResourceReadMetadata(in, status)

out := openapi.ProjectScopedResourceReadMetadata{
Id: temp.Id,
Name: temp.Name,
CreationTime: temp.CreationTime,
ProvisioningStatus: temp.ProvisioningStatus,
OrganizationId: temp.OrganizationId,
ProjectId: projectID,
ProjectId: labels[constants.ProjectLabel],
}

return out
Expand Down

0 comments on commit e54d96a

Please sign in to comment.