From 6fe5323f7aa66cc8c2c0d2e074658d0b6c847c65 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 25 Jun 2021 16:26:38 -0700 Subject: [PATCH 1/8] remove _response types --- .../src/metricsAdvisorAdministrationClient.ts | 50 +-- .../src/metricsAdvisorClient.ts | 105 ++---- .../ai-metrics-advisor/src/models.ts | 354 +----------------- 3 files changed, 41 insertions(+), 468 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts index fe7014943516..d92974d7f996 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts @@ -429,10 +429,7 @@ export class MetricsAdvisorAdministrationClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -452,10 +449,7 @@ export class MetricsAdvisorAdministrationClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -834,10 +828,7 @@ export class MetricsAdvisorAdministrationClient { ); const alertConfigurations = segment.value?.map((c) => fromServiceAlertConfiguration(c)) ?? []; - yield Object.defineProperty(alertConfigurations, "_response", { - enumerable: false, - value: segment._response - }); + yield alertConfigurations; } private async *listItemsOfAlertingConfigurations( @@ -1029,10 +1020,7 @@ export class MetricsAdvisorAdministrationClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1045,10 +1033,7 @@ export class MetricsAdvisorAdministrationClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } } @@ -1202,10 +1187,7 @@ export class MetricsAdvisorAdministrationClient { // Service doesn't support server-side paging now const segment = await this.client.getAnomalyDetectionConfigurationsByMetric(metricId, options); const configs = segment.value?.map((c) => fromServiceAnomalyDetectionConfiguration(c)) ?? []; - const resultArray = Object.defineProperty(configs, "_response", { - enumerable: false, - value: segment._response - }); + const resultArray = configs; yield resultArray; } @@ -1377,10 +1359,7 @@ export class MetricsAdvisorAdministrationClient { value: segmentResponse.nextLink } ); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1411,10 +1390,7 @@ export class MetricsAdvisorAdministrationClient { value: segmentResponse.nextLink } ); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1745,10 +1721,7 @@ export class MetricsAdvisorAdministrationClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1767,10 +1740,7 @@ export class MetricsAdvisorAdministrationClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts index 1e038aae8b55..e91bcb73fc5b 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts @@ -257,10 +257,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -285,10 +282,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } } @@ -454,10 +448,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -489,10 +480,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } } @@ -637,10 +625,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -672,10 +657,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -825,10 +807,7 @@ export class MetricsAdvisorClient { }; }); - return Object.defineProperty(results, "_response", { - enumerable: false, - value: result._response - }); + return results; } /** @@ -881,10 +860,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -913,10 +889,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; } } @@ -1070,10 +1043,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1090,10 +1060,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1268,10 +1235,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1302,10 +1266,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1581,10 +1542,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1602,10 +1560,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1775,10 +1730,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1801,10 +1753,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1937,10 +1886,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -1957,10 +1903,7 @@ export class MetricsAdvisorClient { enumerable: true, value: segmentResponse.nextLink }); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -2100,10 +2043,7 @@ export class MetricsAdvisorClient { value: segmentResponse.nextLink } ); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } @@ -2129,10 +2069,7 @@ export class MetricsAdvisorClient { value: segmentResponse.nextLink } ); - yield Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: segmentResponse._response - }); + yield resultArray; continuationToken = segmentResponse.nextLink; } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/models.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/models.ts index 354ce2b6679b..6e766d9f4421 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/models.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/models.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as coreHttp from "@azure/core-http"; - import { SuppressCondition, SmartDetectionCondition, @@ -1664,163 +1662,44 @@ export interface MetricEnrichedSeriesData { /** * Contains response data for the getDataFeed operation. */ -export type GetDataFeedResponse = MetricsAdvisorDataFeed & { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +export type GetDataFeedResponse = MetricsAdvisorDataFeed & {}; /** * Contains response data for the getAnomalyDetectionConfiguration operation. */ -export type GetDetectionConfigResponse = AnomalyDetectionConfiguration & { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +export type GetDetectionConfigResponse = AnomalyDetectionConfiguration; /** * Contains response data for the getAnomalyAlertConfiguration operation. */ -export type GetAlertConfigResponse = AnomalyAlertConfiguration & { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +export type GetAlertConfigResponse = AnomalyAlertConfiguration; /** * Contains response data for the getHook operation. */ -export type GetHookResponse = NotificationHookUnion & { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +export type GetHookResponse = NotificationHookUnion; /** * Contains response data for the getCredentialEntity operation. */ -export type GetDataSourceCredentialEntityResponse = DataSourceCredentialEntityUnion & { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +export type GetDataSourceCredentialEntityResponse = DataSourceCredentialEntityUnion; /** * Contains response data for the getMetricEnrichedSeriesData operation. */ -export interface GetMetricEnrichedSeriesDataResponse extends Array { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -} +export interface GetMetricEnrichedSeriesDataResponse extends Array {} /** * Contains response data for the getIncidentRootCause operation. */ export type GetIncidentRootCauseResponse = { rootCauses: IncidentRootCause[]; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; }; /** * Contains response data for the getFeedback operation. */ -export type GetFeedbackResponse = MetricFeedbackUnion & { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +export type GetFeedbackResponse = MetricFeedbackUnion & {}; /** * Contains response data for the listAlertsForAlertConfiguration operation. @@ -1830,20 +1709,6 @@ export interface AlertsPageResponse extends Array { * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } /** @@ -1854,20 +1719,6 @@ export interface AnomaliesPageResponse extends Array { * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } /** @@ -1878,20 +1729,6 @@ export interface DimensionValuesPageResponse extends Array { * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } /** @@ -1902,20 +1739,6 @@ export interface IncidentsPageResponse extends Array { * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } /** @@ -1926,20 +1749,6 @@ export interface MetricSeriesPageResponse extends Array * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } /** @@ -1968,20 +1777,6 @@ export interface MetricEnrichmentStatusPageResponse extends Array { * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } /** @@ -2016,20 +1797,6 @@ export interface GetMetricSeriesDataResponse extends Array { * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } export interface IngestionStatus { @@ -2054,20 +1821,6 @@ export interface IngestionStatusPageResponse extends Array { * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } /** @@ -2078,60 +1831,16 @@ export interface MetricFeedbackPageResponse extends Array { * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } /** * Contains response data for the listAlertConfigs operation. */ -export interface AlertConfigurationsPageResponse extends Array { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -} +export interface AlertConfigurationsPageResponse extends Array {} /** * Contains response data for the listAnomalyDetectionConfigurations operation. */ -export interface DetectionConfigurationsPageResponse extends Array { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -} +export interface DetectionConfigurationsPageResponse extends Array {} /** * Contains response data for the listHooks operation. @@ -2141,20 +1850,6 @@ export interface HooksPageResponse extends Array { * Continuation token to pass to `byPage()` to resume listing of more results if available. */ continuationToken?: string; - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; } /** @@ -2171,22 +1866,7 @@ export type GetIngestionProgressResponse = { * null indicates not available */ readonly latestActiveTimestamp?: number; -} & { - /** - * The underlying HTTP response. - */ - _response: coreHttp.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; +} & {}; /** * Data Source Credential @@ -2353,18 +2033,4 @@ export interface CredentialsPageResponse extends Array Date: Fri, 25 Jun 2021 16:33:47 -0700 Subject: [PATCH 2/8] remove _response types --- .../src/metricsAdvisorAdministrationClient.ts | 25 ++++++++----------- .../src/metricsAdvisorClient.ts | 6 ++--- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts index d92974d7f996..c80fd3a5df06 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts @@ -308,7 +308,7 @@ export class MetricsAdvisorAdministrationClient { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getDataFeedById(id, requestOptions); const resultDataFeed: MetricsAdvisorDataFeed = fromServiceDataFeedDetailUnion(result); - return { ...resultDataFeed, _response: result._response }; + return { ...resultDataFeed }; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -507,7 +507,7 @@ export class MetricsAdvisorAdministrationClient { }; const result = await this.client.updateDataFeed(dataFeedId, patchBody, requestOptions); const resultDataFeed: MetricsAdvisorDataFeed = fromServiceDataFeedDetailUnion(result); - return { ...resultDataFeed, _response: result._response }; + return { ...resultDataFeed }; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -602,8 +602,7 @@ export class MetricsAdvisorAdministrationClient { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getAnomalyDetectionConfiguration(id, requestOptions); return { - ...fromServiceAnomalyDetectionConfiguration(result), - _response: result._response + ...fromServiceAnomalyDetectionConfiguration(result) }; } catch (e) { span.setStatus({ @@ -642,8 +641,7 @@ export class MetricsAdvisorAdministrationClient { requestOptions ); return { - ...fromServiceAnomalyDetectionConfiguration(result), - _response: result._response + ...fromServiceAnomalyDetectionConfiguration(result) }; } catch (e) { span.setStatus({ @@ -746,7 +744,7 @@ export class MetricsAdvisorAdministrationClient { transformed, requestOptions ); - return { ...fromServiceAlertConfiguration(result), _response: result._response }; + return { ...fromServiceAlertConfiguration(result) }; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -776,7 +774,7 @@ export class MetricsAdvisorAdministrationClient { try { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getAnomalyAlertingConfiguration(id, requestOptions); - return { ...fromServiceAlertConfiguration(result), _response: result._response }; + return { ...fromServiceAlertConfiguration(result) }; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -992,7 +990,7 @@ export class MetricsAdvisorAdministrationClient { const resultHookResponse: NotificationHookUnion = fromServiceHookInfoUnion( result._response.parsedBody ); - return { ...resultHookResponse, _response: result._response }; + return { ...resultHookResponse }; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -1143,7 +1141,7 @@ export class MetricsAdvisorAdministrationClient { const resultHookResponse: NotificationHookUnion = fromServiceHookInfoUnion( result._response.parsedBody ); - return { ...resultHookResponse, _response: result._response }; + return { ...resultHookResponse }; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -1311,8 +1309,7 @@ export class MetricsAdvisorAdministrationClient { const response = await this.client.getIngestionProgress(dataFeedId, requestOptions); return { latestActiveTimestamp: response.latestActiveTimestamp?.getTime(), - latestSuccessTimestamp: response.latestSuccessTimestamp?.getTime(), - _response: response._response + latestSuccessTimestamp: response.latestSuccessTimestamp?.getTime() }; } catch (e) { span.setStatus({ @@ -1606,7 +1603,7 @@ export class MetricsAdvisorAdministrationClient { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getCredential(id, requestOptions); const resultCred = fromServiceCredential(result); - return { ...resultCred, _response: result._response }; + return { ...resultCred }; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -1768,7 +1765,7 @@ export class MetricsAdvisorAdministrationClient { requestOptions ); const resultCred = fromServiceCredential(result); - return { ...resultCred, _response: result._response }; + return { ...resultCred }; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts index e91bcb73fc5b..b6858ac8a0e8 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts @@ -1422,8 +1422,7 @@ export class MetricsAdvisorClient { }; }); return { - rootCauses: transformed, - _response: result._response + rootCauses: transformed }; } catch (e) { span.setStatus({ @@ -1491,8 +1490,7 @@ export class MetricsAdvisorClient { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getMetricFeedback(id, requestOptions); return { - ...fromServiceMetricFeedbackUnion(result), - _response: result._response + ...fromServiceMetricFeedbackUnion(result) }; } catch (e) { span.setStatus({ From fc88b30e0977fe9e219b5f1a68e9a91071d320eb Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 25 Jun 2021 16:55:47 -0700 Subject: [PATCH 3/8] api review file --- .../review/ai-metrics-advisor.api.md | 114 ++---------------- 1 file changed, 7 insertions(+), 107 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md b/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md index 7747aa7b95fc..9e6e4d5dbed2 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md +++ b/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md @@ -4,7 +4,6 @@ ```ts -import * as coreHttp from '@azure/core-http'; import { OperationOptions } from '@azure/core-http'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; import { PipelineOptions } from '@azure/core-http'; @@ -13,10 +12,6 @@ import { TokenCredential } from '@azure/core-auth'; // @public export interface AlertConfigurationsPageResponse extends Array { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -25,19 +20,11 @@ export type AlertQueryTimeMode = "AnomalyTime" | "CreatedTime" | "ModifiedTime"; // @public export interface AlertsPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public export interface AnomaliesPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -232,10 +219,6 @@ export interface CreateDataFeedOptions extends OperationOptions { // @public export interface CredentialsPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -344,10 +327,6 @@ export type DataFeedSourcePatch = Partial & { // @public export interface DataFeedsPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -504,10 +483,6 @@ export interface DetectionConditionsCommonPatch { // @public export interface DetectionConfigurationsPageResponse extends Array { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -516,10 +491,6 @@ export type DimensionKey = Record; // @public export interface DimensionValuesPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -553,72 +524,33 @@ export type FeedbackQueryTimeMode = "MetricTimestamp" | "FeedbackCreatedTime"; export type FeedbackType = "Anomaly" | "ChangePoint" | "Period" | "Comment"; // @public -export type GetAlertConfigResponse = AnomalyAlertConfiguration & { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; -}; +export type GetAlertConfigResponse = AnomalyAlertConfiguration; // @public -export type GetDataFeedResponse = MetricsAdvisorDataFeed & { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; -}; +export type GetDataFeedResponse = MetricsAdvisorDataFeed & {}; // @public -export type GetDataSourceCredentialEntityResponse = DataSourceCredentialEntityUnion & { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; -}; +export type GetDataSourceCredentialEntityResponse = DataSourceCredentialEntityUnion; // @public -export type GetDetectionConfigResponse = AnomalyDetectionConfiguration & { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; -}; +export type GetDetectionConfigResponse = AnomalyDetectionConfiguration; // @public -export type GetFeedbackResponse = MetricFeedbackUnion & { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; -}; +export type GetFeedbackResponse = MetricFeedbackUnion & {}; // @public -export type GetHookResponse = NotificationHookUnion & { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; -}; +export type GetHookResponse = NotificationHookUnion; // @public export type GetIncidentRootCauseResponse = { rootCauses: IncidentRootCause[]; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; }; // @public export type GetIngestionProgressResponse = { readonly latestSuccessTimestamp?: number; readonly latestActiveTimestamp?: number; -} & { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; -}; +} & {}; // @public export interface GetMetricEnrichedSeriesDataOptions extends OperationOptions { @@ -626,10 +558,6 @@ export interface GetMetricEnrichedSeriesDataOptions extends OperationOptions { // @public export interface GetMetricEnrichedSeriesDataResponse extends Array { - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -639,10 +567,6 @@ export interface GetMetricSeriesDataOptions extends OperationOptions { // @public export interface GetMetricSeriesDataResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -664,10 +588,6 @@ export type HardThresholdConditionUnion = { // @public export interface HooksPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -681,10 +601,6 @@ export interface IncidentRootCause { // @public export interface IncidentsPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -708,10 +624,6 @@ export interface IngestionStatus { // @public export interface IngestionStatusPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -928,10 +840,6 @@ export interface MetricEnrichedSeriesData { // @public export interface MetricEnrichmentStatusPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -946,10 +854,6 @@ export interface MetricFeedbackCommon { // @public export interface MetricFeedbackPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public @@ -1082,10 +986,6 @@ export type MetricSeriesGroupDetectionCondition = DetectionConditionsCommon & { // @public export interface MetricSeriesPageResponse extends Array { continuationToken?: string; - _response: coreHttp.HttpResponse & { - bodyAsText: string; - parsedBody: any; - }; } // @public From 6128c2ec35e077c9cf916a13daf0bc897346436d Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 25 Jun 2021 17:05:33 -0700 Subject: [PATCH 4/8] remove _response types --- .../src/metricsAdvisorAdministrationClient.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts index c80fd3a5df06..5209524ce492 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts @@ -308,7 +308,7 @@ export class MetricsAdvisorAdministrationClient { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getDataFeedById(id, requestOptions); const resultDataFeed: MetricsAdvisorDataFeed = fromServiceDataFeedDetailUnion(result); - return { ...resultDataFeed }; + return resultDataFeed; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -507,7 +507,7 @@ export class MetricsAdvisorAdministrationClient { }; const result = await this.client.updateDataFeed(dataFeedId, patchBody, requestOptions); const resultDataFeed: MetricsAdvisorDataFeed = fromServiceDataFeedDetailUnion(result); - return { ...resultDataFeed }; + return resultDataFeed; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -601,9 +601,7 @@ export class MetricsAdvisorAdministrationClient { try { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getAnomalyDetectionConfiguration(id, requestOptions); - return { - ...fromServiceAnomalyDetectionConfiguration(result) - }; + return fromServiceAnomalyDetectionConfiguration(result); } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -1603,7 +1601,7 @@ export class MetricsAdvisorAdministrationClient { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getCredential(id, requestOptions); const resultCred = fromServiceCredential(result); - return { ...resultCred }; + return resultCred; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -1765,7 +1763,7 @@ export class MetricsAdvisorAdministrationClient { requestOptions ); const resultCred = fromServiceCredential(result); - return { ...resultCred }; + return resultCred; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, From b6355c7183bca7b560a67d39b68ddd535d7f7d09 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 25 Jun 2021 17:06:32 -0700 Subject: [PATCH 5/8] remove _response types --- .../ai-metrics-advisor/src/metricsAdvisorClient.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts index b6858ac8a0e8..9f13a636f507 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts @@ -1489,9 +1489,7 @@ export class MetricsAdvisorClient { try { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getMetricFeedback(id, requestOptions); - return { - ...fromServiceMetricFeedbackUnion(result) - }; + return fromServiceMetricFeedbackUnion(result); } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, From 92f4fde39ef3c3728ece2bce1459704c2baa6443 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 25 Jun 2021 17:20:42 -0700 Subject: [PATCH 6/8] remove empty brackets --- sdk/metricsadvisor/ai-metrics-advisor/src/models.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/models.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/models.ts index 6e766d9f4421..78fcda2c5ef8 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/models.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/models.ts @@ -1662,7 +1662,7 @@ export interface MetricEnrichedSeriesData { /** * Contains response data for the getDataFeed operation. */ -export type GetDataFeedResponse = MetricsAdvisorDataFeed & {}; +export type GetDataFeedResponse = MetricsAdvisorDataFeed; /** * Contains response data for the getAnomalyDetectionConfiguration operation. @@ -1699,7 +1699,7 @@ export type GetIncidentRootCauseResponse = { /** * Contains response data for the getFeedback operation. */ -export type GetFeedbackResponse = MetricFeedbackUnion & {}; +export type GetFeedbackResponse = MetricFeedbackUnion; /** * Contains response data for the listAlertsForAlertConfiguration operation. @@ -1866,7 +1866,7 @@ export type GetIngestionProgressResponse = { * null indicates not available */ readonly latestActiveTimestamp?: number; -} & {}; +}; /** * Data Source Credential From 8ee5fa316fa91171f79d411b2711bf93f47741cd Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 25 Jun 2021 17:20:55 -0700 Subject: [PATCH 7/8] remove empty brackets --- .../ai-metrics-advisor/review/ai-metrics-advisor.api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md b/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md index 9e6e4d5dbed2..0e7c07d847a3 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md +++ b/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md @@ -527,7 +527,7 @@ export type FeedbackType = "Anomaly" | "ChangePoint" | "Period" | "Comment"; export type GetAlertConfigResponse = AnomalyAlertConfiguration; // @public -export type GetDataFeedResponse = MetricsAdvisorDataFeed & {}; +export type GetDataFeedResponse = MetricsAdvisorDataFeed; // @public export type GetDataSourceCredentialEntityResponse = DataSourceCredentialEntityUnion; @@ -536,7 +536,7 @@ export type GetDataSourceCredentialEntityResponse = DataSourceCredentialEntityUn export type GetDetectionConfigResponse = AnomalyDetectionConfiguration; // @public -export type GetFeedbackResponse = MetricFeedbackUnion & {}; +export type GetFeedbackResponse = MetricFeedbackUnion; // @public export type GetHookResponse = NotificationHookUnion; @@ -550,7 +550,7 @@ export type GetIncidentRootCauseResponse = { export type GetIngestionProgressResponse = { readonly latestSuccessTimestamp?: number; readonly latestActiveTimestamp?: number; -} & {}; +}; // @public export interface GetMetricEnrichedSeriesDataOptions extends OperationOptions { From 9544b9e5800cec56c4d7ca9a9a20920332f0aeb5 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 25 Jun 2021 17:38:10 -0700 Subject: [PATCH 8/8] remove empty brackets --- .../src/metricsAdvisorAdministrationClient.ts | 12 +++++------- .../ai-metrics-advisor/src/metricsAdvisorClient.ts | 4 ---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts index 5209524ce492..9d8af0b2ce72 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts @@ -638,9 +638,7 @@ export class MetricsAdvisorAdministrationClient { transformed, requestOptions ); - return { - ...fromServiceAnomalyDetectionConfiguration(result) - }; + return fromServiceAnomalyDetectionConfiguration(result); } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -742,7 +740,7 @@ export class MetricsAdvisorAdministrationClient { transformed, requestOptions ); - return { ...fromServiceAlertConfiguration(result) }; + return fromServiceAlertConfiguration(result); } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -772,7 +770,7 @@ export class MetricsAdvisorAdministrationClient { try { const requestOptions = operationOptionsToRequestOptionsBase(finalOptions); const result = await this.client.getAnomalyAlertingConfiguration(id, requestOptions); - return { ...fromServiceAlertConfiguration(result) }; + return fromServiceAlertConfiguration(result); } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -988,7 +986,7 @@ export class MetricsAdvisorAdministrationClient { const resultHookResponse: NotificationHookUnion = fromServiceHookInfoUnion( result._response.parsedBody ); - return { ...resultHookResponse }; + return resultHookResponse; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, @@ -1139,7 +1137,7 @@ export class MetricsAdvisorAdministrationClient { const resultHookResponse: NotificationHookUnion = fromServiceHookInfoUnion( result._response.parsedBody ); - return { ...resultHookResponse }; + return resultHookResponse; } catch (e) { span.setStatus({ code: SpanStatusCode.ERROR, diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts index 9f13a636f507..beecd45eb6fc 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts @@ -1691,10 +1691,6 @@ export class MetricsAdvisorClient { values: s.valueList }; }) || []; - Object.defineProperty(resultArray, "_response", { - enumerable: false, - value: result._response - }); return resultArray as GetMetricSeriesDataResponse; }