Add is converting provisioners to linkedca.

The ids are required to be able to link admins with provisioners.
This commit is contained in:
Mariano Cano 2021-07-28 18:05:57 -07:00
parent e62d7988b8
commit 2620c38aee

View file

@ -716,6 +716,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
return nil, errors.Wrap(err, "error marshaling key") return nil, errors.Wrap(err, "error marshaling key")
} }
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_JWK, Type: linkedca.Provisioner_JWK,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{
@ -736,6 +737,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
return nil, err return nil, err
} }
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_OIDC, Type: linkedca.Provisioner_OIDC,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{
@ -762,6 +764,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
return nil, err return nil, err
} }
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_GCP, Type: linkedca.Provisioner_GCP,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{
@ -785,6 +788,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
return nil, err return nil, err
} }
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_AWS, Type: linkedca.Provisioner_AWS,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{
@ -807,6 +811,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
return nil, err return nil, err
} }
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_AZURE, Type: linkedca.Provisioner_AZURE,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{
@ -830,6 +835,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
return nil, err return nil, err
} }
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_ACME, Type: linkedca.Provisioner_ACME,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{
@ -849,6 +855,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
return nil, err return nil, err
} }
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_X5C, Type: linkedca.Provisioner_X5C,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{
@ -868,6 +875,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
return nil, err return nil, err
} }
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_K8SSA, Type: linkedca.Provisioner_K8SSA,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{
@ -883,6 +891,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
}, nil }, nil
case *provisioner.SSHPOP: case *provisioner.SSHPOP:
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_SSHPOP, Type: linkedca.Provisioner_SSHPOP,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{
@ -898,6 +907,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
return nil, err return nil, err
} }
return &linkedca.Provisioner{ return &linkedca.Provisioner{
Id: p.ID,
Type: linkedca.Provisioner_SCEP, Type: linkedca.Provisioner_SCEP,
Name: p.GetName(), Name: p.GetName(),
Details: &linkedca.ProvisionerDetails{ Details: &linkedca.ProvisionerDetails{