code: public static String parentRelativePathFromResourceId(String id) {
          if (id == null) {
              return null;
          }
  
          ResourceId parent = ResourceId.fromString(id).parent();
          if (parent != null) {
              return parent.resourceType() + "/" + parent.name();
          }
  
          return "";
      }
docs: Extract parent resource path from a resource ID string.
  E.g. subscriptions/s/resourcegroups/r/foos/foo/bars/bar will return foos/foo.
  
  @param id the resource ID string
  @return the parent resource ID