Skip to content

Commit

Permalink
Implement the packages management administration opeartions. (apache#…
Browse files Browse the repository at this point in the history
…8816)

---

Master Issue: apache#8676

*Motivation*

Introduce the pulsar admin operations with packages management service.

*Modifications*

- Add the admin API for packages management service.

This only has client-side code. Will add integration tests when
server-side code is merged.
  • Loading branch information
zymap authored Dec 7, 2020
1 parent 3464f46 commit 54f3e9c
Show file tree
Hide file tree
Showing 4 changed files with 451 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pulsar-client-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-package-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.pulsar.client.admin;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.apache.pulsar.packages.management.core.common.PackageMetadata;

/**
* Administration operations of the packages management service.
*/
public interface Packages {
/**
* Get a package metadata information.
*
* @param packageName
* the package name of the package metadata you want to find
* @return the package metadata information
*/
PackageMetadata getMetadata(String packageName) throws PulsarAdminException;

/**
* Get a package metadata information asynchronously.
*
* @param packageName
* the package name of the package metadata you want to find
* @return the package metadata information
*/
CompletableFuture<PackageMetadata> getMetadataAsync(String packageName);

/**
* Update a package metadata information.
*
* @param packageName
* the package name of the package metadata you want to update
* @param metadata
* the updated metadata information
*/
void updateMetadata(String packageName, PackageMetadata metadata) throws PulsarAdminException;

/**
* Update a package metadata information asynchronously.
*
* @param packageName
* the package name of the package metadata you want to update
* @param metadata
* the updated metadata information
* @return nothing
*/
CompletableFuture<Void> updateMetadataAsync(String packageName, PackageMetadata metadata);

/**
* Upload a package to the package management service.
*
* @param packageName
* the package name of the upload file
* @param path
* the upload file path
*/
void upload(PackageMetadata metadata, String packageName, String path) throws PulsarAdminException;

/**
* Upload a package to the package management service asynchronously.
*
* @param packageName
* the package name you want to upload
* @param path
* the path you want to upload from
* @return nothing
*/
CompletableFuture<Void> uploadAsync(PackageMetadata metadata, String packageName, String path);

/**
* Download a package from the package management service.
*
* @param packageName
* the package name you want to download
* @param path
* the path you want to download to
*/
void download(String packageName, String path) throws PulsarAdminException;

/**
* Download a package from the package management service asynchronously.
*
* @param packageName
* the package name you want to download
* @param path
* the path you want to download to
* @return nothing
*/
CompletableFuture<Void> downloadAsync(String packageName, String path);

/**
* Delete the specified package.
*
* @param packageName
* the package name which you want to delete
*/
void delete(String packageName) throws PulsarAdminException;

/**
* Delete the specified package asynchronously.
*
* @param packageName
* the package name which you want to delete
* @return nothing
*/
CompletableFuture<Void> deleteAsync(String packageName);

/**
* List all the versions of a package.
*
* @param packageName
* the package name which you want to get all the versions
* @return all the versions of the package
*/
List<String> listPackageVersions(String packageName) throws PulsarAdminException;

/**
* List all the versions of a package asynchronously.
*
* @param packageName
* the package name which you want to get all the versions
* @return all the versions of the package
*/
CompletableFuture<List<String>> listPackageVersionsAsync(String packageName);

/**
* List all the packages with the given type in a namespace.
*
* @param type
* the type you want to get the packages
* @param namespace
* the namespace you want to get the packages
* @return all the packages of the given type which in the given namespace
*/

List<String> listPackages(String type, String namespace) throws PulsarAdminException;
/**
* List all the packages with the given type in a namespace asynchronously.
*
* @param type
* the type you want to get the packages
* @param namespace
* the namespace you want to get the packages
* @return all the packages of the given type which in the given namespace
*/
CompletableFuture<List<String>> listPackagesAsync(String type, String namespace);
}
Loading

0 comments on commit 54f3e9c

Please sign in to comment.