Merge "Sending Data Updated Event to kafka"
[cps.git] / cps-service / src / main / java / org / onap / cps / api / CpsAdminService.java
old mode 100644 (file)
new mode 100755 (executable)
index 406655e..1e4c9c7
@@ -2,6 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation
  *  Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ *  Modifications Copyright (C) 2021 Pantheon.tech
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
 
 package org.onap.cps.api;
 
-import org.onap.cps.exceptions.CpsValidationException;
+import java.util.Collection;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.onap.cps.spi.exceptions.AlreadyDefinedException;
+import org.onap.cps.spi.exceptions.CpsException;
 import org.onap.cps.spi.model.Anchor;
 
 /**
@@ -29,11 +33,47 @@ import org.onap.cps.spi.model.Anchor;
 public interface CpsAdminService {
 
     /**
-     * Create an anchor using provided anchorDetails object.
+     * Create dataspace.
      *
-     * @param anchor the anchor details object.
-     * @return the anchor name.
-     * @throws CpsValidationException if input data is invalid.
+     * @param dataspaceName dataspace name
+     * @throws AlreadyDefinedException if dataspace with same name already exists
      */
-    String createAnchor(Anchor anchor);
+    void createDataspace(@NonNull String dataspaceName);
+
+    /**
+     * Create an Anchor.
+     *
+     * @param dataspaceName dataspace name
+     * @param schemaSetName schema set name
+     * @param anchorName    anchor name
+     * @throws CpsException if input data is invalid.
+     */
+    void createAnchor(@NonNull String dataspaceName, @NonNull String schemaSetName, @NonNull String anchorName);
+
+    /**
+     * Read all anchors in the given dataspace.
+     *
+     * @param dataspaceName dataspace name
+     * @return a collection of anchors
+     */
+    @NonNull
+    Collection<Anchor> getAnchors(@NonNull String dataspaceName);
+
+    /**
+     * Get an anchor in the given dataspace using the anchor name.
+     *
+     * @param dataspaceName dataspace name
+     * @param anchorName    anchor name
+     * @return an anchor
+     */
+    @NonNull
+    Anchor getAnchor(@NonNull String dataspaceName, @NonNull String anchorName);
+
+    /**
+     * Delete anchor by name in given dataspace.
+     *
+     * @param dataspaceName dataspace name
+     * @param anchorName    anchor name
+     */
+    void deleteAnchor(@NonNull String dataspaceName, @NonNull String anchorName);
 }