Skip to content

Commit e82e8c7

Browse files
committed
BUG/MINOR: read only fields for SSL certificate resource
Signed-off-by: Dario Tranchitella <dtranchitella@haproxy.com>
1 parent 9a6c798 commit e82e8c7

6 files changed

Lines changed: 170 additions & 7 deletions

File tree

configuration/program.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func ParseProgram(p parser.Parser, name string) (*models.Program, error) {
193193
}
194194
}
195195

196-
program.Command = misc.StringP((data.(*types.Command)).Args)
196+
program.Command = misc.StringP(data.(*types.Command).Args)
197197

198198
data, err = p.Get(parser.Program, name, "user")
199199
if err == nil {

e2e/test_client.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ func GetClient(t *testing.T) (*ClientResponse, error) { //nolint:thelper
8888
}
8989

9090
HAProxyCFG := "haproxy.cfg"
91-
confClient, err := configuration.New(t.Context(),
91+
confClient, err := configuration.New(
92+
t.Context(),
9293
configuration_options.ConfigurationFile(HAProxyCFG),
9394
// options.UsePersistentTransactions,
9495
configuration_options.TransactionsDir(os.TempDir()),
@@ -124,7 +125,8 @@ func GetClient(t *testing.T) (*ClientResponse, error) { //nolint:thelper
124125
if err != nil {
125126
return nil, err
126127
}
127-
nativeAPI, err := clientnative.New(t.Context(),
128+
nativeAPI, err := clientnative.New(
129+
t.Context(),
128130
options.Configuration(confClient),
129131
options.Runtime(runtimeClient),
130132
)

models/ssl_certificate.go

Lines changed: 140 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/build/haproxy_spec.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9444,16 +9444,20 @@ definitions:
94449444
description: A file containing one or more SSL/TLS certificates and keys
94459445
properties:
94469446
algorithm:
9447+
readOnly: true
94479448
type: string
94489449
authority_key_id:
9450+
readOnly: true
94499451
type: string
94509452
description:
9453+
readOnly: true
94519454
type: string
94529455
domains:
94539456
readOnly: true
94549457
type: string
94559458
x-omitempty: true
94569459
file:
9460+
readOnly: true
94579461
type: string
94589462
ip_addresses:
94599463
readOnly: true
@@ -9478,21 +9482,27 @@ definitions:
94789482
serial:
94799483
type: string
94809484
sha1_finger_print:
9485+
readOnly: true
94819486
type: string
94829487
sha256_finger_print:
9488+
readOnly: true
94839489
type: string
94849490
size:
94859491
description: File size in bytes.
94869492
readOnly: true
94879493
type: integer
94889494
x-nullable: true
94899495
storage_name:
9496+
readOnly: true
94909497
type: string
94919498
subject:
9499+
readOnly: true
94929500
type: string
94939501
subject_alternative_names:
9502+
readOnly: true
94949503
type: string
94959504
subject_key_id:
9505+
readOnly: true
94969506
type: string
94979507
title: SSL File
94989508
type: object

specification/models/storage/ssl_certificate.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ ssl_certificate:
55
type: object
66
properties:
77
file:
8+
readOnly: true
89
type: string
910
storage_name:
11+
readOnly: true
1012
type: string
1113
description:
14+
readOnly: true
1215
type: string
1316
size:
14-
type: integer
1517
readOnly: true
18+
type: integer
1619
x-nullable: true
1720
description: File size in bytes.
1821
serial:
@@ -30,28 +33,35 @@ ssl_certificate:
3033
x-nullable: true
3134
x-go-custom-tag: gorm:"type:timestamp with time zone"
3235
algorithm:
36+
readOnly: true
3337
type: string
3438
sha1_finger_print:
39+
readOnly: true
3540
type: string
3641
sha256_finger_print:
42+
readOnly: true
3743
type: string
3844
domains:
39-
type: string
4045
readOnly: true
46+
type: string
4147
x-omitempty: true
4248
issuers:
4349
type: string
4450
readOnly: true
4551
x-omitempty: true
4652
ip_addresses:
47-
type: string
4853
readOnly: true
54+
type: string
4955
x-omitempty: true
5056
authority_key_id:
57+
readOnly: true
5158
type: string
5259
subject:
60+
readOnly: true
5361
type: string
5462
subject_alternative_names:
63+
readOnly: true
5564
type: string
5665
subject_key_id:
66+
readOnly: true
5767
type: string

test/configuration_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,8 @@ func deleteTestFile(path string) error {
10651065
}
10661066

10671067
func prepareClient(path string) (c configuration.Configuration, err error) {
1068-
c, err = configuration.New(context.Background(),
1068+
c, err = configuration.New(
1069+
context.Background(),
10691070
options.ConfigurationFile(path),
10701071
options.HAProxyBin("echo"),
10711072
options.UseModelsValidation,

0 commit comments

Comments
 (0)