diff --git a/pkg/internal/venafi/api/api.go b/pkg/internal/venafi/api/api.go index cc574494f..e2e44c661 100644 --- a/pkg/internal/venafi/api/api.go +++ b/pkg/internal/venafi/api/api.go @@ -16,13 +16,15 @@ limitations under the License. package api -import ( - "github.com/Venafi/vcert/pkg/certificate" +type CustomFieldType string + +const ( + CustomFieldTypePlain CustomFieldType = "Plain" ) // CustomField defines a custom field to be passed to Venafi type CustomField struct { - Type certificate.CustomFieldType `json:"type,omitempty"` - Name string `json:"name"` - Value string `json:"value"` + Type CustomFieldType `json:"type,omitempty"` + Name string `json:"name"` + Value string `json:"value"` } diff --git a/pkg/internal/venafi/sign.go b/pkg/internal/venafi/sign.go index abd19b1a8..dd8152825 100644 --- a/pkg/internal/venafi/sign.go +++ b/pkg/internal/venafi/sign.go @@ -52,7 +52,20 @@ func (v *Venafi) Sign(csrPEM []byte, duration time.Duration, customFields []inte if len(customFields) > 0 { vreq.CustomFields = []certificate.CustomField{} for _, field := range customFields { - vreq.CustomFields = append(vreq.CustomFields, certificate.CustomField(field)) + var fieldType certificate.CustomFieldType + switch field.Type { + case internalvanafiapi.CustomFieldTypePlain: + fieldType = certificate.CustomFieldPlain + break + default: + fieldType = certificate.CustomFieldPlain + } + + vreq.CustomFields = append(vreq.CustomFields, certificate.CustomField{ + Type: fieldType, + Name: field.Name, + Value: field.Value, + }) } }