jerryshao commented on code in PR #5218:
URL: https://github.com/apache/gravitino/pull/5218#discussion_r1815942730


##########
docs/manage-metalake-using-gravitino.md:
##########
@@ -151,9 +151,108 @@ The following table outlines the supported modifications 
that you can make to a
 | Set property           | 
`{"@type":"setProperty","property":"key1","value":"value1"}` | 
`MetalakeChange.setProperty("key1", "value1")`  | 
`MetalakeChange.set_property("key1", "value1")` |
 | Remove property        | `{"@type":"removeProperty","property":"key1"}`      
         | `MetalakeChange.removeProperty("key1")`         | 
`MetalakeChange.remove_property("key1")`                               |
 
+## Enable a metalake
+
+Metalake has a reserved property - `in-use`, which indicates whether the 
metalake is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled metalake, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}` endpoint or use the Gravitino Admin client.
+
+The following is an example of enabling a metalake:
+
+<Tabs groupId="language" queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+GravitinoAdminClient gravitinoAdminClient = GravitinoAdminClient
+    .builder("http://localhost:8090";)
+    .build();
+
+gravitinoAdminClient.enableMetalake("metalake");
+  // ...
+```
+
+</TabItem>
+<TabItem value="python" label="Python">
+
+```python
+gravitino_admin_client: GravitinoAdminClient = 
GravitinoAdminClient(uri="http://localhost:8090";)
+gravitino_admin_client.enable_metalake("metalake")
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the metalake is already enabled, the operation will do nothing.

Review Comment:
   "This operation does nothing if the metalake is already enabled."



##########
docs/manage-metalake-using-gravitino.md:
##########
@@ -151,9 +151,108 @@ The following table outlines the supported modifications 
that you can make to a
 | Set property           | 
`{"@type":"setProperty","property":"key1","value":"value1"}` | 
`MetalakeChange.setProperty("key1", "value1")`  | 
`MetalakeChange.set_property("key1", "value1")` |
 | Remove property        | `{"@type":"removeProperty","property":"key1"}`      
         | `MetalakeChange.removeProperty("key1")`         | 
`MetalakeChange.remove_property("key1")`                               |
 
+## Enable a metalake
+
+Metalake has a reserved property - `in-use`, which indicates whether the 
metalake is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled metalake, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}` endpoint or use the Gravitino Admin client.
+
+The following is an example of enabling a metalake:
+
+<Tabs groupId="language" queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+GravitinoAdminClient gravitinoAdminClient = GravitinoAdminClient
+    .builder("http://localhost:8090";)
+    .build();
+
+gravitinoAdminClient.enableMetalake("metalake");
+  // ...
+```
+
+</TabItem>
+<TabItem value="python" label="Python">
+
+```python
+gravitino_admin_client: GravitinoAdminClient = 
GravitinoAdminClient(uri="http://localhost:8090";)
+gravitino_admin_client.enable_metalake("metalake")
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the metalake is already enabled, the operation will do nothing.
+:::
+
+## Disable a metalake
+
+Once a metalake is disabled:
+ - It can only be [listed](#list-all-metalakes), [loaded](#load-a-metalake), 
[dropped](#drop-a-metalake), or [enabled](#enable-a-metalake).

Review Comment:
   "Users can only xxx, xx, xxx".



##########
docs/manage-messaging-metadata-using-gravitino.md:
##########
@@ -138,7 +138,7 @@ in relational catalog for more details. For a messaging 
catalog, the list operat
 ## Topic operations
 
 :::tip
-Users should create a metalake, a catalog and a schema before creating a table.
+Users should create a metalake, a catalog and a schema, then ensure that the 
metalake and catalog are enabled before performing topic operations.

Review Comment:
   "...before operating topics."



##########
docs/manage-relational-metadata-using-gravitino.md:
##########
@@ -180,8 +180,88 @@ Therefore, do not change the catalog's URI unless you 
fully understand the conse
 
 :::
 
+### Enable a catalog
+
+Catalog has a reserved property - `in-use`, which indicates whether the 
catalog is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of enabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.enableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already enabled, the operation will do nothing.

Review Comment:
   Ditto.



##########
docs/open-api/catalogs.yaml:
##########
@@ -201,11 +201,47 @@ paths:
         "5xx":
           $ref: "./openapi.yaml#/components/responses/ServerErrorResponse"
 
+    patch:
+      tags:
+        - catalog
+      summary: set caatalog in-use

Review Comment:
   "catalog"



##########
docs/manage-relational-metadata-using-gravitino.md:
##########
@@ -180,8 +180,88 @@ Therefore, do not change the catalog's URI unless you 
fully understand the conse
 
 :::
 
+### Enable a catalog
+
+Catalog has a reserved property - `in-use`, which indicates whether the 
catalog is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of enabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.enableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already enabled, the operation will do nothing.
+:::
+
+### Disable a catalog
+
+Once a catalog is disabled:
+- It can only be [listed](#list-all-catalogs-in-a-metalake), 
[loaded](#load-a-catalog), [dropped](#drop-a-catalog), or 
[enabled](#enable-a-catalog).
+- Any other operation on the catalog or its sub-entities will result in an 
error.
+
+To disable a catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of disabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": false}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog

Review Comment:
   Also here.



##########
docs/manage-relational-metadata-using-gravitino.md:
##########
@@ -180,8 +180,88 @@ Therefore, do not change the catalog's URI unless you 
fully understand the conse
 
 :::
 
+### Enable a catalog
+
+Catalog has a reserved property - `in-use`, which indicates whether the 
catalog is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of enabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.enableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already enabled, the operation will do nothing.
+:::
+
+### Disable a catalog
+
+Once a catalog is disabled:
+- It can only be [listed](#list-all-catalogs-in-a-metalake), 
[loaded](#load-a-catalog), [dropped](#drop-a-catalog), or 
[enabled](#enable-a-catalog).
+- Any other operation on the catalog or its sub-entities will result in an 
error.
+
+To disable a catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of disabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": false}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.disableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already disabled, the operation will do nothing.
+:::
+
 ### Drop a catalog
 
+Deleting catalog doesn't use forced deletion by default, so please make sure:
+
+- There are no schemas under the catalog. Otherwise, you will get an error.
+- The catalog is [disabled](#disable-a-catalog). Otherwise, you will get an 
error.
+
+If you are using forced deletion, it will:

Review Comment:
   Can you please also reword the related part in metalake.



##########
docs/manage-relational-metadata-using-gravitino.md:
##########
@@ -180,8 +180,88 @@ Therefore, do not change the catalog's URI unless you 
fully understand the conse
 
 :::
 
+### Enable a catalog
+
+Catalog has a reserved property - `in-use`, which indicates whether the 
catalog is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of enabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog

Review Comment:
   `catalogs\catalog`, what is the meaning here?



##########
docs/manage-relational-metadata-using-gravitino.md:
##########
@@ -180,8 +180,88 @@ Therefore, do not change the catalog's URI unless you 
fully understand the conse
 
 :::
 
+### Enable a catalog
+
+Catalog has a reserved property - `in-use`, which indicates whether the 
catalog is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of enabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.enableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already enabled, the operation will do nothing.
+:::
+
+### Disable a catalog
+
+Once a catalog is disabled:
+- It can only be [listed](#list-all-catalogs-in-a-metalake), 
[loaded](#load-a-catalog), [dropped](#drop-a-catalog), or 
[enabled](#enable-a-catalog).

Review Comment:
   Ditto.



##########
docs/manage-relational-metadata-using-gravitino.md:
##########
@@ -180,8 +180,88 @@ Therefore, do not change the catalog's URI unless you 
fully understand the conse
 
 :::
 
+### Enable a catalog
+
+Catalog has a reserved property - `in-use`, which indicates whether the 
catalog is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of enabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.enableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already enabled, the operation will do nothing.
+:::
+
+### Disable a catalog
+
+Once a catalog is disabled:
+- It can only be [listed](#list-all-catalogs-in-a-metalake), 
[loaded](#load-a-catalog), [dropped](#drop-a-catalog), or 
[enabled](#enable-a-catalog).
+- Any other operation on the catalog or its sub-entities will result in an 
error.
+
+To disable a catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of disabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": false}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.disableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already disabled, the operation will do nothing.
+:::
+
 ### Drop a catalog
 
+Deleting catalog doesn't use forced deletion by default, so please make sure:

Review Comment:
   "Deleting a catalog by "force" is not a default behavior, so please..."



##########
docs/manage-relational-metadata-using-gravitino.md:
##########
@@ -180,8 +180,88 @@ Therefore, do not change the catalog's URI unless you 
fully understand the conse
 
 :::
 
+### Enable a catalog
+
+Catalog has a reserved property - `in-use`, which indicates whether the 
catalog is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of enabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.enableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already enabled, the operation will do nothing.
+:::
+
+### Disable a catalog
+
+Once a catalog is disabled:
+- It can only be [listed](#list-all-catalogs-in-a-metalake), 
[loaded](#load-a-catalog), [dropped](#drop-a-catalog), or 
[enabled](#enable-a-catalog).
+- Any other operation on the catalog or its sub-entities will result in an 
error.
+
+To disable a catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of disabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": false}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.disableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>

Review Comment:
   Why there's no Python API here?



##########
docs/manage-relational-metadata-using-gravitino.md:
##########
@@ -180,8 +180,88 @@ Therefore, do not change the catalog's URI unless you 
fully understand the conse
 
 :::
 
+### Enable a catalog
+
+Catalog has a reserved property - `in-use`, which indicates whether the 
catalog is available for use. By default, the `in-use` property is set to 
`true`.
+To enable a disabled catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of enabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": true}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.enableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already enabled, the operation will do nothing.
+:::
+
+### Disable a catalog
+
+Once a catalog is disabled:
+- It can only be [listed](#list-all-catalogs-in-a-metalake), 
[loaded](#load-a-catalog), [dropped](#drop-a-catalog), or 
[enabled](#enable-a-catalog).
+- Any other operation on the catalog or its sub-entities will result in an 
error.
+
+To disable a catalog, you can send a `PATCH` request to the 
`/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or use the 
Gravitino Java client.
+
+The following is an example of disabling a catalog:
+
+<Tabs groupId='language' queryString>
+<TabItem value="shell" label="Shell">
+
+```shell
+curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
+-H "Content-Type: application/json" -d '{"in-use": false}' \
+http://localhost:8090/api/metalakes/metalake/catalogs\catalog
+```
+
+</TabItem>
+<TabItem value="java" label="Java">
+
+```java
+// ...
+// Assuming you have created a metalake named `metalake` and a catalog named 
`catalog`
+gravitinoClient.disableCatalog("catalog");
+// ...
+```
+
+</TabItem>
+</Tabs>
+
+:::info
+If the catalog is already disabled, the operation will do nothing.
+:::
+
 ### Drop a catalog
 
+Deleting catalog doesn't use forced deletion by default, so please make sure:
+
+- There are no schemas under the catalog. Otherwise, you will get an error.
+- The catalog is [disabled](#disable-a-catalog). Otherwise, you will get an 
error.
+
+If you are using forced deletion, it will:

Review Comment:
   "Deleting a catalog by "force" will:"



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to