Call EDAS API operations by using Alibaba Cloud CLI

更新时间:
复制 MD 格式

Use Alibaba Cloud CLI to call Enterprise Distributed Application Service (EDAS) API operations and manage resources such as namespaces, regions, and clusters from the command line, without writing SDK code.

Before you begin

Command structure

All EDAS CLI commands follow this pattern:

aliyun edas <ApiAction> [--<ParamName> <value>]
ComponentDescription
aliyunThe base CLI program
edasThe target product (EDAS)
<ApiAction>The API operation to call, such as InsertOrUpdateRegion or DeleteCluster
--<ParamName> <value>One or more request parameters required by the operation

Some operations also require the --region and --endpoint parameters to specify the target region and service endpoint.

Find available operations

List all EDAS API operations available through the CLI:

aliyun edas --help

View the parameters and usage of a specific operation:

aliyun edas <ApiAction> --help

For example:

aliyun edas InsertOrUpdateRegion --help

To explore and test operations interactively, use OpenAPI Explorer.

Examples

Before you use Alibaba Cloud CLI to call the EDAS API, you must know the EDAS API operations and the information about each API operation, such as request parameters and response parameters. For details on calling RPC and RESTful API operations, see Call RPC API and RESTful API.

Note Parameters of different data types in the API operations must comply with the parameter format requirements of Alibaba Cloud CLI. For more information, see Parameter format overview.

Create a namespace

aliyun edas InsertOrUpdateRegion \
  --RegionTag cn-beijing:testheng \
  --RegionName testheng \
  --region cn-beijing \
  --endpoint "edas.cn-beijing.aliyuncs.com"
ParameterDescription
--RegionTagThe unique identifier for the namespace, in the format <region-id>:<namespace-name>
--RegionNameThe display name of the namespace
--regionThe Alibaba Cloud region where the namespace is created
--endpointThe EDAS service endpoint for the region

Query regions

aliyun edas ListAliyunRegion

This operation takes no parameters and returns all available regions for EDAS.

Delete a cluster from a namespace

aliyun edas DeleteCluster \
  --ClusterId f8b3014e-0f61-493a-a602-6f9b63ba**** \
  --logicalRegionId cn-beijing:docNamespace3
ParameterDescription
--ClusterIdThe ID of the cluster to delete
--logicalRegionIdThe namespace identifier that contains the cluster

Replace f8b3014e-0f61-493a-a602-6f9b63ba**** with your actual cluster ID.

Automate with shell scripts

When you use Alibaba Cloud CLI to call an API operation to perform a complex task, we recommend that you compile the command text into a shell script and then run the shell script to improve efficiency. For an example of a scenario that uses the CLI to call APIs, see Quickly deploy an application to an ECS cluster using the CLI. For example:

#!/bin/bash
# Create a namespace and verify the result

# Step 1: Create the namespace
aliyun edas InsertOrUpdateRegion \
  --RegionTag cn-beijing:<your-namespace-id> \
  --RegionName <your-namespace-name> \
  --region cn-beijing \
  --endpoint "edas.cn-beijing.aliyuncs.com"

# Step 2: Verify that the namespace was created
aliyun edas ListAliyunRegion

Replace the following placeholders with your actual values:

PlaceholderDescriptionExample
<your-namespace-id>The namespace identifiermynamespace
<your-namespace-name>The display name for the namespacemynamespace
Note The examples in this topic use Bash syntax. If you use PowerShell or Command Prompt on Windows, adjust the line continuation characters accordingly (\ in Bash, ` `` in PowerShell).

See also