@@ -89,14 +89,17 @@ impl ShellConfig {
89
89
}
90
90
91
91
for value in config. capella_orgs_mut ( ) {
92
+ let identifier = value. identifier ( ) . to_owned ( ) ;
92
93
let config_credentials = value. credentials_mut ( ) ;
93
94
94
95
for cred in & standalone. capella_orgs {
95
- if config_credentials. secret_key . is_empty ( ) && !cred. secret_key . is_empty ( ) {
96
- config_credentials. secret_key = cred. secret_key . clone ( )
97
- }
98
- if config_credentials. access_key . is_empty ( ) && !cred. access_key . is_empty ( ) {
99
- config_credentials. access_key = cred. access_key . clone ( )
96
+ if cred. identifier ( ) == identifier {
97
+ if config_credentials. secret_key . is_empty ( ) && !cred. secret_key . is_empty ( ) {
98
+ config_credentials. secret_key = cred. secret_key . clone ( )
99
+ }
100
+ if config_credentials. access_key . is_empty ( ) && !cred. access_key . is_empty ( ) {
101
+ config_credentials. access_key = cred. access_key . clone ( )
102
+ }
100
103
}
101
104
}
102
105
}
@@ -232,7 +235,7 @@ fn try_credentials_from_path(mut path: PathBuf) -> Option<StandaloneCredentialsC
232
235
pub struct CapellaOrganizationConfig {
233
236
identifier : String ,
234
237
#[ serde( flatten) ]
235
- credentials : CapellaOrganizationCredentials ,
238
+ credentials : OrganizationCredentials ,
236
239
#[ serde( default ) ]
237
240
#[ serde(
238
241
rename( deserialize = "management-timeout" , serialize = "management-timeout" ) ,
@@ -253,7 +256,7 @@ impl CapellaOrganizationConfig {
253
256
) -> Self {
254
257
Self {
255
258
identifier,
256
- credentials : CapellaOrganizationCredentials {
259
+ credentials : OrganizationCredentials {
257
260
access_key,
258
261
secret_key,
259
262
} ,
@@ -277,7 +280,7 @@ impl CapellaOrganizationConfig {
277
280
self . default_project . as_ref ( ) . cloned ( )
278
281
}
279
282
280
- pub fn credentials_mut ( & mut self ) -> & mut CapellaOrganizationCredentials {
283
+ pub fn credentials_mut ( & mut self ) -> & mut OrganizationCredentials {
281
284
& mut self . credentials
282
285
}
283
286
}
@@ -529,7 +532,7 @@ impl From<(String, &RemoteCluster)> for ClusterConfig {
529
532
}
530
533
531
534
#[ derive( Clone , Debug , Deserialize , Serialize ) ]
532
- pub struct CapellaOrganizationCredentials {
535
+ pub struct OrganizationCredentials {
533
536
#[ serde( default ) ]
534
537
#[ serde( rename( deserialize = "access-key" , serialize = "access-key" ) ) ]
535
538
access_key : String ,
@@ -538,7 +541,7 @@ pub struct CapellaOrganizationCredentials {
538
541
secret_key : String ,
539
542
}
540
543
541
- impl CapellaOrganizationCredentials { }
544
+ impl OrganizationCredentials { }
542
545
543
546
#[ derive( Debug , Deserialize , Serialize ) ]
544
547
pub struct ClusterCredentials {
@@ -687,7 +690,7 @@ pub struct StandaloneCredentialsConfig {
687
690
clusters : Vec < StandaloneClusterCredentials > ,
688
691
689
692
#[ serde( alias = "capella-organization" , default ) ]
690
- capella_orgs : Vec < CapellaOrganizationCredentials > ,
693
+ capella_orgs : Vec < StandaloneOrganizationCredentials > ,
691
694
692
695
#[ serde( alias = "llm" , default ) ]
693
696
llms : Vec < LLMCredentials > ,
@@ -719,6 +722,23 @@ impl Default for StandaloneCredentialsConfig {
719
722
}
720
723
}
721
724
725
+ #[ derive( Clone , Debug , Deserialize , Serialize ) ]
726
+ pub struct StandaloneOrganizationCredentials {
727
+ identifier : String ,
728
+ #[ serde( default ) ]
729
+ #[ serde( rename( deserialize = "access-key" , serialize = "access-key" ) ) ]
730
+ access_key : String ,
731
+ #[ serde( default ) ]
732
+ #[ serde( rename( deserialize = "secret-key" , serialize = "secret-key" ) ) ]
733
+ secret_key : String ,
734
+ }
735
+
736
+ impl StandaloneOrganizationCredentials {
737
+ fn identifier ( & self ) -> String {
738
+ self . identifier . clone ( )
739
+ }
740
+ }
741
+
722
742
#[ derive( Debug , Deserialize ) ]
723
743
pub struct StandaloneClusterCredentials {
724
744
identifier : String ,
0 commit comments