use of com.google.cloud.tools.jib.maven.JibPluginConfiguration.PermissionConfiguration in project jib by GoogleContainerTools.
the class MojoCommon method convertPermissionsList.
/**
* Converts a list of {@link PermissionConfiguration} to an equivalent {@code
* String->FilePermission} map.
*
* @param permissionList the list to convert
* @return the resulting map
*/
static Map<String, FilePermissions> convertPermissionsList(List<PermissionConfiguration> permissionList) {
// Order is important, so use a LinkedHashMap
Map<String, FilePermissions> permissionsMap = new LinkedHashMap<>();
for (PermissionConfiguration permission : permissionList) {
Optional<String> file = permission.getFile();
Optional<String> mode = permission.getMode();
if (!file.isPresent() || !mode.isPresent()) {
throw new IllegalArgumentException("Incomplete <permission> configuration; requires <file> and <mode> fields to be set");
}
permissionsMap.put(file.get(), FilePermissions.fromOctalString(mode.get()));
}
return permissionsMap;
}
use of com.google.cloud.tools.jib.maven.JibPluginConfiguration.PermissionConfiguration in project jib by google.
the class MojoCommon method convertPermissionsList.
/**
* Converts a list of {@link PermissionConfiguration} to an equivalent {@code
* String->FilePermission} map.
*
* @param permissionList the list to convert
* @return the resulting map
*/
static Map<String, FilePermissions> convertPermissionsList(List<PermissionConfiguration> permissionList) {
// Order is important, so use a LinkedHashMap
Map<String, FilePermissions> permissionsMap = new LinkedHashMap<>();
for (PermissionConfiguration permission : permissionList) {
Optional<String> file = permission.getFile();
Optional<String> mode = permission.getMode();
if (!file.isPresent() || !mode.isPresent()) {
throw new IllegalArgumentException("Incomplete <permission> configuration; requires <file> and <mode> fields to be set");
}
permissionsMap.put(file.get(), FilePermissions.fromOctalString(mode.get()));
}
return permissionsMap;
}
Aggregations