/// <summary> /// Retrieves the metrics determined by the given filter for the given /// partition key range id and region. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// Name of an Azure resource group. /// </param> /// <param name='accountName'> /// Cosmos DB database account name. /// </param> /// <param name='region'> /// Cosmos DB region, with spaces between words and each word capitalized. /// </param> /// <param name='databaseRid'> /// Cosmos DB database rid. /// </param> /// <param name='collectionRid'> /// Cosmos DB collection rid. /// </param> /// <param name='partitionKeyRangeId'> /// Partition Key Range Id for which to get data. /// </param> /// <param name='filter'> /// An OData filter expression that describes a subset of metrics to return. /// The parameters that can be filtered are name.value (name of the metric, can /// have an or of multiple names), startTime, endTime, and timeGrain. The /// supported operator is eq. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IEnumerable <PartitionMetric> > ListMetricsAsync(this IPartitionKeyRangeIdRegionOperations operations, string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListMetricsWithHttpMessagesAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Initializes client properties. /// </summary> protected override void Initialize() { DatabaseAccounts = new DatabaseAccountsOperations(this); Operations = new Operations(this); Database = new DatabaseOperations(this); Collection = new CollectionOperations(this); CollectionRegion = new CollectionRegionOperations(this); DatabaseAccountRegion = new DatabaseAccountRegionOperations(this); PercentileSourceTarget = new PercentileSourceTargetOperations(this); PercentileTarget = new PercentileTargetOperations(this); Percentile = new PercentileOperations(this); CollectionPartitionRegion = new CollectionPartitionRegionOperations(this); CollectionPartition = new CollectionPartitionOperations(this); PartitionKeyRangeId = new PartitionKeyRangeIdOperations(this); PartitionKeyRangeIdRegion = new PartitionKeyRangeIdRegionOperations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2015-04-08"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; SerializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); }
/// <summary> /// Retrieves the metrics determined by the given filter for the given /// partition key range id and region. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// Name of an Azure resource group. /// </param> /// <param name='accountName'> /// Cosmos DB database account name. /// </param> /// <param name='region'> /// Cosmos DB region, with spaces between words and each word capitalized. /// </param> /// <param name='databaseRid'> /// Cosmos DB database rid. /// </param> /// <param name='collectionRid'> /// Cosmos DB collection rid. /// </param> /// <param name='partitionKeyRangeId'> /// Partition Key Range Id for which to get data. /// </param> /// <param name='filter'> /// An OData filter expression that describes a subset of metrics to return. /// The parameters that can be filtered are name.value (name of the metric, can /// have an or of multiple names), startTime, endTime, and timeGrain. The /// supported operator is eq. /// </param> public static IEnumerable <PartitionMetric> ListMetrics(this IPartitionKeyRangeIdRegionOperations operations, string resourceGroupName, string accountName, string region, string databaseRid, string collectionRid, string partitionKeyRangeId, string filter) { return(operations.ListMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter).GetAwaiter().GetResult()); }