class PostHandler implements KubernetesCrudDispatcherHandler {

  private final KubernetesAttributesExtractor attributeExtractor;
  private final KubernetesCrudPersistence persistence;

  public PostHandler(KubernetesAttributesExtractor attributeExtractor, KubernetesCrudPersistence persistence) {
    this.attributeExtractor = attributeExtractor;
    this.persistence = persistence;
  }

  @Override
  public MockResponse handle(String path, String contentType, String requestBody) throws KubernetesCrudDispatcherException {<FILL_FUNCTION_BODY>}

  private void initMetadata(HasMetadata resource, String path) throws KubernetesCrudDispatcherException {
    final UUID uuid = generateId();
    if (Utils.isNullOrEmpty(resource.getMetadata().getName())) {
      resource.getMetadata().setName(resource.getMetadata().getGenerateName() + "-" + uuid);
    }
    final String pathNamespace = attributeExtractor.fromKubernetesPath(path)
        .get(KubernetesAttributesExtractor.NAMESPACE);
    final String metadataNamespace = resource.getMetadata().getNamespace();
    if (Utils.isNotNullOrEmpty(metadataNamespace) && !pathNamespace.equals(metadataNamespace)) {
      throw new KubernetesCrudDispatcherException(
          "the namespace of the object (" + metadataNamespace + ") does not match the namespace on the URL ("
              + pathNamespace + ")",
          HTTP_BAD_REQUEST,
          resource.getKind());
    }
    resource.getMetadata().setNamespace(pathNamespace);
    resource.getMetadata().setUid(uuid.toString());
    resource.getMetadata().setCreationTimestamp(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
    resource.getMetadata().setResourceVersion(String.valueOf(persistence.requestResourceVersion()));
    resource.getMetadata().setGeneration(1L);
  }
}

    final GenericKubernetesResource resource = validateRequestBody(requestBody);
    final AttributeSet attributes = persistence.getKey(path)
        .add(new Attribute(KubernetesAttributesExtractor.NAME, KubernetesResourceUtil.getName(resource)));
    if (persistence.findResource(attributes) != null) {
      throw new KubernetesCrudDispatcherException(String.format("%s '%s' already exists",
          resource.getKind(), resource.getMetadata().getName()), HttpURLConnection.HTTP_CONFLICT, resource.getKind());
    }
    if (resource.isMarkedForDeletion()) {
      // Since the resource is newly created, a deletionTimestamp was most likely set accidentally.
      resource.getMetadata().setDeletionTimestamp(null);
    }

    initMetadata(resource, path);
    if (persistence.isStatusSubresourceEnabledForResource(path)) {
      resource.getAdditionalProperties().remove(STATUS);
    }
    final String response = Serialization.asJson(resource);
    persistence.processEvent(path, attributes, null, resource, response);
    return new MockResponse().setResponseCode(HttpURLConnection.HTTP_CREATED).setBody(response);
  
<no_super_class>