@hw-agconnect/agc-cli
v1.12.0
Published
- [Overview](#overview) - [Prerequisites](#prerequisites) - [Installation](#installation) - [Usage](#usage) - [Documentation](#documentation) - [Cloud Functions](#cloud-functions) - [Cloud Storage](#cloud-storage) - [Cloud DB](#cloud-db
Downloads
24
Readme
AppGalleryConnectCliTool
Table Of Contents
Overview
AppGalleryConnectCliTool (AGCLI for short), is a command line tool which helps you to operate and manage your application services on AppGalleryConnect, The AGCLI provides;
- Development and maintenance services for developers through command lines.
- Basic capabilities such as developer login and logout, team switchover, and selecting project.
- Ease of use and accessibility to AGC App Services such as Cloud Function, Cloud Storage, Cloud Cache and more to reduce the operations that you would need to complete on AGC Web Portal.
Prerequisites
Ensure that:
You have registered an account on the HUAWEI Developer website and passed real-name authentication. For details, see HUAWEI ID Registration.
You have created a team on the AppGallery Connect console. For details, see Managing the Team Account.
You have created a project and app on the AppGallery Connect console. For details, see Creating Your Project and App.
You have installed Node.js and npm on your local PC.
Installation
Go to the compilation platform and run the following command to download and install AGCLI:
npm install -g @hw-agconnect/agc-cli
Run the following command to install autocompletion for your shell. You need to reload your shell after the installation. (If autocomplete with the TAB
key on the keyboard does not work.)
agcli install-completion
Usage
Run the following command to log in to AGCLI:
agcli login
Run the following command to select a team: After entering the command, press arrow keys to select a team.
agcli team select
Run the following command to select a project: After entering agcli project select, press arrow keys to select a project.
agcli project select
Documentation
You can find the usage documentation in this section.
Cloud Functions
The commands for operating Cloud Functions is described in the following table. For more information please check the Service Introduction in the Huawei Developers Website.
Cloud Function
The commands for operating Cloud Function is described in the following table.
| Resource | Command | Description | |--------------|------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------| | Create Function | agcli func create-function --name a1 --code-path ./function.zip | Creates cloud functions. | | Invoke Function | agcli func invoke --name a1 --payload "{\"request\": \"world\"}" | Calls cloud functions. | | List of Functions | agcli func list-function-versions --name a1 | Queries a cloud function list by running list-functions. | | Publish Function | agcli func publish-function --name a1 --version-description "publish function description" | Publishes a cloud function by running publish-function. | | Query Version of Function | agcli func query-function-version --name a1 --function-version $latest | Queries the list of all versions for a function by running list-function-versions. | | Update and Publish Function | agcli func update-and-publish-function --name a1 --version-description "version description is necessary" --code-path ./function.zip | Updates and publishes cloud functions. | | Update Code of Function | agcli func update-function-code --name a1 --code-path ./function.zip | Updates cloud function code. | | Update Config of Function | agcli func update-function-config --name a1 --timeout 63 | Updates cloud function configurations. |
Cloud Function Layer
The commands for operating Cloud Function Layer is described in the following table.
| Resource | Command | Description | |-----------|----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------| | Create Layer | agcli func create-layer --name test-layer --compatible-runtimes nodejs14.x --code-path ./layer.zip --shared-scope business | Creates a layer. | | Create Version of Layer | agcli func create-layer-version --name test-layer --compatible-runtimes nodejs14.x --code-path ./layer.zip --shared-scope business | Creates a layer version. | | List Versions of Layers | agcli func list-layers --compatible-runtime nodejs14.x | Queries all layers. | | List Versions of Layer | agcli func list-layer-versions --name test-layer | Queries all versions of a layer. | | Query Version of Layer | agcli func query-layer-version --name test-layer --version 1 | Queries a layer version. |
Cloud Function Trigger
The commands for operating Cloud Function Trigger is described in the following table.
| Resource | Command | Description | |-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| | Create Cron Trigger | agcli func create-cron-trigger --function-name a1 --function-version $latest --schedule "@every 10h" --payload "{\"request\":\"good\"}" --trigger-mode ASync | Creates a CRON trigger by running create-cron-trigger.↵ | | Create Http Trigger | agcli func create-http-trigger --function-name a1 --function-version $latest --auth-type apiqw-client --enable-url-decode true | Creates an HTTP trigger by running create-http-trigger.↵ | | Export Triggers | agcli func export-triggers --function-name a1 --function-version $latest | Export trigger from cloud db Service. | | Import Triggers | agcli func import-triggers --function-name a1 --source string path --function-version $latest | Import trigger to cloud db Service. | | Update Cron Trigger | agcli func update-cron-trigger --trigger-id xxx --trigger-switch true | Updates a CRON trigger. | | List of Triggers | agcli func list-triggers --function-name a1 --function-verison $latest | Queries a trigger list of a function by running list-triggers. | | Query Trigger | agcli func query-trigger --trigger-id xxxx | Queries a trigger by running query-trigger. |
Cloud Function Alias
The commands for operating Cloud Function Alias is described in the following table. | Resource | Command | Description | |-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------| | Create Alias | agcli func create-alias --name test --function-name a1 --function-version $latest --description "this is test alias" --routing-config "{\"$latest\":80, \"2\":20}" | Creates an alias of a function by running create-alias. | | Update Alias | agcli func update-alias --name test --function-name a1 --description "this is test" --routing-config "{\"$latest\":90,\"2\":10}" | Updates the alias of a function by running update-alias. | | List of Alias | agcli func list-aliases --function-name a1 --function-version $latest | Queries an alias list of a function by running list-aliases. | | Query Alias | agcli func query-alias --name test --function-name a1 | Queries an alias of a function. |
Cloud Storage
The commands for operating Cloud Storage is described in the following table. For more information please check the Service Introduction in the Huawei Developers Website.
| Resource | Command | Description | |-------------------|-------------------------------------------------------------------------------------------|--------------------------------------------------| | Enable | agcli storage enable | Enable Cloud Storage. | | Document | agcli storage doc | Link to document. | | Create Bucket | agcli storage create-bucket --name bucketName | Create a new bucket. | | Select Bucket | agcli storage select | Bucket switchover. | | Delete Bucket | agcli storage delete-bucket | Delete specified bucket. | | Add CORS | agcli storage add-cors --methods GET, POST --origins https://localhost:443 | List all cross-origin policies. | | Clear CORS | agcli storage clear-cors | Clear Cross-Origin Resource Sharing rules. | | Delete CORS | agcli storage delete-cors --index 1 | Delete Cross-Origin Resource Sharing rule. | | List CORS | agcli storage list-cors | List Cross-Origin Resource Sharing rules | | Upload File | agcli storage upload --file /local/imagePath/demo.jpg --destination images/demo.jpg | Command for uploading file to cloud storage. | | List File | agcli storage list --prefix images/ --delimiter / | Listing files with specified prefix. | | Download File | agcli storage download --file images/demo.jpg --destination /local/imagePath/demo.jpg | Command for downloading file from cloud storage. | | Delete File | agcli storage delete --file images/demo.jpg | Deleting file at specified destination. | | File Details | agcli storage file-details --file images/demo.jpg | View file at specified destination. |
Cloud DB
The commands for operating Cloud DB is described in the following table. For more information please check the Service Introduction in the Huawei Developers Website.
| Resource | Command | Description | |-------------------|--------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------| | Enable | agcli db enable | Enable the Cloud DB Service. | | Document | agcli db doc | Open document of cloud DB. | | Information | agcli db info | View data usage info from Cloud DB. | | Update Object | agcli agcli db update-object --object person | Update database object to Cloud DB. | | Update Data | agcli db update-data --zone zoneName --object person --data '{"name": "john doe", "age": 21}'' | Update data by query. | | View Data | agcli db view-data --zone zoneName --object objectName --primary-key primary-key --primary-value primaryValue' | View single data entry from Cloud DB. | | View Object | agcli db view-object --name name | View information of Cloud DB object. | | View Rule | agcli db view-rule | View security rules of Cloud DB. | | Publish Rule | agcli db publish-rule --rule rule | Publish security rules of Cloud DB. | | List Zone | agcli db list-zone | List zone(s) from Cloud DB. | | List Object | agcli db list-object --version version --name name | List objects from Cloud DB. | | Import Object | agcli db import-object --source filepath | Import data object to Cloud DB. | | Import Data | agcli db import-data --zone zoneName --object objectName --source source --path path | Import data object to Cloud DB. | | Export Object | agcli db export-object --type type --java-type javaType --js-type jsType --package-name pkgName | Export data object from Cloud DB. | | Export Data | agcli db export-data --target target --zone zone --object objectTypeName --offset offset --number number --path path | Export data object from Cloud DB. | | Delete Zone | agcli db delete-zone --name name | Delete a zone from Cloud DB. | | Delete Rule | agcli db delete-rule --timestamp timestamp | Delete security rule from Cloud DB. | | Delete Data | agcli db delete-data --zone zoneName --object person --data '{"name": "john doe", "age": 21}' | Delete database object from Cloud DB. | | Create zone | agcli db create-zone --name name | Create a zone in Cloud DB. | | Create Object | agcli db create-object --object person | Create a database object to Cloud DB. | | Clear Data | agcli db clear-data --zone zoneName --object objectName | Clear data from Cloud DB. | | Query | agcli db query --zone zoneName --object objectName -eq 'name: John' -eq 'lastName: Doe' -gte 'age: 18' | Clear data from Cloud DB. | | Add Data | agcli db add-data --zone zoneName --object person --data '{"name": "john doe", "age": 21}' | Add data in database. |
Cloud Cache
The commands for operating Cloud Cache is described in the following table. For more information please check the Service Introduction in the Huawei Developers Website.
Note: This service is currently only available in China region.
| Resource | Command | Description | |--------------|---------------------------------------------------|-------------------------------------| | Doc | agcli cache doc | Open document of Cloud Cache. | | Enable | agcli cache enable --password Testpassword123* | Enable the Cloud Cache Service. | | Change Password | agcli cache change-password --password Testpassword123* | Change password of the Cloud Cache Service. | | Command | agcli cache exec --command "SET key value" --raw true | Execute command in the Cloud Cache Service. | | Info | agcli cache info --start-time 1692859729 --end-time 1692859729 | View usage statistics of the Cloud Cache Service. |
Auth Service
The commands for operating Auth Service is described in the following table. For more information please check the Service Introduction in the Huawei Developers Website.
| Resource | Command | Description | |--------------|---------------------------------------------------|-------------------------------------| | Enable | agcli auth enable | Enable the Auth service. | | Document | agcli auth doc | Open document of cloud storage. | | Import | agcli auth import --source | Import user data to Auth Service. | | Export | agcli auth export --destination | Export user data from Auth Service. |
CloudDev
The commands for operating CloudDev Service is described in the following table.
| Resource | Command | Description | |--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------| | Init | agcli clouddev init | Initialize a CloudDev project. | | Build | agcli clouddev build | Build CloudDev project. | | Local | agcli clouddev local --function-name hello-world | Test CloudDev projects locally. | | Clean | agcli clouddev clean --force | Clean .build folder in CloudDev project | | Deploy | agcli clouddev deploy | Deploy the CloudDev project |
CloudDev Functions
The commands for operating CloudDev Functions is described in the following table.
| Resource | Command | Description | |--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------| | Create | agcli clouddev create --function-name hello-world --runtime nodejs14.x --memory 500 --timeout 60 --instance-concurrency 100 --handler handler.myHandler --environment '{"envKey":"envValue"}' | Creating a Cloud Function in the CloudDev Project. | | Create Trigger | agcli clouddev create-trigger --type http | Create a Cloud Function Trigger | | Create Alias | agcli clouddev create-alias --name hello --function-name hello-world | Create an Alias for Cloud Function. |
CloudDev Storage
The commands for operating CloudDev Storage is described in the following table.
| Resource | Command | Description | |--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------| | Storage Create | agcli clouddev storage create -–bucket lll-6o83a | Create a Cloud Storage bucket in the CloudDev Project. | | Storage Add | agcli clouddev storage add --file C:\Users\Desktop\images.png --destination clouddev\demo.png --bucket lll-6o83a | Add a file to your Cloud Storage Bucket. |
CloudDev Hosting
The commands for operating CloudDev Hosting is described in the following table.
| Resource | Command | Description | |--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------| | Hosting Create | agcli clouddev hosting create --domain huawei.com | Create a Cloud Hosting in the CloudDev Project. |
Hosting Service
The commands for operating Hosting Service is described in the following table. For more information please check the Service Introduction in the Huawei Developers Website.
| Resource | Command | Description | |--------------|---------------------------------------------------|-------------------------------------| | Enable | agcli hosting enable | Enable the Cloud Hosting Service. | | Document | agcli hosting doc | Open document of Cloud Hosting Service. | | Info | agcli hosting info --start-time timestamp --end-time timestamp | Show info of usage statistics of Cloud Hosting Service. | | New Website | agcli hosting new-website --domain domain --type custom | Create a website hosting domain. | | Modify Website | agcli hosting modify-website --domain domain --desc desc --clean-url false | Modify the website hosting domain. | | List of Websites | agcli hosting list-website --page 0 | List existing website(s). | | Delete Website | agcli hosting delete-website --siteName siteName | Delete website hosting domain. | | Deploy Website | agcli hosting deploy --file ./test.zip --siteName test | Deploy a website. | | New Storage Acceleration | agcli hosting new-storage-acceleration --domain domain --type custom | Create a storage acceleration domain. | | List of Storage Accelerations | agcli hosting list-storage-acceleration --page 0 | List the Cloud Hosting Storage Service Acceleration. | | Delete Storage Acceleration | agcli hosting delete-storage-acceleration --domain domain | Delete the Cloud Hosting Storage Service Acceleration. | | Associate Storage Acceleration | agcli hosting storage-acceleration-associate | Associate bucket the Cloud Hosting Storage Service Acceleration. |
License
Huawei AppGalleryConnectCliTool is licensed under the "ISC".