@@ -83,6 +83,8 @@ private void SetupAddAetCommand()
8383
8484 private async Task < int > ListAeTitlehandlerAsync ( IHost host , bool verbose , CancellationToken cancellationToken )
8585 {
86+ Guard . Against . Null ( host , nameof ( host ) ) ;
87+
8688 this . LogVerbose ( verbose , host , "Configuring services..." ) ;
8789
8890 var console = host . Services . GetRequiredService < IConsole > ( ) ;
@@ -100,8 +102,9 @@ private async Task<int> ListAeTitlehandlerAsync(IHost host, bool verbose, Cancel
100102 IReadOnlyList < MonaiApplicationEntity > items = null ;
101103 try
102104 {
103- ConfigurationOptions config = LoadConfiguration ( verbose , configService , client ) ;
104- this . LogVerbose ( verbose , host , $ "Connecting to { Strings . ApplicationName } at { config . Endpoint } ...") ;
105+ CheckConfiguration ( configService ) ;
106+ client . ConfigureServiceUris ( configService . Configurations . InformaticsGatewayServerUri ) ;
107+ this . LogVerbose ( verbose , host , $ "Connecting to { Strings . ApplicationName } at { configService . Configurations . InformaticsGatewayServerEndpoint } ...") ;
105108 this . LogVerbose ( verbose , host , $ "Retrieving MONAI SCP AE Titles...") ;
106109 items = await client . MonaiScpAeTitle . List ( cancellationToken ) ;
107110 }
@@ -142,6 +145,9 @@ private async Task<int> ListAeTitlehandlerAsync(IHost host, bool verbose, Cancel
142145
143146 private async Task < int > RemoveAeTitlehandlerAsync ( string name , IHost host , bool verbose , CancellationToken cancellationToken )
144147 {
148+ Guard . Against . NullOrWhiteSpace ( name , nameof ( name ) ) ;
149+ Guard . Against . Null ( host , nameof ( host ) ) ;
150+
145151 this . LogVerbose ( verbose , host , "Configuring services..." ) ;
146152 var configService = host . Services . GetRequiredService < IConfigurationService > ( ) ;
147153 var client = host . Services . GetRequiredService < IInformaticsGatewayClient > ( ) ;
@@ -153,8 +159,9 @@ private async Task<int> RemoveAeTitlehandlerAsync(string name, IHost host, bool
153159
154160 try
155161 {
156- ConfigurationOptions config = LoadConfiguration ( verbose , configService , client ) ;
157- this . LogVerbose ( verbose , host , $ "Connecting to { Strings . ApplicationName } at { config . Endpoint } ...") ;
162+ CheckConfiguration ( configService ) ;
163+ client . ConfigureServiceUris ( configService . Configurations . InformaticsGatewayServerUri ) ;
164+ this . LogVerbose ( verbose , host , $ "Connecting to { Strings . ApplicationName } at { configService . Configurations . InformaticsGatewayServerEndpoint } ...") ;
158165 this . LogVerbose ( verbose , host , $ "Deleting MONAI SCP AE Title { name } ...") ;
159166 _ = await client . MonaiScpAeTitle . Delete ( name , cancellationToken ) ;
160167 logger . Log ( LogLevel . Information , $ "MONAI SCP AE Title '{ name } ' deleted.") ;
@@ -174,6 +181,9 @@ private async Task<int> RemoveAeTitlehandlerAsync(string name, IHost host, bool
174181
175182 private async Task < int > AddAeTitlehandlerAsync ( MonaiApplicationEntity entity , IHost host , bool verbose , CancellationToken cancellationToken )
176183 {
184+ Guard . Against . Null ( entity , nameof ( entity ) ) ;
185+ Guard . Against . Null ( host , nameof ( host ) ) ;
186+
177187 this . LogVerbose ( verbose , host , "Configuring services..." ) ;
178188 var configService = host . Services . GetRequiredService < IConfigurationService > ( ) ;
179189 var client = host . Services . GetRequiredService < IInformaticsGatewayClient > ( ) ;
@@ -185,9 +195,10 @@ private async Task<int> AddAeTitlehandlerAsync(MonaiApplicationEntity entity, IH
185195
186196 try
187197 {
188- ConfigurationOptions config = LoadConfiguration ( verbose , configService , client ) ;
198+ CheckConfiguration ( configService ) ;
199+ client . ConfigureServiceUris ( configService . Configurations . InformaticsGatewayServerUri ) ;
189200
190- this . LogVerbose ( verbose , host , $ "Connecting to { Strings . ApplicationName } at { config . Endpoint } ...") ;
201+ this . LogVerbose ( verbose , host , $ "Connecting to { Strings . ApplicationName } at { configService . Configurations . InformaticsGatewayServerEndpoint } ...") ;
191202 var result = await client . MonaiScpAeTitle . Create ( entity , cancellationToken ) ;
192203
193204 logger . Log ( LogLevel . Information , "New MONAI Deploy SCP Application Entity created:" ) ;
0 commit comments