# serverless-global-control
This project follows the Onion Architecture pattern, which separates the codebase into layers based on their responsibilities.

## Local Development Setup
### Start the gRPC Server
This service can be run locally since it provides mock support for all dependencies except for **MySQL**. So before starting the gRPC server, you need to configure the MySQL connection in the `local/local.yaml` file. Modify the MySQL configuration to match your local MySQL instance.
```shell
./local/run.sh
```
### Call RPCs with CLI
Use the provided CLI to interact with the service. You can execute commands such as adding a cloud provider, adding a region, adding a cluster, listing clusters, and deleting a cluster.
**Add a Cloud Provider**
```shell
./local/cli.sh provider add --provider=aws
```

**Add a Region**
```shell
./local/cli.sh region add --region-svc-addr=http://localhost:10001
```
Note: The `region add` command supports the `region-svc-addr` parameter. If this parameter is empty, the server will use an embedded fake regional server. The format of this field is http://localhost:10000.

**Add a Cluster**
```shell
./local/cli.sh cluster add --provider=aws --region=shanghai.cn --cluster-id=111
```
Note: the `shanghai.cn` region is hardcode in mock region serivce.

**List Clusters**
```shell
./local/cli.sh cluster list
```
**Delete a Cluster**
```shell
./local/cli.sh cluster delete --cluster-id=111
```

Please make sure to replace `cluster1` with your desired values.




