/** * Loads the credential profiles from the given input stream. * * @param is input stream from where the profile details are read. */ private AllProfiles loadProfiles(InputStream is) throws IOException { ProfilesConfigFileLoaderHelper helper = new ProfilesConfigFileLoaderHelper(); Map<String, Map<String, String>> allProfileProperties = helper .parseProfileProperties(new Scanner(is, StringUtils.UTF8.name())); // Convert the loaded property map to credential objects Map<String, BasicProfile> profilesByName = new LinkedHashMap<String, BasicProfile>(); for (Entry<String, Map<String, String>> entry : allProfileProperties.entrySet()) { String profileName = entry.getKey(); Map<String, String> properties = entry.getValue(); if (profileName.startsWith("profile ")) { LOG.warn( "Your profile name includes a 'profile ' prefix. This is considered part of the profile name in the " + "Java SDK, so you will need to include this prefix in your profile name when you reference this " + "profile from your Java code."); } assertParameterNotEmpty(profileName, "Unable to load properties from profile: Profile name is empty."); profilesByName.put(profileName, new BasicProfile(profileName, properties)); } return new AllProfiles(profilesByName); }
private static AllProfiles loadProfiles(File file) { return BasicProfileConfigLoader.INSTANCE.loadProfiles(file); }
private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); } }
/** * Loads the credential profiles from the given input stream. * * @param is input stream from where the profile details are read. */ private AllProfiles loadProfiles(InputStream is) throws IOException { ProfilesConfigFileLoaderHelper helper = new ProfilesConfigFileLoaderHelper(); Map<String, Map<String, String>> allProfileProperties = helper .parseProfileProperties(new Scanner(is, StringUtils.UTF8.name())); // Convert the loaded property map to credential objects Map<String, BasicProfile> profilesByName = new LinkedHashMap<String, BasicProfile>(); for (Entry<String, Map<String, String>> entry : allProfileProperties.entrySet()) { String profileName = entry.getKey(); Map<String, String> properties = entry.getValue(); if (profileName.startsWith("profile ")) { LOG.warn( "Your profile name includes a 'profile ' prefix. This is considered part of the profile name in the " + "Java SDK, so you will need to include this prefix in your profile name when you reference this " + "profile from your Java code."); } assertParameterNotEmpty(profileName, "Unable to load properties from profile: Profile name is empty."); profilesByName.put(profileName, new BasicProfile(profileName, properties)); } return new AllProfiles(profilesByName); }
private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); }
/** * Loads the credential profiles from the given input stream. * * @param is input stream from where the profile details are read. */ private AllProfiles loadProfiles(InputStream is) throws IOException { ProfilesConfigFileLoaderHelper helper = new ProfilesConfigFileLoaderHelper(); Map<String, Map<String, String>> allProfileProperties = helper .parseProfileProperties(new Scanner(is, StringUtils.UTF8.name())); // Convert the loaded property map to credential objects Map<String, BasicProfile> profilesByName = new LinkedHashMap<String, BasicProfile>(); for (Entry<String, Map<String, String>> entry : allProfileProperties.entrySet()) { String profileName = entry.getKey(); Map<String, String> properties = entry.getValue(); if (profileName.startsWith("profile ")) { LOG.warn( "The legacy profile format requires the 'profile ' prefix before the profile name. " + "The latest code does not require such prefix, and will consider it as part of the profile name. " + "Please remove the prefix if you are seeing this warning."); } assertParameterNotEmpty(profileName, "Unable to load properties from profile: Profile name is empty."); profilesByName.put(profileName, new BasicProfile(profileName, properties)); } return new AllProfiles(profilesByName); }
public AllProfiles loadProfiles(File file) { if (file == null) { throw new IllegalArgumentException( "Unable to load AWS profiles: specified file is null."); } if (!file.exists() || !file.isFile()) { throw new IllegalArgumentException( "AWS credential profiles file not found in the given path: " + file.getAbsolutePath()); } FileInputStream fis = null; try { fis = new FileInputStream(file); return loadProfiles(fis); } catch (IOException ioe) { throw new SdkClientException( "Unable to load AWS credential profiles file at: " + file.getAbsolutePath(), ioe); } finally { if (fis != null) { try { fis.close(); } catch (IOException ioe) { } } } }
private static AllProfiles loadProfiles(File file) { return BasicProfileConfigLoader.INSTANCE.loadProfiles(file); }
private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); }
private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); } }
public AllProfiles loadProfiles(File file) { if (file == null) { throw new IllegalArgumentException( "Unable to load AWS profiles: specified file is null."); } if (!file.exists() || !file.isFile()) { throw new IllegalArgumentException( "AWS credential profiles file not found in the given path: " + file.getAbsolutePath()); } FileInputStream fis = null; try { fis = new FileInputStream(file); return loadProfiles(fis); } catch (IOException ioe) { throw new SdkClientException( "Unable to load AWS credential profiles file at: " + file.getAbsolutePath(), ioe); } finally { if (fis != null) { try { fis.close(); } catch (IOException ioe) { } } } }
private static AllProfiles loadProfiles(File file) { return BasicProfileConfigLoader.INSTANCE.loadProfiles(file); }
private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); }
public AllProfiles loadProfiles(File file) { if (file == null) { throw new IllegalArgumentException( "Unable to load AWS profiles: specified file is null."); } if (!file.exists() || !file.isFile()) { throw new IllegalArgumentException( "AWS credential profiles file not found in the given path: " + file.getAbsolutePath()); } FileInputStream fis = null; try { fis = new FileInputStream(file); return loadProfiles(fis); } catch (IOException ioe) { throw new SdkClientException( "Unable to load AWS credential profiles file at: " + file.getAbsolutePath(), ioe); } finally { if (fis != null) { try { fis.close(); } catch (IOException ioe) { } } } }