use of com.amazonaws.auth.profile.internal.BasicProfile in project intellij-idea-plugin-connector-for-aws-lambda by satr.
the class FunctionConnectorModel method getCredentialProfiles.
public OperationValueResult<List<CredentialProfileEntity>> getCredentialProfiles() {
OperationValueResult<List<CredentialProfileEntity>> valueResult = new OperationValueResultImpl<>();
ArrayList<CredentialProfileEntity> credentialProfilesEntries = new ArrayList<>();
valueResult.setValue(credentialProfilesEntries);
if (!validateCredentialProfilesExist()) {
valueResult.addWarning("No credential profiles file found.\n To create one - please follow the instruction:\n https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html ");
return valueResult;
}
ProfilesConfigFile profilesConfigFile = new ProfilesConfigFile();
Map<String, BasicProfile> profiles = profilesConfigFile.getAllBasicProfiles();
for (String credentialProfileName : profiles.keySet()) {
credentialProfilesEntries.add(new CredentialProfileEntity(credentialProfileName, profiles.get(credentialProfileName)));
}
valueResult.addInfo("Found %d credential profiles.", credentialProfilesEntries.size());
return valueResult;
}
use of com.amazonaws.auth.profile.internal.BasicProfile in project intellij-idea-plugin-connector-for-aws-lambda by satr.
the class ConnectorPresenterImpl method setCredentialProfile.
@Override
public void setCredentialProfile(CredentialProfileEntity credentialProfileEntity) {
BasicProfile basicProfile = credentialProfileEntity.getBasicProfile();
Regions lastSelectedRegion = getLastSelectedRegion();
Regions region = lastSelectedRegion;
if (!isEmpty(basicProfile.getRegion())) {
region = tryGetRegionBy(basicProfile.getRegion());
}
if (region == null) {
region = lastSelectedRegion;
}
String credentialProfile = credentialProfileEntity.getName();
getConnectorSettings().setLastSelectedCredentialProfile(credentialProfile);
setRegionAndProfile(region, credentialProfile);
if (!lastSelectedRegion.getName().equals(region.getName())) {
view.setRegion(region);
}
CredentialProfileEntity profileEntity = view.getSelectedCredentialProfileEntity();
if (profileEntity == null) {
getLogger().logInfo("Credential profile is not selected.");
} else {
getLogger().logInfo("Selected Credential profile: \"%s\"", profileEntity.getName());
}
refreshStatus();
}
Aggregations