class Crn {

    @Nullable
    public static Crn fromString(String input) {
        checkNotNull(input);
        Matcher matcher = CRN_PATTERN.matcher(input);
        if (!matcher.matches()) {
            return null;
        }
        String region = matcher.group(3);
        if (!Region.US_WEST_1.name.equals(region)) {
            throw new CrnParseException(String.format("%s is not a supported region", region));
        }
        return new Crn.Builder()
                .setPartition(Partition.safeFromString(matcher.group(1)))
                .setService(Service.safeFromString(matcher.group(2)))
                .setAccountId(matcher.group(4))
                .setResourceType(ResourceType.fromString(matcher.group(5)))
                .setResource(matcher.group(6))
                .build();
    }

    public  Crn(Partition partition,
            Service service,
            Region region,
            String accountId,
            ResourceType resourceType,
            String resource);

}