code: function(resource, object) {
      if (!resource || !object) {
        return undefined;
      }
      var objectResource = kindToResource(object.kind);
      var objectGroupVersion = parseGroupVersion(object.apiVersion);
      var resourceGroupVersion = toResourceGroupVersion(resource);
      if (!objectResource || !objectGroupVersion || !resourceGroupVersion) {
        return undefined;
      }
  
      // We specified something like "pods"
      if (angular.isString(resource)) {
        // If the object had a matching kind {"kind":"Pod","apiVersion":"v1"}, use the group/version from the object
        if (resourceGroupVersion.equals(objectResource)) {
          resourceGroupVersion.group = objectGroupVersion.group;
          resourceGroupVersion.version = objectGroupVersion.version;
        }
        return resourceGroupVersion;
      }
  
      // If the resource was already a fully specified object,
      // require the group to match as well before taking the version from the object
      if (resourceGroupVersion.equals(objectResource, objectGroupVersion.group)) {
        resourceGroupVersion.version = objectGroupVersion.version;
      }
      return resourceGroupVersion;
    }
docs: deriveTargetResource figures out the fully qualified destination to submit the object to. if resource is a string, and the object's kind matches the resource, the object's group/version are used. if resource is a ResourceGroupVersion, and the object's kind and group match, the object's version is used. otherwise, resource is used as-is.