Anonymitaet commented on a change in pull request #13118: URL: https://github.com/apache/pulsar/pull/13118#discussion_r766571137
########## File path: site2/docs/admin-api-packages.md ########## @@ -109,142 +124,168 @@ bin/pulsar-admin packages download functions://public/default/example@v0.1 --pat <!--REST API--> -{@inject: endpoint|GET|/admin/v3/packages/:type/:tenant/:namespace/:packageName/:version/?version=[[pulsar:version_number]]} +{@inject: endpoint|GET|/admin/v3/packages/:type/:tenant/:namespace/:packageName/:version} <!--JAVA--> -Download a package to the package management service synchronously. +Download a package from the package management service synchronously. ```java - void download(String packageName, String path) throws PulsarAdminException; + void download(String packageName, String path) throws PulsarAdminException; ``` -Download a package to the package management service asynchronously. +Download a package from the package management service asynchronously. + ```java - CompletableFuture<Void> downloadAsync(String packageName, String path); + CompletableFuture<Void> downloadAsync(String packageName, String path); ``` <!--END_DOCUSAURUS_CODE_TABS--> -### List all versions of a package -You can get a list of all versions of a package in the following ways. +### Delete a package + +You can use the following commands to delete a package. + <!--DOCUSAURUS_CODE_TABS--> <!--pulsar-admin--> +The following command deletes a package of version 0.1. + ```shell -bin/pulsar-admin packages list --type function public/default +bin/pulsar-admin packages delete functions://public/default/example@v0.1 ``` <!--REST API--> -{@inject: endpoint|GET|/admin/v3/packages/:type/:tenant/:namespace/:packageName/?version=[[pulsar:version_number]]} +{@inject: endpoint|DELETE|/admin/v3/packages/:type/:tenant/:namespace/:packageName/:version} <!--JAVA--> -List all versions of a package synchronously. +Delete a specified package synchronously. ```java - List<String> listPackageVersions(String packageName) throws PulsarAdminException; + void delete(String packageName) throws PulsarAdminException; ``` -List all versions of a package asynchronously. + +Delete a specified package asynchronously. + ```java - CompletableFuture<List<String>> listPackageVersionsAsync(String packageName); + CompletableFuture<Void> deleteAsync(String packageName); ``` <!--END_DOCUSAURUS_CODE_TABS--> -### List all the specified type packages under a namespace -You can get a list of all the packages with the given type in a namespace in the following ways. +### Get the metadata of a package + +You can use the following commands to get the metadate of a package. + <!--DOCUSAURUS_CODE_TABS--> <!--pulsar-admin--> + ```shell -bin/pulsar-admin packages list --type function public/default +bin/pulsar-admin packages get-metadata function://public/default/test@v1 ``` <!--REST API--> -{@inject: endpoint|PUT|/admin/v3/packages/:type/:tenant/:namespace/?version=[[pulsar:version_number]]} +{@inject: endpoint|GET|/admin/v3/packages/:type/:tenant/:namespace/:packageName/:version/metadata} <!--JAVA--> -List all the packages with the given type in a namespace synchronously. +Get the metadata of a package synchronously. ```java - List<String> listPackages(String type, String namespace) throws PulsarAdminException; + PackageMetadata getMetadata(String packageName) throws PulsarAdminException; ``` -List all the packages with the given type in a namespace asynchronously. + +Get the metadata of a package asynchronously. + ```java - CompletableFuture<List<String>> listPackagesAsync(String type, String namespace); + CompletableFuture<PackageMetadata> getMetadataAsync(String packageName); ``` <!--END_DOCUSAURUS_CODE_TABS--> -### Get the metadata of a package -You can get the metadata of a package in the following ways. +### Update the metadata of a package + +You can use the following commands to update the metadata of a package. <!--DOCUSAURUS_CODE_TABS--> <!--pulsar-admin--> - ```shell -bin/pulsar-admin packages get-metadata function://public/default/test@v1 +bin/pulsar-admin packages update-metadata function://public/default/example@v0.1 --description update-description ``` <!--REST API--> -{@inject: endpoint|GET|/admin/v3/packages/:type/:tenant/:namespace/:packageName/:version/metadata/?version=[[pulsar:version_number]]} +{@inject: endpoint|PUT|/admin/v3/packages/:type/:tenant/:namespace/:packageName/:version/metadata} <!--JAVA--> -Get the metadata of a package synchronously. +Update the metadata of a package synchronously. ```java - PackageMetadata getMetadata(String packageName) throws PulsarAdminException; + void updateMetadata(String packageName, PackageMetadata metadata) throws PulsarAdminException; ``` -Get the metadata of a package asynchronously. + +Update the metadata of a package asynchronously. + ```java - CompletableFuture<PackageMetadata> getMetadataAsync(String packageName); + CompletableFuture<Void> updateMetadataAsync(String packageName, PackageMetadata metadata); ``` <!--END_DOCUSAURUS_CODE_TABS--> -### Update the metadata of a package -You can update the metadata of a package in the following ways. +### List all versions of a package + +You can use the following commands to list all versions of a package. + <!--DOCUSAURUS_CODE_TABS--> <!--pulsar-admin--> ```shell -bin/pulsar-admin packages update-metadata function://public/default/example@v0.1 --description update-description +bin/pulsar-admin packages list-versions type://tenant/namespace/packageName ``` <!--REST API--> -{@inject: endpoint|PUT|/admin/v3/packages/:type/:tenant/:namespace/:packageName/:version/metadata/?version=[[pulsar:version_number]]} +{@inject: endpoint|GET|/admin/v3/packages/:type/:tenant/:namespace/:packageName} <!--JAVA--> -Update a package metadata information synchronously. +List all versions of a package synchronously. ```java - void updateMetadata(String packageName, PackageMetadata metadata) throws PulsarAdminException; + List<String> listPackageVersions(String packageName) throws PulsarAdminException; ``` -Update a package metadata information asynchronously. + +List all versions of a package asynchronously. ```java - CompletableFuture<Void> updateMetadataAsync(String packageName, PackageMetadata metadata); + CompletableFuture<List<String>> listPackageVersionsAsync(String packageName); ``` <!--END_DOCUSAURUS_CODE_TABS--> -### Delete a specified package -You can delete a specified package with its package name in the following ways. +### List all packages of a specific type under a namespace + +You can use the following commands to list all packages of a specific type under a namespace. <!--DOCUSAURUS_CODE_TABS--> -<!--pulsar-admin--> -The following command example deletes a package of version 0.1. +<!--pulsar-admin--> ```shell -bin/pulsar-admin packages delete functions://public/default/example@v0.1 +bin/pulsar-admin packages list --type function public/default ``` <!--REST API--> -{@inject: endpoint|DELETE|/admin/v3/packages/:type/:tenant/:namespace/:packageName/:version/?version=[[pulsar:version_number]]} +{@inject: endpoint|PUT|/admin/v3/packages/:type/:tenant/:namespace} <!--JAVA--> -Delete a specified package synchronously. +List all packages of a specific type under a namespace synchronously. ```java - void delete(String packageName) throws PulsarAdminException; + List<String> listPackages(String type, String namespace) throws PulsarAdminException; ``` -Delete a specified package asynchronously. + +List all packages of a specific type under a namespace asynchronously. + ```java - CompletableFuture<Void> deleteAsync(String packageName); + CompletableFuture<List<String>> listPackagesAsync(String type, String namespace); ``` <!--END_DOCUSAURUS_CODE_TABS--> + + +> **Note** +> This page only includes some of the most frequently used operations. +> * For more information about the commands, flags, descriptions, and more in Pulsar administrator, see [Pulsar admin](https://pulsar.apache.org/tools/pulsar-admin/) page. +> * For more information about the parameters, responses, samples, and more in REST API, see [REST API](https://pulsar.incubator.apache.org/admin-rest-api#/) page. +> * For more information about the classes, methods, descriptions, and more Java administrator API, see [Java admin API](https://pulsar.apache.org/api/admin/2.8.0-SNAPSHOT/) page. Review comment: The reasons for moving `Important` to the beginning: ![image](https://user-images.githubusercontent.com/50226895/145557739-6447c48a-b70e-49df-baa5-08f57da85732.png) - These are several chapters in the `Admin API` guide, each chapter has its operations. However, in these chapters (except `Overview`), only frequently used operations (especially their flags and descriptions) are explained here since more detailed info is added directly to code files to generate various API docs automatically. This is beneficial for both developers/writers (contribute docs conveniently) and users (they are accustomed to go to the corresponding API pages which show the latest info). ![image](https://user-images.githubusercontent.com/50226895/145558128-e55aa9de-17db-481f-a0db-38d32fa2e159.png) - Keep consistent with other chapters. As you can see, this `Important` is added to every chapter at the beginning to remind users to go to API websites (where host latest and complete info) directly, which reduces the chances that they do not find desired info after reading through the whole chapter. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org