Skip to content

Commit

Permalink
fix(backend): make sure license type is mapped correctly
Browse files Browse the repository at this point in the history
Make sure license type is mapped correctly in console

Signed-off-by: Santiago Jimenez Giraldo <[email protected]>
  • Loading branch information
sago2k8 committed Dec 2, 2024
1 parent fb36e03 commit 13177f8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion backend/pkg/api/connect/service/license/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ import (
"github.com/redpanda-data/console/backend/pkg/redpanda"
)

// license types returned by the admin API
var (
rpAdminLicenseTypeEnterprise = "enterprise"
rpAdminLicenseTypeFreeTrial = "free_trial"

Check failure on line 24 in backend/pkg/api/connect/service/license/mapper.go

View workflow job for this annotation

GitHub Actions / Lint & Test Backend

var `rpAdminLicenseTypeFreeTrial` is unused (unused)
)

type mapper struct{}

func (mapper) adminAPILicenseInformationToProto(in rpadmin.License) *v1alpha1.License {
Expand All @@ -26,7 +32,12 @@ func (mapper) adminAPILicenseInformationToProto(in rpadmin.License) *v1alpha1.Li
licenseType := v1alpha1.License_TYPE_COMMUNITY

if in.Loaded {
licenseType = v1alpha1.License_TYPE_ENTERPRISE
if in.Properties.Type == rpAdminLicenseTypeEnterprise {
licenseType = v1alpha1.License_TYPE_ENTERPRISE
} else {
licenseType = v1alpha1.License_TYPE_TRIAL
}

expiresAt = in.Properties.Expires
}

Expand All @@ -44,6 +55,8 @@ func (mapper) consoleLicenseToProto(in redpanda.License) *v1alpha1.License {
licenseType = v1alpha1.License_TYPE_COMMUNITY
case redpanda.LicenseTypeEnterprise:
licenseType = v1alpha1.License_TYPE_ENTERPRISE
case redpanda.LicenseTypeFreeTrial:
licenseType = v1alpha1.License_TYPE_TRIAL
default:
licenseType = v1alpha1.License_TYPE_COMMUNITY
}
Expand Down

0 comments on commit 13177f8

Please sign in to comment.