@@ -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
301377func 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 )
0 commit comments