LoadTestRunClient.CreateOrUpdateAppComponents メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
アプリ コンポーネント (Azure リソースのコレクション) をテスト実行に関連付けます。
public virtual Azure.Response CreateOrUpdateAppComponents (string testRunId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateOrUpdateAppComponents : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.CreateOrUpdateAppComponents : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function CreateOrUpdateAppComponents (testRunId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Response
パラメーター
- testRunId
- String
ロード テストの実行の一意の名前。小文字のアルファベット、数字、アンダースコア、またはハイフン文字のみを含める必要があります。
- content
- RequestContent
要求の本文として送信するコンテンツ。 要求本文スキーマの詳細については、以下の「解説」セクションを参照してください。
- context
- RequestContext
要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。
戻り値
サービスから返された応答。 応答本文スキーマの詳細については、以下の「解説」セクションを参照してください。
例外
testRunId
または content
が null です。
testRunId
は空の文字列であり、空でないと想定されていました。
サービスから成功以外の状態コードが返されました。
例
このサンプルでは、必要なパラメーターを使用して CreateOrUpdateAppComponents を呼び出し、コンテンツを要求し、結果を解析する方法を示します。
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new LoadTestRunClient(endpoint, credential);
var data = new {
components = new {
key = new {
resourceName = "<resourceName>",
resourceType = "<resourceType>",
displayName = "<displayName>",
kind = "<kind>",
},
},
};
Response response = client.CreateOrUpdateAppComponents("<testRunId>", RequestContent.Create(data));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("resourceId").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("resourceName").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("resourceType").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("displayName").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("resourceGroup").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("subscriptionId").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("kind").ToString());
Console.WriteLine(result.GetProperty("testRunId").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("createdBy").ToString());
Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString());
Console.WriteLine(result.GetProperty("lastModifiedBy").ToString());
注釈
要求と応答のペイロードの JSON スキーマを次に示します。
要求本文:
の TestRunAppComponents
スキーマ:
{
components: Dictionary<string, AppComponent>, # Required. Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object }
testRunId: string, # Optional. Test run identifier
createdDateTime: string (ISO 8601 Format), # Optional. The creation datetime(ISO 8601 literal format).
createdBy: string, # Optional. The user that created.
lastModifiedDateTime: string (ISO 8601 Format), # Optional. The last Modified datetime(ISO 8601 literal format).
lastModifiedBy: string, # Optional. The user that last modified.
}
応答本文:
の TestRunAppComponents
スキーマ:
{
components: Dictionary<string, AppComponent>, # Required. Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object }
testRunId: string, # Optional. Test run identifier
createdDateTime: string (ISO 8601 Format), # Optional. The creation datetime(ISO 8601 literal format).
createdBy: string, # Optional. The user that created.
lastModifiedDateTime: string (ISO 8601 Format), # Optional. The last Modified datetime(ISO 8601 literal format).
lastModifiedBy: string, # Optional. The user that last modified.
}
適用対象
Azure SDK for .NET