Skip to content

Commit d698f04

Browse files
committed
feat(models/integration_manifest): Add V3 integration_manifest support.
Signed-off-by: spbsoluble <1661003+spbsoluble@users.noreply.github.com>
1 parent 3ee467c commit d698f04

2 files changed

Lines changed: 44 additions & 17 deletions

File tree

cmd/integration_manifest.go

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,42 @@ import (
1818
"github.com/Keyfactor/keyfactor-go-client/v3/api"
1919
)
2020

21-
type IntegrationManifest struct {
22-
Schema string `json:"$schema"`
23-
IntegrationType string `json:"integration_type"`
24-
Name string `json:"name"`
25-
Status string `json:"status"`
26-
LinkGithub bool `json:"link_github"`
27-
UpdateCatalog bool `json:"update_catalog"`
28-
SupportLevel string `json:"support_level"`
29-
ReleaseDir string `json:"release_dir"`
30-
ReleaseProject string `json:"release_project"`
31-
Description string `json:"description"`
32-
About About `json:"about"`
21+
type IntegrationManifestV2 struct {
22+
Schema string `json:"$schema"`
23+
IntegrationType string `json:"integration_type"`
24+
Name string `json:"name"`
25+
Status string `json:"status"`
26+
LinkGithub bool `json:"link_github"`
27+
UpdateCatalog bool `json:"update_catalog"`
28+
SupportLevel string `json:"support_level"`
29+
ReleaseDir string `json:"release_dir"`
30+
ReleaseProject string `json:"release_project"`
31+
Description string `json:"description"`
32+
About AboutV2 `json:"about"`
3333
}
3434

35-
type About struct {
35+
type IntegrationManifestV3 struct {
36+
Schema string `json:"$schema"`
37+
IntegrationType string `json:"integration_type"`
38+
Name string `json:"name"`
39+
Status string `json:"status"`
40+
LinkGithub bool `json:"link_github"`
41+
UpdateCatalog bool `json:"update_catalog"`
42+
SupportLevel string `json:"support_level"`
43+
ReleaseDir string `json:"release_dir"`
44+
ReleaseProject string `json:"release_project"`
45+
Description string `json:"description"`
46+
About AboutV3 `json:"about"`
47+
}
48+
49+
type AboutV2 struct {
3650
Orchestrator Orchestrator `json:"orchestrator,omitempty"`
37-
PAM PAM `json:"pam,omitempty"`
51+
PAM PAMV2 `json:"pam,omitempty"`
52+
}
53+
54+
type AboutV3 struct {
55+
Orchestrator Orchestrator `json:"orchestrator,omitempty"`
56+
PAM PAMV3 `json:"pam,omitempty"`
3857
}
3958

4059
type Orchestrator struct {
@@ -44,7 +63,15 @@ type Orchestrator struct {
4463
StoreTypes []api.CertificateStoreType `json:"store_types"`
4564
}
4665

47-
type PAM struct {
66+
type PAMV2 struct {
67+
Name string `json:"providerName"`
68+
AssemblyName string `json:"assemblyName"`
69+
DBName string `json:"dbName"`
70+
FullyQualifiedClassName string `json:"fullyQualifiedClassName"`
71+
PAMTypes map[string]api.ProviderTypeCreateRequest `json:"pam_types"`
72+
}
73+
74+
type PAMV3 struct {
4875
Name string `json:"providerName"`
4976
AssemblyName string `json:"assemblyName"`
5077
DBName string `json:"dbName"`

cmd/storeTypes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ func createStoreTypeFromFile(filename string, kfClient *api.Client) ([]api.Certi
439439
if err != nil || (sType.ShortName == "" && sType.Capability == "") {
440440
log.Warn().Err(err).Msg("Unable to decode JSON file, attempting to parse an integration manifest")
441441
// Attempt to parse as an integration manifest
442-
var manifest IntegrationManifest
442+
var manifest IntegrationManifestV2
443443
log.Debug().Msg("Decoding JSON file as integration manifest")
444444
// Reset the file pointer
445445
_, err = file.Seek(0, 0)
@@ -553,7 +553,7 @@ func getStoreTypesInternet(gitRef string, repo string) (map[string]interface{},
553553
if jErr != nil {
554554
log.Warn().Err(jErr).Msg("Unable to decode JSON file, attempting to parse an integration manifest")
555555
// Attempt to parse as an integration manifest
556-
var manifest IntegrationManifest
556+
var manifest IntegrationManifestV2
557557
log.Debug().Msg("Decoding JSON file as integration manifest")
558558
// Reset the file pointer
559559

0 commit comments

Comments
 (0)