@@ -35,6 +35,7 @@ import { MetricPayload } from "./models/MetricPayload";
3535import { MetricsAndMetricTagConfigurations } from "./models/MetricsAndMetricTagConfigurations" ;
3636import { MetricsAndMetricTagConfigurationsResponse } from "./models/MetricsAndMetricTagConfigurationsResponse" ;
3737import { MetricSuggestedTagsAndAggregationsResponse } from "./models/MetricSuggestedTagsAndAggregationsResponse" ;
38+ import { MetricTagCardinalitiesResponse } from "./models/MetricTagCardinalitiesResponse" ;
3839import { MetricTagConfigurationCreateRequest } from "./models/MetricTagConfigurationCreateRequest" ;
3940import { MetricTagConfigurationMetricTypeCategory } from "./models/MetricTagConfigurationMetricTypeCategory" ;
4041import { MetricTagConfigurationResponse } from "./models/MetricTagConfigurationResponse" ;
@@ -344,6 +345,51 @@ export class MetricsApiRequestFactory extends BaseAPIRequestFactory {
344345 return requestContext ;
345346 }
346347
348+ public async getMetricTagCardinalityDetails (
349+ metricName : string ,
350+ _options ?: Configuration ,
351+ ) : Promise < RequestContext > {
352+ const _config = _options || this . configuration ;
353+
354+ // verify required parameter 'metricName' is not null or undefined
355+ if ( metricName === null || metricName === undefined ) {
356+ throw new RequiredError ( "metricName" , "getMetricTagCardinalityDetails" ) ;
357+ }
358+
359+ // Path Params
360+ const localVarPath =
361+ "/api/v2/metrics/{metric_name}/tag-cardinalities" . replace (
362+ "{metric_name}" ,
363+ encodeURIComponent ( String ( metricName ) ) ,
364+ ) ;
365+
366+ // Make Request Context
367+ const { server, overrides } = _config . getServerAndOverrides (
368+ "MetricsApi.v2.getMetricTagCardinalityDetails" ,
369+ MetricsApi . operationServers ,
370+ ) ;
371+ const requestContext = server . makeRequestContext (
372+ localVarPath ,
373+ HttpMethod . GET ,
374+ overrides ,
375+ ) ;
376+ requestContext . setHeaderParam ( "Accept" , "application/json" ) ;
377+ requestContext . setHttpConfig ( _config . httpConfig ) ;
378+
379+ // Set User-Agent
380+ if ( this . userAgent ) {
381+ requestContext . setHeaderParam ( "User-Agent" , this . userAgent ) ;
382+ }
383+
384+ // Apply auth methods
385+ applySecurityAuthentication ( _config , requestContext , [
386+ "apiKeyAuth" ,
387+ "appKeyAuth" ,
388+ ] ) ;
389+
390+ return requestContext ;
391+ }
392+
347393 public async listActiveMetricConfigurations (
348394 metricName : string ,
349395 windowSeconds ?: number ,
@@ -1213,6 +1259,67 @@ export class MetricsApiResponseProcessor {
12131259 ) ;
12141260 }
12151261
1262+ /**
1263+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
1264+ * to the expected objects
1265+ *
1266+ * @params response Response returned by the server for a request to getMetricTagCardinalityDetails
1267+ * @throws ApiException if the response code was not in [200, 299]
1268+ */
1269+ public async getMetricTagCardinalityDetails (
1270+ response : ResponseContext ,
1271+ ) : Promise < MetricTagCardinalitiesResponse > {
1272+ const contentType = normalizeMediaType ( response . headers [ "content-type" ] ) ;
1273+ if ( response . httpStatusCode === 200 ) {
1274+ const body : MetricTagCardinalitiesResponse = deserialize (
1275+ parse ( await response . body . text ( ) , contentType ) ,
1276+ TypingInfo ,
1277+ "MetricTagCardinalitiesResponse" ,
1278+ ) as MetricTagCardinalitiesResponse ;
1279+ return body ;
1280+ }
1281+ if (
1282+ response . httpStatusCode === 400 ||
1283+ response . httpStatusCode === 403 ||
1284+ response . httpStatusCode === 404 ||
1285+ response . httpStatusCode === 429
1286+ ) {
1287+ const bodyText = parse ( await response . body . text ( ) , contentType ) ;
1288+ let body : APIErrorResponse ;
1289+ try {
1290+ body = deserialize (
1291+ bodyText ,
1292+ TypingInfo ,
1293+ "APIErrorResponse" ,
1294+ ) as APIErrorResponse ;
1295+ } catch ( error ) {
1296+ logger . debug ( `Got error deserializing error: ${ error } ` ) ;
1297+ throw new ApiException < APIErrorResponse > (
1298+ response . httpStatusCode ,
1299+ bodyText ,
1300+ ) ;
1301+ }
1302+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
1303+ }
1304+
1305+ // Work around for missing responses in specification, e.g. for petstore.yaml
1306+ if ( response . httpStatusCode >= 200 && response . httpStatusCode <= 299 ) {
1307+ const body : MetricTagCardinalitiesResponse = deserialize (
1308+ parse ( await response . body . text ( ) , contentType ) ,
1309+ TypingInfo ,
1310+ "MetricTagCardinalitiesResponse" ,
1311+ "" ,
1312+ ) as MetricTagCardinalitiesResponse ;
1313+ return body ;
1314+ }
1315+
1316+ const body = ( await response . body . text ( ) ) || "" ;
1317+ throw new ApiException < string > (
1318+ response . httpStatusCode ,
1319+ 'Unknown API Status Code!\nBody: "' + body + '"' ,
1320+ ) ;
1321+ }
1322+
12161323 /**
12171324 * Unwraps the actual response sent by the server from the response context and deserializes the response content
12181325 * to the expected objects
@@ -1890,6 +1997,14 @@ export interface MetricsApiEstimateMetricsOutputSeriesRequest {
18901997 filterTimespanH ?: number ;
18911998}
18921999
2000+ export interface MetricsApiGetMetricTagCardinalityDetailsRequest {
2001+ /**
2002+ * The name of the metric.
2003+ * @type string
2004+ */
2005+ metricName : string ;
2006+ }
2007+
18932008export interface MetricsApiListActiveMetricConfigurationsRequest {
18942009 /**
18952010 * The name of the metric.
@@ -2186,6 +2301,30 @@ export class MetricsApi {
21862301 } ) ;
21872302 }
21882303
2304+ /**
2305+ * Returns the cardinality details of tags for a specific metric.
2306+ * @param param The request object
2307+ */
2308+ public getMetricTagCardinalityDetails (
2309+ param : MetricsApiGetMetricTagCardinalityDetailsRequest ,
2310+ options ?: Configuration ,
2311+ ) : Promise < MetricTagCardinalitiesResponse > {
2312+ const requestContextPromise =
2313+ this . requestFactory . getMetricTagCardinalityDetails (
2314+ param . metricName ,
2315+ options ,
2316+ ) ;
2317+ return requestContextPromise . then ( ( requestContext ) => {
2318+ return this . configuration . httpApi
2319+ . send ( requestContext )
2320+ . then ( ( responseContext ) => {
2321+ return this . responseProcessor . getMetricTagCardinalityDetails (
2322+ responseContext ,
2323+ ) ;
2324+ } ) ;
2325+ } ) ;
2326+ }
2327+
21892328 /**
21902329 * List tags and aggregations that are actively queried on dashboards, notebooks, monitors, the Metrics Explorer, and using the API for a given metric name.
21912330 * @param param The request object
0 commit comments