File tree Expand file tree Collapse file tree 7 files changed +351
-17
lines changed
Expand file tree Collapse file tree 7 files changed +351
-17
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
33
4+ ## 0.1.2 - 2021-05-24
5+
6+ - Fix other ` sidecar:configure ` AWS errors. ([ #8 ] ( https://github.com/hammerstonedev/sidecar/issues/8 ) & ([ #9 ] ( https://github.com/hammerstonedev/sidecar/issues/9 ) )
7+
48## 0.1.1 - 2021-05-24
59
610- Fix undefined ` choice ` ([ #7 ] ( https://github.com/hammerstonedev/sidecar/issues/7 ) )
Original file line number Diff line number Diff line change 77
88use Aws \S3 \S3Client ;
99use Illuminate \Support \Str ;
10+ use Throwable ;
1011
1112class CreateBucket extends BaseAction
1213{
@@ -27,7 +28,7 @@ public function invoke()
2728 {
2829 $ this ->client = $ this ->command ->client (S3Client::class);
2930
30- $ this ->bucket = config ('sidecar.aws_bucket ' , $ this ->defaultBucketName () );
31+ $ this ->bucket = config ('sidecar.aws_bucket ' ) ?? $ this ->defaultBucketName ();
3132
3233 $ this ->ensureBucketIsPrefixed ();
3334
Original file line number Diff line number Diff line change 66namespace Hammerstone \Sidecar \Commands \Actions ;
77
88use Aws \Iam \IamClient ;
9+ use Illuminate \Support \Arr ;
10+ use Throwable ;
911
1012class CreateDeploymentUser extends BaseAction
1113{
@@ -113,7 +115,7 @@ protected function issueCredentials()
113115 'UserName ' => 'sidecar-deployment-user ' ,
114116 ]);
115117
116- if (!$ keys -> count ()) {
118+ if (!count ($ keys )) {
117119 return $ this ->createAccessKey ();
118120 }
119121
@@ -149,8 +151,8 @@ protected function createAccessKey()
149151 ]);
150152
151153 return [
152- 'key ' => $ result-> search ( 'AccessKey.AccessKeyId ' ),
153- 'secret ' => $ result-> search ( 'AccessKey.SecretAccessKey ' ),
154+ 'key ' => Arr:: get ( $ result, 'AccessKey.AccessKeyId ' ),
155+ 'secret ' => Arr:: get ( $ result, 'AccessKey.SecretAccessKey ' ),
154156 ];
155157 }
156158}
Original file line number Diff line number Diff line change 66namespace Hammerstone \Sidecar \Commands \Actions ;
77
88use Aws \Iam \IamClient ;
9+ use Illuminate \Support \Arr ;
10+ use Throwable ;
911
1012class CreateExecutionRole extends BaseAction
1113{
@@ -20,7 +22,7 @@ public function invoke()
2022
2123 $ this ->client = $ this ->command ->client (IamClient::class);
2224
23- $ role = $ this ->findOrCreateRole ()-> search ( 'Role.Arn ' );
25+ $ role = Arr:: get ( $ this ->findOrCreateRole (), 'Role.Arn ' );
2426
2527 $ this ->attachPolicy ();
2628
Original file line number Diff line number Diff line change 66namespace Hammerstone \Sidecar \Commands \Actions ;
77
88use Aws \Iam \IamClient ;
9+ use Throwable ;
910
1011class DestroyAdminKeys extends BaseAction
1112{
12- public function invoke ($ key )
13+ public $ key ;
14+
15+ public function setKey ($ key )
16+ {
17+ $ this ->key = $ key ;
18+
19+ return $ this ;
20+ }
21+
22+ public function invoke ()
1323 {
1424 $ client = $ this ->command ->client (IamClient::class);
1525
@@ -25,15 +35,15 @@ public function invoke($key)
2535 "Now that everything is setup, would you like to remove the admin access keys for user ` $ name` from AWS? \n" .
2636 ' Sidecar no longer needs them. ' ;
2737
28- if (!$ this ->confirm ($ question , $ default = true )) {
38+ if (!$ this ->command -> confirm ($ question , $ default = true )) {
2939 return ;
3040 }
3141
3242 $ this ->progress ('Deleting admin keys... ' );
3343
3444 try {
3545 $ client ->deleteAccessKey ([
36- 'AccessKeyId ' => $ key ,
46+ 'AccessKeyId ' => $ this -> key ,
3747 'UserName ' => $ name ,
3848 ]);
3949 } catch (Throwable $ e ) {
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public function handle()
6464
6565 $ credentials = $ this ->action (CreateDeploymentUser::class)->invoke ();
6666
67- $ this ->action (DestroyAdminKeys::class)->invoke ($ this ->key );
67+ $ this ->action (DestroyAdminKeys::class)->setKey ($ this ->key )-> invoke ( );
6868
6969 $ this ->line (' ' );
7070 $ this ->info ('Done! Here are your environment variables: ' );
@@ -84,12 +84,14 @@ public function text($text)
8484
8585 public function client ($ class )
8686 {
87- return new $ class ([
88- 'region ' => $ this ->region ,
89- 'version ' => 'latest ' ,
90- 'credentials ' => [
91- 'key ' => $ this ->key ,
92- 'secret ' => $ this ->secret
87+ return app ()->make ($ class , [
88+ 'args ' => [
89+ 'region ' => $ this ->region ,
90+ 'version ' => 'latest ' ,
91+ 'credentials ' => [
92+ 'key ' => $ this ->key ,
93+ 'secret ' => $ this ->secret
94+ ]
9395 ]
9496 ]);
9597 }
You can’t perform that action at this time.
0 commit comments