@@ -2,83 +2,26 @@ package keyfactor
22
33import "github.com/hashicorp/vault/sdk/framework"
44
5- // addIssueAndSignCommonFields adds fields common to both CA and non-CA issuing
6- // and signing
7- func addIssueAndSignCommonFields (fields map [string ]* framework.FieldSchema ) map [string ]* framework.FieldSchema {
8- fields ["exclude_cn_from_sans" ] = & framework.FieldSchema {
9- Type : framework .TypeBool ,
10- Default : false ,
11- Description : `If true, the Common Name will not be
12- included in DNS or Email Subject Alternate Names.
13- Defaults to false (CN is included).` ,
14- DisplayAttrs : & framework.DisplayAttributes {
15- Name : "Exclude Common Name from Subject Alternative Names (SANs)" ,
16- },
17- }
5+ // addNonCACommonFields adds fields with help text specific to non-CA
6+ // certificate issuing and signing
7+ func addNonCACommonFields (fields map [string ]* framework.FieldSchema ) map [string ]* framework.FieldSchema {
188
19- fields ["format" ] = & framework.FieldSchema {
20- Type : framework .TypeString ,
21- Default : "pem" ,
22- Description : `Format for returned data. Can be "pem", "der",
23- or "pem_bundle". If "pem_bundle" any private
24- key and issuing cert will be appended to the
25- certificate pem. Defaults to "pem".` ,
26- AllowedValues : []interface {}{"pem" , "der" , "pem_bundle" },
27- DisplayAttrs : & framework.DisplayAttributes {
28- Value : "pem" ,
29- },
9+ fields ["ca" ] = & framework.FieldSchema {
10+ Type : framework .TypeString ,
11+ Description : `Specify the CA to use for the request in the format "<host\\logical>". If blank, will use the default from configuration.` ,
3012 }
3113
32- fields ["private_key_format" ] = & framework.FieldSchema {
33- Type : framework .TypeString ,
34- Default : "der" ,
35- Description : `Format for the returned private key.
36- Generally the default will be controlled by the "format"
37- parameter as either base64-encoded DER or PEM-encoded DER.
38- However, this can be set to "pkcs8" to have the returned
39- private key contain base64-encoded pkcs8 or PEM-encoded
40- pkcs8 instead. Defaults to "der".` ,
41- AllowedValues : []interface {}{"" , "der" , "pem" , "pkcs8" },
42- DisplayAttrs : & framework.DisplayAttributes {
43- Value : "der" ,
44- },
14+ fields ["template" ] = & framework.FieldSchema {
15+ Type : framework .TypeString ,
16+ Description : `Specify the name of the certificate template to use for the request. If blank, will use the default from configuration.` ,
4517 }
4618
47- fields ["ip_sans" ] = & framework.FieldSchema {
48- Type : framework .TypeCommaStringSlice ,
49- Description : `The requested IP SANs, if any, in a
50- comma-delimited list` ,
51- DisplayAttrs : & framework.DisplayAttributes {
52- Name : "IP Subject Alternative Names (SANs)" ,
53- },
19+ fields ["dns_sans" ] = & framework.FieldSchema {
20+ Type : framework .TypeString ,
21+ Description : `Comma seperated list of DNS Subject Alternative Names` ,
22+ Required : true ,
5423 }
5524
56- fields ["uri_sans" ] = & framework.FieldSchema {
57- Type : framework .TypeCommaStringSlice ,
58- Description : `The requested URI SANs, if any, in a
59- comma-delimited list.` ,
60- DisplayAttrs : & framework.DisplayAttributes {
61- Name : "URI Subject Alternative Names (SANs)" ,
62- },
63- }
64-
65- fields ["other_sans" ] = & framework.FieldSchema {
66- Type : framework .TypeCommaStringSlice ,
67- Description : `Requested other SANs, in an array with the format
68- <oid>;UTF8:<utf8 string value> for each entry.` ,
69- DisplayAttrs : & framework.DisplayAttributes {
70- Name : "Other SANs" ,
71- },
72- }
73-
74- return fields
75- }
76-
77- // addNonCACommonFields adds fields with help text specific to non-CA
78- // certificate issuing and signing
79- func addNonCACommonFields (fields map [string ]* framework.FieldSchema ) map [string ]* framework.FieldSchema {
80- fields = addIssueAndSignCommonFields (fields )
81-
8225 fields ["role" ] = & framework.FieldSchema {
8326 Type : framework .TypeString ,
8427 Description : `The desired role with configuration for this
@@ -91,6 +34,7 @@ request`,
9134one, specify the alternative names in the
9235alt_names map. If email protection is enabled
9336in the role, this may be an email address.` ,
37+ Required : true ,
9438 }
9539
9640 fields ["alt_names" ] = & framework.FieldSchema {
0 commit comments