Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<doc>
<members>
<member name="BatchAsync(string,string,IEnumerable{string},RequestContent,string,string,string,string,int?,string,string,RequestContext)">
<example>
This sample shows how to call BatchAsync and parse the result.
<code><![CDATA[
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
MetricsBatchClient client = new MetricsBatchClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new object());
Response response = await client.BatchAsync("<subscriptionId>", "<metricnamespace>", new string[] { "<metricnames>" }, content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
]]></code>
This sample shows how to call BatchAsync with all parameters and request content and parse the result.
<code><![CDATA[
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
MetricsBatchClient client = new MetricsBatchClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
resourceids = new object[]
{
new object()
},
});
Response response = await client.BatchAsync("<subscriptionId>", "<metricnamespace>", new string[] { "<metricnames>" }, content, starttime: "<starttime>", endtime: "<endtime>", interval: "<interval>", aggregation: "<aggregation>", top: 1234, orderby: "<orderby>", filter: "<filter>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("values")[0].GetProperty("starttime").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("endtime").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("interval").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("namespace").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("resourceregion").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("resourceid").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("name").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("name").GetProperty("localizedValue").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("displayDescription").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("errorCode").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("errorMessage").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("metadatavalues")[0].GetProperty("name").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("metadatavalues")[0].GetProperty("name").GetProperty("localizedValue").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("metadatavalues")[0].GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("timeStamp").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("average").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("minimum").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("maximum").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("total").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("count").ToString());
]]></code></example>
</member>
<member name="Batch(string,string,IEnumerable{string},RequestContent,string,string,string,string,int?,string,string,RequestContext)">
<example>
This sample shows how to call Batch and parse the result.
<code><![CDATA[
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
MetricsBatchClient client = new MetricsBatchClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new object());
Response response = client.Batch("<subscriptionId>", "<metricnamespace>", new string[] { "<metricnames>" }, content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
]]></code>
This sample shows how to call Batch with all parameters and request content and parse the result.
<code><![CDATA[
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
MetricsBatchClient client = new MetricsBatchClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
resourceids = new object[]
{
new object()
},
});
Response response = client.Batch("<subscriptionId>", "<metricnamespace>", new string[] { "<metricnames>" }, content, starttime: "<starttime>", endtime: "<endtime>", interval: "<interval>", aggregation: "<aggregation>", top: 1234, orderby: "<orderby>", filter: "<filter>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("values")[0].GetProperty("starttime").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("endtime").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("interval").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("namespace").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("resourceregion").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("resourceid").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("name").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("name").GetProperty("localizedValue").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("displayDescription").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("errorCode").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("errorMessage").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("metadatavalues")[0].GetProperty("name").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("metadatavalues")[0].GetProperty("name").GetProperty("localizedValue").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("metadatavalues")[0].GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("timeStamp").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("average").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("minimum").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("maximum").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("total").ToString());
Console.WriteLine(result.GetProperty("values")[0].GetProperty("value")[0].GetProperty("timeseries")[0].GetProperty("data")[0].GetProperty("count").ToString());
]]></code></example>
</member>
</members>
</doc>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading