モックルールを作成します。
今すぐお試しください
テスト
RAM 認証
|
アクション |
アクセスレベル |
リソースタイプ |
条件キー |
依存アクション |
|
mse:AddMockRule |
*All Resource
|
なし | なし |
リクエストパラメーター
|
パラメーター |
型 |
必須 / 任意 |
説明 |
例 |
| Name |
string |
必須 |
ルールの名前。 |
agent-auto-test-sc |
| Region |
string |
必須 |
リージョン ID。 |
cn-hangzhou |
| Source |
string |
必須 |
ルールのソース。 |
edasmsc |
| ProviderAppId |
string |
任意 |
プロバイダーアプリケーションの ID。 |
dcqtkuhnc4@66e5235415**** |
| ProviderAppName |
string |
任意 |
プロバイダーアプリケーションの名前。 |
demo-cartservice |
| ExtraJson |
string |
必須 |
説明。 |
{} |
| ScMockItems |
string |
必須 |
入力パラメーター。値は JSON 文字列である必要があります。 |
[] |
| DubboMockItems |
string |
必須 |
ゴミ箱内のプロジェクトを指定します。 |
[] |
| ConsumerAppIds |
string |
必須 |
カスタムアプリケーションの ID。 |
[{\"appName\":\"provide\",\"appId\":\"bst8l6o735@f6d8aaf6e56e67d\"}] |
| Enable |
boolean |
任意 |
モックルールを有効にするかどうかを指定します。有効な値:
|
true |
| MockType |
integer |
任意 |
低速呼び出しのレスポンスタイム (RT) を指定します。有効な値:
|
1 |
| AcceptLanguage |
string |
任意 |
応答の言語。有効な値:
|
zh |
レスポンスフィールド
|
フィールド |
型 |
説明 |
例 |
|
object |
データ構造。 |
||
| HttpStatusCode |
integer |
HTTP ステータスコード。 |
200 |
| Message |
string |
返されるメッセージ。 |
Succ |
| RequestId |
string |
リクエスト ID。 |
316F5F64-F73D-42DC-8632-01E308B6**** |
| Data |
object |
データ概要。 |
|
| NamespaceId |
string |
名前空間 ID。 |
cn-shanghai |
| ScMockItemJson |
string |
HTTP プロトコルのモックルール。 |
[{"oper":"return+json","Path":"/mock","Value":"{\n \"date\": \"2021-09-10T07:45:12.357+0000\",\n \"name\": \"name\",\n \"id\": \"1\"\n}","Method":"GET","Condition":"AND","Timeout":1,"ArgumentMockItems":[{"type":"param","name":"id","value":"1","cond":"==","operator":"rawvalue"},{"type":"param","name":"name","value":"aliyun","cond":"==","operator":"rawvalue"}]}] |
| ConsumerAppName |
string |
クエリするアプリケーションの名前。 |
demo-xxxx |
| ConsumerAppId |
string |
コンシューマーアプリケーションの ID。 |
hkhon1po62@a000601b265xxxx |
| AccountId |
string |
アカウント ID。 |
178432728867xxxx |
| ExtraJson |
string |
説明。 |
desc |
| Source |
string |
ソース。 |
edasmsc |
| Region |
string |
リージョン。 |
cn-shanghai |
| ProviderAppId |
string |
プロバイダーアプリケーションの ID。 |
hkhon1po62@a000601b265xxxx |
| ProviderAppName |
string |
プロバイダーアプリケーションの名前。 |
demo-xxxx |
| Name |
string |
名前。 |
mse-bc1a29b0-160230875****-reg-center-0-1 |
| Id |
integer |
ルール ID。 |
275 |
| Enable |
boolean |
ルールが有効かどうかを示します。
|
true |
| MockType |
integer |
モデルタイプ。有効な値:
|
0 |
| Code |
integer |
リターンコード。 |
200 |
| Success |
boolean |
リクエストが成功したかどうかを示します。有効な値:
|
true |
例
成功レスポンス
JSONJSON
{
"HttpStatusCode": 200,
"Message": "Succ",
"RequestId": "316F5F64-F73D-42DC-8632-01E308B6****",
"Data": {
"NamespaceId": "cn-shanghai",
"ScMockItemJson": "[{\"oper\":\"return+json\",\"Path\":\"/mock\",\"Value\":\"{\\n \\\"date\\\": \\\"2021-09-10T07:45:12.357+0000\\\",\\n \\\"name\\\": \\\"name\\\",\\n \\\"id\\\": \\\"1\\\"\\n}\",\"Method\":\"GET\",\"Condition\":\"AND\",\"Timeout\":1,\"ArgumentMockItems\":[{\"type\":\"param\",\"name\":\"id\",\"value\":\"1\",\"cond\":\"==\",\"operator\":\"rawvalue\"},{\"type\":\"param\",\"name\":\"name\",\"value\":\"aliyun\",\"cond\":\"==\",\"operator\":\"rawvalue\"}]}]",
"ConsumerAppName": "demo-xxxx",
"ConsumerAppId": "hkhon1po62@a000601b265xxxx",
"AccountId": "178432728867xxxx",
"ExtraJson": "desc",
"Source": "edasmsc",
"Region": "cn-shanghai",
"ProviderAppId": "hkhon1po62@a000601b265xxxx",
"ProviderAppName": "demo-xxxx",
"Name": "mse-bc1a29b0-160230875****-reg-center-0-1",
"Id": 275,
"Enable": true,
"MockType": 0
},
"Code": 200,
"Success": true
}
エラーコード
|
HTTP ステータスコード |
エラーコード |
エラーメッセージ |
説明 |
|---|---|---|---|
| 400 | IllegalRequest | Invalid request:%s | |
| 400 | InvalidParameter | Parameter error:%s | |
| 500 | InternalError | Console error. Try again later:%s | |
| 403 | NoPermission | You are not authorized to perform this operation:%s | |
| 404 | NotFound | Not found:%s |
完全なリストについては、「エラーコード」をご参照ください。
変更履歴
完全なリストについては、「変更履歴」をご参照ください。