@@ -108,24 +108,18 @@ public class HubClientImplementation implements HubClient
108
108
{
109
109
this ( hubEnv );
110
110
111
- Preconditions .checkArgument ( !isBlank ( pgpKeyFilePath ) );
111
+ Preconditions .checkArgument ( !StringUtil . isBlank ( pgpKeyFilePath ) );
112
112
113
113
this .pgpKeyPassword = Strings .isNullOrEmpty ( pgpKeyPassword ) ? "" : pgpKeyPassword ;
114
114
115
115
loadSecretKey ( pgpKeyFilePath );
116
116
}
117
117
118
118
119
- private boolean isBlank ( String str )
120
- {
121
- return Strings .nullToEmpty ( str ).trim ().isEmpty ();
122
- }
123
-
124
-
125
119
public void login ( final String username , final String password )
126
120
{
127
- Preconditions .checkArgument ( !isBlank ( username ) );
128
- Preconditions .checkArgument ( !isBlank ( password ) );
121
+ Preconditions .checkArgument ( !StringUtil . isBlank ( username ) );
122
+ Preconditions .checkArgument ( !StringUtil . isBlank ( password ) );
129
123
130
124
HttpPost request =
131
125
new HttpPost ( String .format ( "https://%s.subut.ai/rest/v1/client/login" , hubEnv .getUrlPrefix () ) );
@@ -332,7 +326,7 @@ public List<Peer> getPublicPeers()
332
326
@ Override
333
327
public void sharePeer ( final String peerId , final long userId )
334
328
{
335
- Preconditions .checkArgument ( !isBlank ( peerId ) );
329
+ Preconditions .checkArgument ( !StringUtil . isBlank ( peerId ) );
336
330
Preconditions .checkArgument ( userId > 0 );
337
331
338
332
HttpPut request = new HttpPut (
@@ -356,7 +350,7 @@ public void sharePeer( final String peerId, final long userId )
356
350
@ Override
357
351
public void unsharePeer ( final String peerId , final long userId )
358
352
{
359
- Preconditions .checkArgument ( !isBlank ( peerId ) );
353
+ Preconditions .checkArgument ( !StringUtil . isBlank ( peerId ) );
360
354
Preconditions .checkArgument ( userId > 0 );
361
355
362
356
HttpDelete request = new HttpDelete (
@@ -380,7 +374,7 @@ public void unsharePeer( final String peerId, final long userId )
380
374
@ Override
381
375
public void addPeerToFavorites ( final String peerId )
382
376
{
383
- Preconditions .checkArgument ( !isBlank ( peerId ) );
377
+ Preconditions .checkArgument ( !StringUtil . isBlank ( peerId ) );
384
378
385
379
HttpPut request = new HttpPut (
386
380
String .format ( "https://%s.subut.ai/rest/v1/client/peers/favorite/%s" , hubEnv .getUrlPrefix (),
@@ -403,7 +397,7 @@ public void addPeerToFavorites( final String peerId )
403
397
@ Override
404
398
public void removePeerFromFavorites ( final String peerId )
405
399
{
406
- Preconditions .checkArgument ( !isBlank ( peerId ) );
400
+ Preconditions .checkArgument ( !StringUtil . isBlank ( peerId ) );
407
401
408
402
HttpDelete request = new HttpDelete (
409
403
String .format ( "https://%s.subut.ai/rest/v1/client/peers/favorite/%s" , hubEnv .getUrlPrefix (),
@@ -426,7 +420,7 @@ public void removePeerFromFavorites( final String peerId )
426
420
@ Override
427
421
public void updatePeerScope ( final String peerId , final Peer .Scope scope )
428
422
{
429
- Preconditions .checkArgument ( !isBlank ( peerId ) );
423
+ Preconditions .checkArgument ( !StringUtil . isBlank ( peerId ) );
430
424
Preconditions .checkNotNull ( scope );
431
425
432
426
HttpPut request = new HttpPut (
@@ -450,8 +444,8 @@ public void updatePeerScope( final String peerId, final Peer.Scope scope )
450
444
@ Override
451
445
public void updatePeerName ( final String peerId , final String name )
452
446
{
453
- Preconditions .checkArgument ( !isBlank ( peerId ) );
454
- Preconditions .checkArgument ( !isBlank ( name ) );
447
+ Preconditions .checkArgument ( !StringUtil . isBlank ( peerId ) );
448
+ Preconditions .checkArgument ( !StringUtil . isBlank ( name ) );
455
449
456
450
CloseableHttpResponse response = null ;
457
451
try
@@ -480,7 +474,7 @@ public void updatePeerName( final String peerId, final String name )
480
474
@ Override
481
475
public List <SshKey > getSshKeys ( final String envId )
482
476
{
483
- Preconditions .checkArgument ( !isBlank ( envId ) );
477
+ Preconditions .checkArgument ( !StringUtil . isBlank ( envId ) );
484
478
485
479
List <SshKey > sshKeys = Lists .newArrayList ();
486
480
@@ -510,8 +504,8 @@ public List<SshKey> getSshKeys( final String envId )
510
504
511
505
public void addSshKey ( final String envId , final String sshKey )
512
506
{
513
- Preconditions .checkArgument ( !isBlank ( envId ) );
514
- Preconditions .checkArgument ( !isBlank ( sshKey ) );
507
+ Preconditions .checkArgument ( !StringUtil . isBlank ( envId ) );
508
+ Preconditions .checkArgument ( !StringUtil . isBlank ( sshKey ) );
515
509
516
510
HttpPost request = new HttpPost (
517
511
String .format ( "https://%s.subut.ai/rest/v1/client/environments/%s/ssh-keys/add" , hubEnv .getUrlPrefix (),
@@ -537,8 +531,8 @@ public void addSshKey( final String envId, final String sshKey )
537
531
538
532
public void removeSshKey ( final String envId , final String sshKey )
539
533
{
540
- Preconditions .checkArgument ( !isBlank ( envId ) );
541
- Preconditions .checkArgument ( !isBlank ( sshKey ) );
534
+ Preconditions .checkArgument ( !StringUtil . isBlank ( envId ) );
535
+ Preconditions .checkArgument ( !StringUtil . isBlank ( sshKey ) );
542
536
543
537
HttpPost request = new HttpPost (
544
538
String .format ( "https://%s.subut.ai/rest/v1/client/environments/%s/ssh-keys/remove" ,
@@ -564,8 +558,8 @@ public void removeSshKey( final String envId, final String sshKey )
564
558
565
559
public void startContainer ( final String envId , final String contId )
566
560
{
567
- Preconditions .checkArgument ( !isBlank ( envId ) );
568
- Preconditions .checkArgument ( !isBlank ( contId ) );
561
+ Preconditions .checkArgument ( !StringUtil . isBlank ( envId ) );
562
+ Preconditions .checkArgument ( !StringUtil . isBlank ( contId ) );
569
563
570
564
HttpPut request = new HttpPut (
571
565
String .format ( "https://%s.subut.ai/rest/v1/client/environments/%s/containers/%s/start" ,
@@ -587,8 +581,8 @@ public void startContainer( final String envId, final String contId )
587
581
588
582
public void stopContainer ( final String envId , final String contId )
589
583
{
590
- Preconditions .checkArgument ( !isBlank ( envId ) );
591
- Preconditions .checkArgument ( !isBlank ( contId ) );
584
+ Preconditions .checkArgument ( !StringUtil . isBlank ( envId ) );
585
+ Preconditions .checkArgument ( !StringUtil . isBlank ( contId ) );
592
586
593
587
HttpPut request = new HttpPut (
594
588
String .format ( "https://%s.subut.ai/rest/v1/client/environments/%s/containers/%s/stop" ,
@@ -610,8 +604,8 @@ public void stopContainer( final String envId, final String contId )
610
604
611
605
public void destroyContainer ( final String envId , final String contId )
612
606
{
613
- Preconditions .checkArgument ( !isBlank ( envId ) );
614
- Preconditions .checkArgument ( !isBlank ( contId ) );
607
+ Preconditions .checkArgument ( !StringUtil . isBlank ( envId ) );
608
+ Preconditions .checkArgument ( !StringUtil . isBlank ( contId ) );
615
609
616
610
HttpDelete request = new HttpDelete (
617
611
String .format ( "https://%s.subut.ai/rest/v1/client/environments/%s/containers/%s" ,
@@ -633,7 +627,7 @@ public void destroyContainer( final String envId, final String contId )
633
627
634
628
public EnvironmentCreationRequest createRequest ( final String environmentName )
635
629
{
636
- Preconditions .checkArgument ( !isBlank ( environmentName ) );
630
+ Preconditions .checkArgument ( !StringUtil . isBlank ( environmentName ) );
637
631
638
632
return new EnvironmentCreationRequestImpl ( environmentName );
639
633
}
@@ -654,7 +648,7 @@ public EnvironmentRef createEnvironment( final EnvironmentCreationRequest enviro
654
648
{
655
649
node .setTemplateName ( getTemplateNameById ( templates , node .getTemplateId () ) );
656
650
657
- Preconditions .checkArgument ( !isBlank ( node .getTemplateName () ),
651
+ Preconditions .checkArgument ( !StringUtil . isBlank ( node .getTemplateName () ),
658
652
"Template not found by id " + node .getTemplateId () );
659
653
}
660
654
//WORKAROUND!!!
@@ -689,7 +683,7 @@ public EnvironmentRef createEnvironment( final EnvironmentCreationRequest enviro
689
683
690
684
public EnvironmentModificationRequest modifyRequest ( final String envId )
691
685
{
692
- Preconditions .checkArgument ( !isBlank ( envId ) );
686
+ Preconditions .checkArgument ( !StringUtil . isBlank ( envId ) );
693
687
694
688
return new EnvironmentModificationRequestImpl ( envId );
695
689
}
@@ -783,7 +777,7 @@ String getTemplateNameById( final List<Template> templates, final String templat
783
777
784
778
public void destroyEnvironment ( final String envId )
785
779
{
786
- Preconditions .checkArgument ( !isBlank ( envId ) );
780
+ Preconditions .checkArgument ( !StringUtil . isBlank ( envId ) );
787
781
788
782
HttpDelete request = new HttpDelete (
789
783
String .format ( "https://%s.subut.ai/rest/v1/client/environments/%s" , hubEnv .getUrlPrefix (), envId ) );
@@ -808,6 +802,12 @@ public List<Template> getTemplates()
808
802
}
809
803
810
804
805
+ public void uploadFile ( String filename , String version )
806
+ {
807
+ kurjunClient .uploadFile ( filename , version , getKurjunToken () );
808
+ }
809
+
810
+
811
811
public Double getBalance ()
812
812
{
813
813
HttpGet request =
@@ -866,7 +866,7 @@ public User getUser( final long userId )
866
866
@ Override
867
867
public User findUserByName ( final String name )
868
868
{
869
- Preconditions .checkArgument ( !isBlank ( name ) );
869
+ Preconditions .checkArgument ( !StringUtil . isBlank ( name ) );
870
870
871
871
UserImpl user ;
872
872
CloseableHttpResponse response = null ;
@@ -902,7 +902,7 @@ public User findUserByName( final String name )
902
902
@ Override
903
903
public User findUserByEmail ( final String email )
904
904
{
905
- Preconditions .checkArgument ( !isBlank ( email ) );
905
+ Preconditions .checkArgument ( !StringUtil . isBlank ( email ) );
906
906
907
907
UserImpl user ;
908
908
CloseableHttpResponse response = null ;
@@ -970,7 +970,7 @@ public List<Peer> getUserPeers( final long userId )
970
970
@ Override
971
971
public List <User > getPeerUsers ( final String peerId )
972
972
{
973
- Preconditions .checkArgument ( !isBlank ( peerId ) );
973
+ Preconditions .checkArgument ( !StringUtil . isBlank ( peerId ) );
974
974
975
975
List <User > users = Lists .newArrayList ();
976
976
@@ -1099,7 +1099,7 @@ public List<Domain> getDomains()
1099
1099
@ Override
1100
1100
public void reserveDomain ( final String domainName )
1101
1101
{
1102
- Preconditions .checkArgument ( !isBlank ( domainName ) );
1102
+ Preconditions .checkArgument ( !StringUtil . isBlank ( domainName ) );
1103
1103
1104
1104
CloseableHttpResponse response = null ;
1105
1105
try
@@ -1128,7 +1128,7 @@ public void reserveDomain( final String domainName )
1128
1128
@ Override
1129
1129
public void deleteDomain ( final String domainName )
1130
1130
{
1131
- Preconditions .checkArgument ( !isBlank ( domainName ) );
1131
+ Preconditions .checkArgument ( !StringUtil . isBlank ( domainName ) );
1132
1132
1133
1133
CloseableHttpResponse response = null ;
1134
1134
try
0 commit comments