Skip to content

Commit 8642a60

Browse files
committed
DICOM Gateway: fix various structures
Signed-off-by: Andy Lo-A-Foe <andy.loafoe@gmail.com>
1 parent 30f3220 commit 8642a60

6 files changed

Lines changed: 129 additions & 32 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
6+
## v0.19.10
7+
- DICOM Gateway: Fix various structures
8+
69
## v0.19.9
710
- IAM: Fix detection of purged user accounts
811

docs/resources/dicom_gateway_config.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ resource "hsdp_dicom_gateway_config" "dicom_gateway" {
1111
config_url = var.config_url
1212
1313
store_service {
14+
title = "Store title"
15+
1416
is_secure = false
1517
port = 104
1618
@@ -34,6 +36,8 @@ resource "hsdp_dicom_gateway_config" "dicom_gateway" {
3436
}
3537
3638
query_retrieve_service {
39+
title = "Query Retrieve Title"
40+
3741
is_secure = false
3842
port = 108
3943
@@ -58,24 +62,33 @@ resource "hsdp_dicom_gateway_config" "dicom_gateway" {
5862

5963
* `config_url` - (Required) The base config URL of the DICOM Store
6064
* `organization_id` - (Required) The site organization ID
61-
* `title` - Store Device Title
6265
* `store_service` - (Optional) Details of the DICOM Store SCP
66+
*`title` - Store Device Title
6367
* `is_secure` - Is secure. Default `false`
6468
* `port` - Port. Default `104` for Non-Secure and `105` for Secure. Don't change this.
6569
* `pdu_length` - PDU length. Default `65535`
6670
* `artim_timeout` - Time-out waiting for A-ASSOCIATE RQ PDU on open TCP/IP connection (Artim timeout). Default `3000 ms`
6771
* `association_idle_timeout` - Association idle timeout. `4500 ms`
72+
* `certificate_id` - (Optional) Certificate ID.
73+
Only needed for secure connections.
74+
* `authenticate_client_certificate` - (Optional, Boolean) Weather or not the client certificate is authenticated.
75+
Only needed for secure connections.
6876
* `application_entity` - Application entity
6977
* `allow_any` - Allow any. Value can be `true` or `false`
7078
* `ae_title` - AE title. Allowed characters for aetitle are `A-Za-z0-9\\s/+=_-`. Eg. `DicomStoreScp`
7179
* `site_organization_id` - Site Organization ID for which Gateway to be deployed
7280

73-
* `queryretrieve_service` - (Optional) the FHIR store configuration
81+
* `query_retrieve_service` - (Optional) the FHIR store configuration
82+
* `title` - Store Device Title
7483
* `is_secure` - Is secure. Default `false`
7584
* `port` - Port. Default `108` for Non-Secure and `109` for Secure. Don't change this.
7685
* `pdu_length` - PDU length. Default `65535`
7786
* `artim_timeout` - Time-out waiting for A-ASSOCIATE RQ PDU on open TCP/IP connection (Artim timeout). Default `3000 ms`
7887
* `association_idle_timeout` - Association idle timeout. `4500 ms`
88+
* `certificate_id` - (Optional) Certificate ID.
89+
Only needed for secure connections.
90+
* `authenticate_client_certificate` - (Optional, Boolean) Weather or not the client certificate is authenticated.
91+
Only needed for secure connections.
7992
* `application_entity` - Application entity
8093
* `allow_any` - Allow any. Value can be `true` or `false`
8194
* `ae_title` - AE title. Allowed characters for aetitle are `A-Za-z0-9\\s/+=_-`. Eg. `DicomQueryRetrieveScp`

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
2020
github.com/philips-labs/ferrite v0.1.2
2121
github.com/philips-labs/siderite v0.11.0
22-
github.com/philips-software/go-hsdp-api v0.43.1-0.20210915155239-581f687f4b60
22+
github.com/philips-software/go-hsdp-api v0.43.1-0.20210917134429-e32968bb2fac
2323
github.com/pkg/errors v0.9.1
2424
github.com/robfig/cron/v3 v3.0.1
2525
github.com/stretchr/testify v1.7.0

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,10 @@ github.com/philips-software/gautocloud-connectors v0.4.0/go.mod h1:k5VG78BLnDI75
945945
github.com/philips-software/go-hsdp-api v0.20.0/go.mod h1:agJtsgjb1W4xq5cVUdk06uUVETKO1nKZAZJ4Y1Dumg4=
946946
github.com/philips-software/go-hsdp-api v0.38.1-0.20210428141703-9f4371331e80/go.mod h1:vzZX4kCmgVwuJcAmd75Yeh/tNu1dNnBRbyau7CFWsuQ=
947947
github.com/philips-software/go-hsdp-api v0.42.2/go.mod h1:8/X/HGcmxfWMicqeVADZWwmPLGLA8hbqLr22w+ku5qE=
948-
github.com/philips-software/go-hsdp-api v0.43.1-0.20210915155239-581f687f4b60 h1:0rw4zAWwo+fv5YfVOXRVH5Ul+ShS5bToQZOKeOMwPJs=
949-
github.com/philips-software/go-hsdp-api v0.43.1-0.20210915155239-581f687f4b60/go.mod h1:g30qx/PUOGEd6/1zf4/Ym+EV6sbpNc+kmofmH2j09A4=
948+
github.com/philips-software/go-hsdp-api v0.43.1-0.20210917132941-dd9846a2e3e4 h1:n8/hlxK0CCYcB46+q7bn+cWZwPEnkUKauZ5Bp1HcLas=
949+
github.com/philips-software/go-hsdp-api v0.43.1-0.20210917132941-dd9846a2e3e4/go.mod h1:g30qx/PUOGEd6/1zf4/Ym+EV6sbpNc+kmofmH2j09A4=
950+
github.com/philips-software/go-hsdp-api v0.43.1-0.20210917134429-e32968bb2fac h1:q7UhLyxo8c0C56xiQZZe8sfgUIRFEN0iz8RcXz8/Sro=
951+
github.com/philips-software/go-hsdp-api v0.43.1-0.20210917134429-e32968bb2fac/go.mod h1:g30qx/PUOGEd6/1zf4/Ym+EV6sbpNc+kmofmH2j09A4=
950952
github.com/philips-software/go-hsdp-signer v1.3.0 h1:Si1voDE/GHzthmxpasPdntbu8aUW6EYJfI6gHVf7BCc=
951953
github.com/philips-software/go-hsdp-signer v1.3.0/go.mod h1:/QehZ/+Aks2t1TFpjhF/7ZSB8PJIIJHzLc03rOqwLw0=
952954
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=

hsdp/resource_dicom_gateway_config.go

Lines changed: 100 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,44 +52,55 @@ func resourceDICOMGatewayConfig() *schema.Resource {
5252
Required: true,
5353
ForceNew: true,
5454
},
55-
"title": {
56-
Type: schema.TypeString,
57-
Required: true,
58-
ForceNew: true,
59-
},
60-
"description": {
61-
Type: schema.TypeString,
62-
Optional: true,
63-
ForceNew: true,
64-
},
6555
"store_service": {
6656
Type: schema.TypeSet,
6757
Optional: true,
6858
ForceNew: true,
6959
MaxItems: 1,
7060
Elem: &schema.Resource{
7161
Schema: map[string]*schema.Schema{
62+
"title": {
63+
Type: schema.TypeString,
64+
Required: true,
65+
ForceNew: true,
66+
},
67+
"description": {
68+
Type: schema.TypeString,
69+
Optional: true,
70+
ForceNew: true,
71+
},
7272
"is_secure": {
7373
Type: schema.TypeBool,
7474
Required: true,
7575
},
7676
"port": {
7777
Type: schema.TypeInt,
7878
Optional: true,
79-
Default: 104,
79+
Default: 0,
8080
},
8181
// ---Advanced features start
8282
"pdu_length": {
8383
Type: schema.TypeInt,
8484
Optional: true,
85+
Default: 65535,
8586
},
8687
"artim_timeout": {
8788
Type: schema.TypeInt,
8889
Optional: true,
90+
Default: 3000,
8991
},
9092
"association_idle_timeout": {
9193
Type: schema.TypeInt,
9294
Optional: true,
95+
Default: 4500,
96+
},
97+
"certificate_id": {
98+
Type: schema.TypeString,
99+
Optional: true,
100+
},
101+
"authenticate_client_certificate": {
102+
Type: schema.TypeBool,
103+
Optional: true,
93104
},
94105
// ---Advanced features end
95106
"application_entity": schemaApplicationEntity(),
@@ -103,14 +114,48 @@ func resourceDICOMGatewayConfig() *schema.Resource {
103114
MaxItems: 1,
104115
Elem: &schema.Resource{
105116
Schema: map[string]*schema.Schema{
117+
"title": {
118+
Type: schema.TypeString,
119+
Required: true,
120+
ForceNew: true,
121+
},
122+
"description": {
123+
Type: schema.TypeString,
124+
Optional: true,
125+
ForceNew: true,
126+
},
106127
"is_secure": {
107128
Type: schema.TypeBool,
108129
Required: true,
109130
},
110131
"port": {
111132
Type: schema.TypeInt,
112133
Optional: true,
113-
Default: 104,
134+
Default: 0,
135+
},
136+
// ---Advanced features start
137+
"pdu_length": {
138+
Type: schema.TypeInt,
139+
Optional: true,
140+
Default: 65535,
141+
},
142+
"artim_timeout": {
143+
Type: schema.TypeInt,
144+
Optional: true,
145+
Default: 3000,
146+
},
147+
"association_idle_timeout": {
148+
Type: schema.TypeInt,
149+
Optional: true,
150+
Default: 4500,
151+
},
152+
"certificate_id": {
153+
Type: schema.TypeString,
154+
Optional: true,
155+
},
156+
"authenticate_client_certificate": {
157+
Type: schema.TypeBool,
158+
Optional: true,
114159
},
115160
"application_entity": schemaApplicationEntity(),
116161
},
@@ -224,18 +269,30 @@ func getSCPConfig(d *schema.ResourceData) (*dicom.SCPConfig, error) {
224269
vL := v.(*schema.Set).List()
225270
for _, vi := range vL {
226271
mVi := vi.(map[string]interface{})
272+
scpConfig.Title = mVi["title"].(string)
273+
scpConfig.Description = mVi["description"].(string)
227274
isSecure := mVi["is_secure"].(bool)
228275
port := mVi["port"].(int)
229276
pduLength := mVi["pdu_length"].(int)
230277
artimTimeout := mVi["artim_timeout"].(int)
231278
associationIdleIimeout := mVi["association_idle_timeout"].(int)
279+
certificateID := mVi["certificate_id"].(string)
280+
authenticateClientCertificate := mVi["authenticate_client_certificate"].(bool)
232281
if isSecure {
282+
if port == 0 {
283+
port = 105
284+
}
233285
scpConfig.SecureNetworkConnection.IsSecure = true
234286
scpConfig.SecureNetworkConnection.Port = port
235287
scpConfig.SecureNetworkConnection.AdvancedSettings.ArtimTimeOut = artimTimeout
236288
scpConfig.SecureNetworkConnection.AdvancedSettings.AssociationIdleTimeOut = associationIdleIimeout
237289
scpConfig.SecureNetworkConnection.AdvancedSettings.PDULength = pduLength
290+
scpConfig.SecureNetworkConnection.CertificateInfo.ID = certificateID
291+
scpConfig.SecureNetworkConnection.AuthenticateClientCertificate = authenticateClientCertificate
238292
} else {
293+
if port == 0 {
294+
port = 104
295+
}
239296
scpConfig.UnSecureNetworkConnection.IsSecure = false
240297
scpConfig.UnSecureNetworkConnection.Port = port
241298
scpConfig.UnSecureNetworkConnection.AdvancedSettings.ArtimTimeOut = artimTimeout
@@ -258,32 +315,51 @@ func getSCPConfig(d *schema.ResourceData) (*dicom.SCPConfig, error) {
258315
}
259316
}
260317
}
261-
scpConfig.Title = d.Get("title").(string)
262-
scpConfig.Description = d.Get("description").(string)
263318

264319
return &scpConfig, nil
265320
}
266321

267-
func getQueryConfig(d *schema.ResourceData) (*dicom.SCPConfig, error) {
268-
var queryConfig dicom.SCPConfig
322+
func getQueryRetrieveConfig(d *schema.ResourceData) (*dicom.SCPConfig, error) {
323+
var queryRetrieveConfig dicom.SCPConfig
269324
if v, ok := d.GetOk("query_retrieve_service"); ok {
270325
vL := v.(*schema.Set).List()
271326
for _, vi := range vL {
272327
mVi := vi.(map[string]interface{})
328+
queryRetrieveConfig.Title = mVi["title"].(string)
329+
queryRetrieveConfig.Description = mVi["description"].(string)
273330
isSecure := mVi["is_secure"].(bool)
274331
port := mVi["port"].(int)
332+
pduLength := mVi["pdu_length"].(int)
333+
artimTimeout := mVi["artim_timeout"].(int)
334+
associationIdleIimeout := mVi["association_idle_timeout"].(int)
335+
certificateID := mVi["certificate_id"].(string)
336+
authenticateClientCertificate := mVi["authenticate_client_certificate"].(bool)
275337
if isSecure {
276-
queryConfig.SecureNetworkConnection.IsSecure = true
277-
queryConfig.SecureNetworkConnection.Port = port
338+
if port == 0 {
339+
port = 109
340+
}
341+
queryRetrieveConfig.SecureNetworkConnection.IsSecure = true
342+
queryRetrieveConfig.SecureNetworkConnection.Port = port
343+
queryRetrieveConfig.SecureNetworkConnection.AdvancedSettings.ArtimTimeOut = artimTimeout
344+
queryRetrieveConfig.SecureNetworkConnection.AdvancedSettings.AssociationIdleTimeOut = associationIdleIimeout
345+
queryRetrieveConfig.SecureNetworkConnection.AdvancedSettings.PDULength = pduLength
346+
queryRetrieveConfig.SecureNetworkConnection.AuthenticateClientCertificate = authenticateClientCertificate
347+
queryRetrieveConfig.SecureNetworkConnection.CertificateInfo.ID = certificateID
278348
} else {
279-
queryConfig.UnSecureNetworkConnection.IsSecure = true
280-
queryConfig.UnSecureNetworkConnection.Port = port
349+
if port == 0 {
350+
port = 108
351+
}
352+
queryRetrieveConfig.UnSecureNetworkConnection.IsSecure = true
353+
queryRetrieveConfig.UnSecureNetworkConnection.Port = port
354+
queryRetrieveConfig.UnSecureNetworkConnection.AdvancedSettings.ArtimTimeOut = artimTimeout
355+
queryRetrieveConfig.UnSecureNetworkConnection.AdvancedSettings.AssociationIdleTimeOut = associationIdleIimeout
356+
queryRetrieveConfig.UnSecureNetworkConnection.AdvancedSettings.PDULength = pduLength
281357
}
282358
if as, ok := mVi["applications"].(*schema.Set); ok {
283359
aL := as.List()
284360
for _, entry := range aL {
285361
app := entry.(map[string]interface{})
286-
queryConfig.ApplicationEntities = append(queryConfig.ApplicationEntities, dicom.ApplicationEntity{
362+
queryRetrieveConfig.ApplicationEntities = append(queryRetrieveConfig.ApplicationEntities, dicom.ApplicationEntity{
287363
AllowAny: app["allow_any"].(bool),
288364
AeTitle: app["ae_title"].(string),
289365
OrganizationID: app["organization_id"].(string),
@@ -295,7 +371,7 @@ func getQueryConfig(d *schema.ResourceData) (*dicom.SCPConfig, error) {
295371
}
296372
}
297373
}
298-
return &queryConfig, nil
374+
return &queryRetrieveConfig, nil
299375
}
300376

301377
func resourceDICOMGatewayConfigCreate(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
@@ -316,9 +392,9 @@ func resourceDICOMGatewayConfigCreate(_ context.Context, d *schema.ResourceData,
316392
return diag.FromErr(fmt.Errorf("getSCPConfig: %w", err))
317393
}
318394

319-
queryConfig, err := getQueryConfig(d)
395+
queryConfig, err := getQueryRetrieveConfig(d)
320396
if err != nil {
321-
return diag.FromErr(fmt.Errorf("getQueryConfig: %w", err))
397+
return diag.FromErr(fmt.Errorf("getQueryRetrieveConfig: %w", err))
322398
}
323399

324400
createdSCPConfig, _, err := client.Config.SetStoreService(*scpConfig)

hsdp/resource_dicom_remote_node.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func resourceDICOMRemoteNode() *schema.Resource {
3232
},
3333
"title": {
3434
Type: schema.TypeString,
35-
Optional: true,
35+
Required: true,
3636
ForceNew: true,
3737
},
3838
"ae_title": {
@@ -65,25 +65,28 @@ func resourceDICOMRemoteNode() *schema.Resource {
6565
},
6666
"port": {
6767
Type: schema.TypeInt,
68-
Optional: true,
69-
Default: 104,
68+
Required: true,
7069
},
7170
"network_timeout": {
7271
Type: schema.TypeInt,
7372
Optional: true,
73+
Default: 3000,
7474
},
7575
// ---Advanced features start
7676
"pdu_length": {
7777
Type: schema.TypeInt,
7878
Optional: true,
79+
Default: 65535,
7980
},
8081
"artim_timeout": {
8182
Type: schema.TypeInt,
8283
Optional: true,
84+
Default: 3000,
8385
},
8486
"association_idle_timeout": {
8587
Type: schema.TypeInt,
8688
Optional: true,
89+
Default: 4500,
8790
},
8891
},
8992
},

0 commit comments

Comments
 (0)