建立一個應用程式。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
sae:CreateApplication |
create |
*All Resource
|
無 | 無 |
請求文法
POST /pop/v1/sam/app/createApplication HTTP/1.1
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| AppName |
string |
是 |
應用程式名稱。允許數字、字母以及短橫線(-)組合。必須以字母開始,不允許以短橫線(-)結尾,不超過 36 個字元。 |
test |
| NamespaceId |
string |
否 |
SAE 命名空間 ID。僅支援名稱為小寫字母加短橫線(-)的命名空間,必須以字母開始。 命名空間可透過呼叫 DescribeNamespaceList 介面取得。 |
cn-beijing:test |
| AppDescription |
string |
否 |
應用程式描述資訊。不超過 1024 個字元。 |
This is a test description. |
| VpcId |
string |
否 |
SAE 命名空間對應的 VPC。在 SAE 中,一個命名空間只能對應一個 VPC,且不能修改。第一次在命名空間內建立 SAE 應用程式將形成綁定關係。多個命名空間可以對應一個 VPC。不填則預設為命名空間綁定的 VPC ID。 |
vpc-bp1aevy8sofi8mh1q**** |
| VSwitchId |
string |
否 |
應用程式執行個體彈性網卡所在的虛擬交換器。該交換器必須位於上述 VPC 內。該交換器與 SAE 命名空間同樣存在綁定關係。不填則預設為命名空間綁定的 vSwitch ID。 |
vsw-bp12mw1f8k3jgygk9**** |
| PackageType |
string |
是 |
應用程式套件類型。取值說明如下:
|
FatJar |
| PackageVersion |
string |
否 |
部署套件的版本號。當 Package Type 為 FatJar、War 或 PythonZip 時必填。 |
1.0.0 |
| PackageUrl |
string |
否 |
部署套件位址。當 Package Type 為 FatJar、War 或 PythonZip 時必填。 |
http://myoss.oss-cn-****.aliyuncs.com/my-buc/2019-06-30/****.jar |
| ImageUrl |
string |
否 |
映像位址。當 Package Type 為 Image 時必填。 |
registry.cn-hangzhou.aliyuncs.com/sae_test/ali_sae_test:0.0.1 |
| Jdk |
string |
否 |
部署套件相依的 JDK 版本。支援版本如下:
當 Package Type 為 Image 時不支援。 |
Open JDK 8 |
| WebContainer |
string |
否 |
WebContainer 部署套件相依的 Tomcat 版本。支援版本如下:
當 Package Type 為 Image 時不支援。 |
apache-tomcat-7.0.91 |
| Cpu |
integer |
否 |
每個執行個體所需的 CPU,單位為毫核,不能為 0。目前僅支援以下固定規格:
|
1000 |
| Memory |
integer |
否 |
每個執行個體所需的記憶體,單位為 MB,不能為 0。與 CPU 為一一對應關係,目前僅支援以下固定規格:
|
1024 |
| Replicas |
integer |
是 |
初始執行個體數。 |
1 |
| Command |
string |
否 |
映像啟動命令。該命令必須為容器內存在的可執行的物件。範例如下:
根據上述範例,則 重要 當 PackageType 選擇為 DotnetZip 時,此選項為必填項。 |
echo |
| CommandArgs |
string |
否 |
映像啟動命令參數。上述啟動命令 Command 所需參數。格式如下:
在上述範例中, 重要 當 PackageType 選擇為 DotnetZip 時,此選項為必填項。 |
["a","b"] |
| Envs |
string |
否 |
容器環境變數參數。支援自訂或引用設定項目。如需引用設定項目,請先建立 ConfigMap 執行個體。更多資訊,請參見 CreateConfigMap 。取值說明如下:
|
[ { "name": "sae-sys-configmap-all-hello", "valueFrom": { "configMapRef": { "configMapId": 100, "key": "" } } }, { "name": "hello", "valueFrom": { "configMapRef": { "configMapId": 101, "key": "php-fpm" } } }, { "name": "envtmp", "value": "newenv" } ] |
| CustomHostAlias |
string |
否 |
容器內自訂 Host 對應。取值說明如下:
|
[{"hostName":"samplehost","ip":"127.0.0.1"}] |
| JarStartOptions |
string |
否 |
JAR 套件啟動應用程式選項。應用程式預設啟動命令: |
-Xms4G -Xmx4G |
| JarStartArgs |
string |
否 |
JAR 套件啟動應用程式參數。應用程式預設啟動命令: |
custom-args |
| Liveness |
string |
否 |
容器健康檢查,健康檢查失敗的容器將被關閉並恢復。支援方式如下:
說明
只能選擇一種方式進行健康檢查。 參數說明如下:
|
{"exec":{"command":["sh","-c","cat /home/admin/start.sh"]},"initialDelaySeconds":30,"periodSeconds":30,"timeoutSeconds":2} |
| Readiness |
string |
否 |
應用程式啟動狀態檢查,多次健康檢查失敗的容器將被關閉並重新啟動。未通過健康檢查的容器將不會有 SLB 流量進入。支援 exec、httpGet 和 tcpSocket 方式。具體範例,請參見 Liveness 參數。 說明
只能選擇一種方式進行健康檢查。 |
{"exec":{"command":["sh","-c","cat /home/admin/start.sh"]},"initialDelaySeconds":30,"periodSeconds":30,"timeoutSeconds":2} |
| Deploy |
boolean |
否 |
是否立即部署。取值說明如下:
|
true |
| EdasContainerVersion |
string |
否 |
HSF 框架中應用程式執行環境版本,例如 Ali-Tomcat 容器。 |
3.5.3 |
| Timezone |
string |
否 |
時區,預設為 Asia/Shanghai。 |
Asia/Shanghai |
| SlsConfigs |
string |
否 |
日誌採集到 SLS 的設定。
參數說明如下:
多次部署時如果 SLS 採集設定沒有變更,則不需要設定該參數(即請求中無需包含 SlsConfigs 欄位);如果不再需要使用 SLS 採集功能,您需要在請求中將該欄位的值設定為空字串(即請求中 SlsConfigs 欄位的值為 "")。 說明
隨應用程式自動建立的 Project 會隨著應用程式刪除而刪除,因此在選擇已有 Project 時,不能選擇 SAE 自動建立的 Project。 |
[{"logDir":"","logType":"stdout"},{"logDir":"/tmp/a.log"}] |
| NasId |
string |
否 |
不建議設定該欄位,建議設定 NasConfigs。掛載的 NAS 的 ID,必須與叢集處在同一個地域。它必須有可用的掛載點建立額度,或者其掛載點已經在 VPC 內的交換器上。如果不填,且存在 mountDescs 欄位,則預設將自動購買一個 NAS 並掛載至 VPC 內的交換器上。 部署時如果設定沒有變更,則不需要設定該參數(即請求中無需包含 NASId 欄位);如果需要清除 NAS 設定,您需要在請求中將該欄位的值設定為空字串(即請求中 NASId 欄位的值為 "")。 |
KSAK**** |
| MountHost |
string |
否 |
不建議設定該欄位,建議設定 NasConfigs。NAS 在應用程式 VPC 內的掛載點。部署時如果設定沒有變更,則不需要設定該參數(即請求中無需包含 MountHost 欄位);如果需要清除 NAS 設定,您需要在請求中將該欄位的值設定為空字串(即請求中 MountHost 欄位的值為 "")。 |
example.com |
| MountDesc |
string |
否 |
不建議設定該欄位,建議設定 NasConfigs。NAS 掛載描述。部署時如果設定沒有變更,則不需要設定該參數(即請求中無需包含 MountDesc 欄位);如果需要清除 NAS 設定,您需要在請求中將該欄位的值設定為空字串(即請求中 MountDesc 欄位的值為 "")。 |
[{mountPath: "/tmp", nasPath: "/"}] |
| PreStop |
string |
否 |
容器停止前執行指令碼。在容器被刪除前觸發執行一段指令碼,格式如: |
{"exec":{"command":["cat","/etc/group"]}} |
| PostStart |
string |
否 |
容器啟動後執行指令碼。在容器被建立後立刻觸發執行一段指令碼,格式如: |
{"exec":{"command":["cat","/etc/group"]}} |
| WarStartOptions |
string |
否 |
設定 WAR 套件部署應用程式的啟動命令,操作步驟與映像部署的啟動命令設定操作相同。更多資訊,請參見 設定啟動命令。 |
CATALINA_OPTS=\"$CATALINA_OPTS $Options\" catalina.sh run |
| ConfigMapMountDesc |
string |
否 |
ConfigMap 掛載描述。使用在命名空間設定項目頁面建立的設定項目來向容器中注入設定資訊。參數說明如下:
說明
可透過傳遞
|
[{"configMapId":16,"key":"test","mountPath":"/tmp"}] |
| SecurityGroupId |
string |
否 |
安全性群組 ID。 |
sg-wz969ngg2e49q5i4**** |
| AutoConfig |
boolean |
否 |
是否自動設定網路環境。取值說明如下:
說明
如果選擇為 true,則傳其他的 NamespaceId 會被忽略。 |
true |
| TerminationGracePeriodSeconds |
integer |
否 |
優雅下線逾時時間,預設為 30,單位為秒。取值範圍為 1~300。 |
30 |
| PhpArmsConfigLocation |
string |
否 |
PHP 應用程式監控掛載路徑,需要您保證 PHP 伺服器一定會載入這個路徑的設定檔。 您無需關注設定內容,SAE 會自動渲染正確的設定檔。 |
/usr/local/etc/php/conf.d/arms.ini |
| PhpConfigLocation |
string |
否 |
PHP 應用程式啟動設定掛載路徑,需要您保證 PHP 伺服器會使用這個設定檔啟動。 |
/usr/local/etc/php/php.ini |
| PhpConfig |
string |
否 |
PHP 設定檔內容。 |
k1=v1 |
| TomcatConfig |
string |
否 |
Tomcat 檔案設定,設定為 "" 或 "{}" 表示刪除設定:
|
{"port":8080,"contextPath":"/","maxThreads":400,"uriEncoding":"ISO-8859-1","useBodyEncodingForUri":true} |
| OssMountDescs |
string |
否 |
OSS 掛載描述資訊。參數說明如下:
|
[{"bucketName": "oss-bucket", "bucketPath": "data/user.data", "mountPath": "/usr/data/user.data", "readOnly": true}] |
| OssAkId |
string |
否 |
OSS 讀寫的 AccessKey ID。 |
xxxxxx |
| OssAkSecret |
string |
否 |
OSS 讀寫的 AccessKey Secret。 |
xxxxxx |
| Php |
string |
否 |
PHP 部署套件相依的 PHP 版本。映像不支援。 |
PHP-FPM 7.0 |
| AcrInstanceId |
string |
否 |
容器映像服務 ACR 企業版執行個體 ID。當 ImageUrl 為容器映像服務企業版時必填。 |
cri-xxxxxx |
| AcrAssumeRoleArn |
string |
否 |
跨帳號拉取映像時所需的 RAM 角色的 ARN。更多資訊,請參見 透過 RAM 角色實現跨雲端帳號授權。 |
acs:ram::123456789012****:role/adminrole |
| ImagePullSecrets |
string |
否 |
對應保密字典 ID。 |
10 |
| AssociateEip |
boolean |
否 |
是否綁定 EIP。取值說明如下:
|
true |
| ProgrammingLanguage |
string |
否 |
建立應用程式的技術堆疊語言。取值說明如下:
|
java |
| KafkaConfigs |
string |
否 |
日誌採集到 Kafka 的設定彙總資訊。取值說明如下:
|
{"kafkaEndpoint":"10.0.X.XXX:XXXX,10.0.X.XXX:XXXX,10.0.X.XXX:XXXX","kafkaInstanceId":"alikafka_pre-cn-7pp2l8kr****","kafkaConfigs":[{"logType":"file_log","logDir":"/tmp/a.log","kafkaTopic":"test2"},{"logType":"stdout","logDir":"","kafkaTopic":"test"}]} |
| PvtzDiscoverySvc |
string |
否 |
開啟 K8s Service 服務註冊發現。取值說明如下:
|
{"serviceName":"bwm-poc-sc-gateway-cn-beijing-front","namespaceId":"cn-beijing:front","portAndProtocol":{"18012":"TCP"},"enable":true,"portProtocols":[{"port":18012,"protocol":"TCP"}]} |
| MicroRegistration |
string |
否 |
選擇 Nacos 註冊中心,取值說明如下:
|
"0" |
| MicroRegistrationConfig |
string |
否 |
註冊中心設定資訊。 |
{\"instanceId\":\"mse-cn-zvp2bh6h70r\",\"namespace\":\"4c0aa74f-57cb-423c-b6af-5d9f2d0e3dbd\"} |
| NasConfigs |
string |
否 |
掛載 NAS 的設定。取值說明如下:
|
[{"mountPath":"/test1","readOnly":false,"nasId":"nasId1","mountDomain":"nasId1.cn-shenzhen.nas.aliyuncs.com","nasPath":"/test1"},{"nasId":"nasId2","mountDomain":"nasId2.cn-shenzhen.nas.aliyuncs.com","readOnly":false,"nasPath":"/test2","mountPath":"/test2"}] |
| Python |
string |
否 |
Python 環境。支援 PYTHON 3.9.15。 |
PYTHON 3.9.15 |
| PythonModules |
string |
否 |
自訂安裝模組相依性。預設安裝根目錄下 requirements.txt 定義的相依項目。如果未設定或自訂軟體套件,可以指定安裝的相依性。 |
Flask==2.0 |
| Dotnet |
string |
否 |
.NET 框架的版本號:
|
.NET 3.1 |
| EnableEbpf |
string |
否 |
基於 eBPF 技術,對非 Java 應用程式開啟應用程式監控能力。取值說明如下:
|
false |
| SaeVersion |
string |
否 |
SAE 版本。支援版本如下:
|
v1 |
| AppSource |
string |
否 |
選擇 micro_service,即為微服務應用程式。 |
micro_service |
| BaseAppId |
string |
否 |
基礎應用程式 ID。 |
ee99cce6-1c8e-4bfa-96c3-3e2fa9de8a41 |
| ServiceTags |
string |
否 |
應用程式設定的灰度標籤。 |
{\"alicloud.service.tag\":\"g1\"} |
| EnableNewArms |
boolean |
否 |
是否啟用新的 ARMS 功能:
|
false |
| EnableCpuBurst |
boolean |
否 |
是否啟用 CPU Burst 功能:
|
true |
| OidcRoleName |
string |
否 |
設定身分驗證服務 RAM 角色。 說明
需要提前建立同地域的 OIDC 身分供應商和身分供應商角色。具體資訊,請參見 建立 OIDC 身分供應商 和 建立角色 SSO 身分供應商。 |
sae-test |
| SidecarContainersConfig |
array |
否 |
容器設定資訊。 |
|
| SidecarContainerConfig |
否 |
容器設定資訊。 |
||
| SecretMountDesc |
string |
否 |
Secret 掛載描述。使用在命名空間保密字典頁面建立的保密字典來向容器中注入保密資訊。參數說明如下:
說明
可透過傳遞
|
[{“secretId":10,”key":"test","mountPath":"/tmp"}] |
| EnableSidecarResourceIsolated |
boolean |
否 |
是否啟用 Sidecar 資源隔離:
|
true |
| CustomImageNetworkType |
string |
否 |
自訂映像類型,如果非自訂映像,需要設定為空字串:
|
internet |
| ResourceType |
string |
否 |
資源類型。支援 NULL(預設)、default(預設)和 haiguang(海光伺服器)類型。 |
NULL |
| NewSaeVersion |
string |
否 |
應用程式版本:
|
pro |
| MicroserviceEngineConfig |
string |
否 |
設定微服務治理功能。
|
{"enable": true,"mseLosslessRule": {"delayTime": 0,"enable": false,"notice": false,"warmupTime": 120}} |
| DiskSize |
integer |
否 |
磁碟儲存大小(單位 GB)。 |
50 |
| InitContainersConfig |
array |
否 |
初始化容器設定。 |
|
| InitContainerConfig |
否 |
初始化容器設定。 |
||
| GpuConfig |
string |
否 |
||
| StartupProbe |
string |
否 |
啟用應用程式啟動偵測。
說明
|
{"exec":{"command":["sh","-c","cat /home/admin/start.sh"]},"initialDelaySeconds":30,"periodSeconds":30,"timeoutSeconds":2} |
| IsStateful |
boolean |
否 |
是否有狀態應用程式。 |
|
| EnablePrometheus |
boolean |
否 |
是否開啟 Prometheus 自訂指標採集。 |
false |
| HeadlessPvtzDiscoverySvc |
string |
否 |
K8s Headless Service 服務註冊發現
|
{\"serviceName\":\"leaf-test-headless\",\"namespaceId\":\"cn-zhangjiakou:prod\"} |
| Html |
string |
否 |
Nginx 版本
|
nginx 1.28 |
| EmptyDirDesc |
string |
否 |
共用臨時儲存設定。 |
[{\"name\":\"workdir\",\"mountPath\":\"/usr/local/tomcat/webapps\"}] |
| AgentVersion |
string |
否 |
是否複用命名空間 Agent 版本設定。 |
4.4.2 |
| EnableNamespaceAgentVersion |
boolean |
否 |
AliyunAgent 版本。 |
true |
| EnableNamespaceSlsConfig |
boolean |
否 |
是否複用命名空間 SLS 日誌設定。 |
true |
| SlsLogEnvTags |
string |
否 |
sls log tags |
|
| LokiConfigs |
string |
否 |
||
| Labels |
object |
否 |
||
|
string |
否 |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
建立的應用程式資訊。 |
||
| RequestId |
string |
請求 ID。 |
91F93257-7A4A-4BD3-9A7E-2F6EAE6D**** |
| Message |
string |
附加資訊。取值說明如下:
|
success |
| TraceId |
string |
呼叫鏈 ID,用於精確查詢呼叫資訊。 |
0a98a02315955564772843261e**** |
| Data |
object |
返回結果。 |
|
| ChangeOrderId |
string |
返回的發佈單 ID,用於查詢任務執行狀態。 |
01db03d3-3ee9-48b3-b3d0-dfce2d88**** |
| AppId |
string |
建立成功的應用程式 ID。 |
017f39b8-dfa4-4e16-a84b-1dcee4b1**** |
| ErrorCode |
string |
錯誤碼。取值說明如下:
|
空 |
| Code |
string |
介面狀態或 POP 錯誤碼。取值說明如下:
|
200 |
| Success |
boolean |
建立應用程式是否成功。取值說明如下:
|
true |
樣本
正常返回樣本
JSON格式
{
"RequestId": "91F93257-7A4A-4BD3-9A7E-2F6EAE6D****",
"Message": "success",
"TraceId": "0a98a02315955564772843261e****",
"Data": {
"ChangeOrderId": "01db03d3-3ee9-48b3-b3d0-dfce2d88****",
"AppId": "017f39b8-dfa4-4e16-a84b-1dcee4b1****"
},
"ErrorCode": "空",
"Code": "200",
"Success": true
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | Application.MissingJdk | Your application must at least contain a JDK component. | |
| 400 | InvalidPackageType.NotFound | The package type must be War, FatJar, or Image. | |
| 400 | InvalidParameter.NotEmpty | You must specify the parameter %s. | |
| 400 | InvalidParameter.Obviously | The specified parameter is invalid {%s}. | |
| 400 | JarApplication.MissingJdk | A FatJar application must contain JDK. | |
| 400 | NoAvailableCluster.NotFound | No clusters are available for the current region. | |
| 400 | NoComputeResourceQuota.Exceed | Your compute resource is insufficient. Please contact us to raise the quota. | |
| 400 | PandoraApplication.MissingJdk | The Pandora application is missing a JDK component. | |
| 400 | PandoraApplication.OnlyJdk | A Pandora application only requires JDK component. | |
| 400 | InvalidParameter.WithMessage | The parameter is invalid {%s}: %s | |
| 400 | InvalidComponent.NotFound | The current component (such as JDK, Tomcat, or EDASWebContainer) does not exist. | |
| 400 | InvalidHostnameIp.Invalid | The hostname and/or IP is invalid: Hostname [%s], IP [%s]. | |
| 400 | InvalidInstanceSpecification.Unsupported | The instance specification is not supported: CPU [%s], memory [%s]. | |
| 400 | InvalidServerlessRegion.Unsupported | The current region is not supported: %s | |
| 400 | WarApplication.MissingJdkWebcontainer | A War application must contain JDK and Tomcat. | |
| 400 | InvalidNamespace.WithUppercase | This namespace does not support creating SAE apps because it contains uppercase letters. | |
| 400 | LogService.ConfigQuotaExceed | The maximum number of Log Service configs is exceeded. | |
| 400 | LogService.InternalError | An exception occurred while calling Log Service. Please submit a ticket to solve the problem. | |
| 400 | LogService.LogDirInvalid | The log collection path is invalid. | |
| 400 | LogService.NotAvailable | Log Service is unavailable. Please activate Log Service first. | |
| 400 | LogService.ProjectNumQuotaExceed | The maximum number of Log Service projects is exceeded. | |
| 400 | user.indebt | The user has an outstanding payment. | |
| 400 | NoComputeResourceQuota.App.Exceed | You can create %s instances for each application. Please submit a ticket to raise the quota. | |
| 400 | NoComputeResourceQuota.User.Exceed | Your account is limited to create %s instances. Please submit a ticket to raise the quota. | |
| 400 | System.Upgrading | The system is being upgraded. Please try again later. | |
| 400 | VolumnPath.Conflict | Conflict between log collection directory and persistent storage directory. | |
| 400 | MountConflict.ConfigMap | Conflict detected for ConfigMap path %s. | |
| 400 | NotFound.ConfigMap | The ConfigMap object (ID: %s) does not exist. | |
| 400 | NotFound.ConfigMapKey | The key %s of ConfigMap object (ID: %s) does not exist. | |
| 400 | Sls.Config.Mixed.Multi.Project | The specified Config contains multiple projects. | |
| 400 | Sls.Config.User.Defined.Missing.Logstore.Info | The specified Config is invalid. Both Project and Logstore must be specified. | |
| 400 | Sls.Config.User.Defined.Missing.Project.Info | The specified Config is invalid. Both Project and Logstore must be specified. | |
| 400 | Sls.Logstore.Name.Invalid | The specified name of Logstore is invalid. The Logstore name must not contain the prefix "sae-". | |
| 400 | Sls.Logstore.User.Defined.Not.Exist | The user defined Logstore does not exist. | |
| 400 | Sls.Project.Name.Invalid | The specified project name is invalid. The project name must not contain the prefix "sae-". | |
| 400 | Sls.Project.User.Defined.Not.Exist | The user defined project does not exist. | |
| 400 | InvalidImageUrl.AcrInstanceId.Domain.NotMatch | The specified domain of ImageUrl does not match AcrInstanceId domains. | |
| 400 | PhpApplication.MissingPhpRuntime | A PHP application must contain PHP Runtime. | |
| 400 | InvalidParameter.FileName | The application deployment package name is invalid. This name can contain only alphanumeric characters, hyphens (-), and underscores (_). For deploying java package, you can upload JAR files only if the selected deployment version supports JAR file. Otherwise, upload WAR files only. For deploying php package, you can upload ZIP files only if the selected deployment version supports ZIP file. | |
| 400 | Sls.Logtail.Name.Invalid | The specified name of Logtail is invalid. The Logtail name must not contain the prefix sae-. | |
| 400 | vswitch.not.exist | The specified vSwitch does not exist. | |
| 400 | InvalidImageUrl.MissingAcrInstanceId | The specified domain of ImageUrl is from ACREE, but you are not specified AcrInstanceId. | |
| 400 | EnvFromSecretIdConflict.AlreadyExist | The specified SecretId [%s] already exist in the specified Envs. | |
| 400 | MountConflict.Secret | Conflict detected for Secret path %s. | |
| 404 | Associate.Eip.Not.Enough | No sufficient EIPs are available. | |
| 404 | InvalidNamespaceId.NotFound | The specified NamespaceId does not exist. | |
| 404 | InvalidVpcId.NotFound | The specified VpcId does not exist. | |
| 404 | InvalidAcrInstanceId.NotFound | The specified AcrInstanceId does not exist. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。