Skip to content

Commit

Permalink
remove audience support for GA release (#18071)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarishmaGhiya authored Oct 7, 2021
1 parent 751d92f commit 2bb7759
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
3 changes: 1 addition & 2 deletions sdk/monitor/monitor-query/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

### Features Added

- Added `audience` property in `MetricsClientOptions`
- Enabled browser support
- Added different result objects `LogsQueryPartialResult`, `LogsQuerySuccessfulResult` or `LogsQueryError` based on the success scenarios for log queries.

Expand All @@ -13,11 +12,11 @@
- Renamed `ErrorInfo` to `LogsErrorInfo`, which now extends the `Error` class and `code` as an additional property. Removed all the other properties.
- `query` method in `LogsQueryClient` renamed to `queryWorkspace`
- `query` method in `MetricsQueryClient` renamed to `queryResource`
- Renamed `credentialOptions.credentialScopes` property in `LogsQueryClientOptions` to `audience`
- Renamed the status types in `LogsQueryResultStatus`. `Partial` to `PartialFailure` and `Failed` to `Failure`.
- Renamed `timeGrain` in `MetricAvailability` to `granularity`
- Renamed `TimeInterval` to `QueryTimeInterval`
- Updated constants in `Durations` to camel-case.
- Removed `credentialOptions.credentialScopes` property in `LogsQueryClientOptions` since scopes other than default are not supported yet.
- Removed `throwOnAnyError` flag from `LogsQueryOptions` and `LogsQueryBatchOptions`
- Removed the error classes `BatchError` and `AggregateBatchError`
- Updated `LogsQueryBatchResult` object to be a list of objects with the following possible types:
Expand Down
3 changes: 0 additions & 3 deletions sdk/monitor/monitor-query/review/monitor-query.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class LogsQueryClient {

// @public
export interface LogsQueryClientOptions extends CommonClientOptions {
audience?: string;
endpoint?: string;
}

Expand Down Expand Up @@ -173,7 +172,6 @@ export interface MetricNamespace {

// @public
export interface MetricsClientOptions extends CommonClientOptions {
audience?: string;
endpoint?: string;
}

Expand Down Expand Up @@ -258,7 +256,6 @@ export interface TimeSeriesElement {
metadataValues?: MetadataValue[];
}


// (No @packageDocumentation comment for this package)

```
13 changes: 5 additions & 8 deletions sdk/monitor/monitor-query/src/logsQueryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ export interface LogsQueryClientOptions extends CommonClientOptions {
* The host to connect to.
*/
endpoint?: string;

/**
* Gets or sets the audience to use for authentication with Azure Active Directory.
* The authentication scope will be set from this audience.
* Defaults to 'https://api.loganalytics.io/.default'
*/
audience?: string;
}

/**
Expand All @@ -61,8 +54,12 @@ export class LogsQueryClient {
constructor(tokenCredential: TokenCredential, options?: LogsQueryClientOptions) {
// This client defaults to using 'https://api.loganalytics.io/' as the
// host.
let scope;
if (options?.endpoint) {
scope = `${options?.endpoint}./default`;
}
const credentialOptions = {
credentialScopes: options?.audience
credentialScopes: scope
};
const packageDetails = `azsdk-js-monitor-query/${SDK_VERSION}`;
const userAgentPrefix =
Expand Down
12 changes: 5 additions & 7 deletions sdk/monitor/monitor-query/src/metricsQueryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ const defaultMetricsScope = "https://management.azure.com/.default";
export interface MetricsQueryClientOptions extends CommonClientOptions {
/** Overrides client endpoint. */
endpoint?: string;
/**
* Gets or sets the audience to use for authentication with Azure Active Directory.
* The authentication scope will be set from this audience.
* Defaults to "https://management.azure.com/.default"
*/
audience?: string;
}

/**
Expand All @@ -63,8 +57,12 @@ export class MetricsQueryClient {
* @param options - Options for the client like controlling request retries.
*/
constructor(tokenCredential: TokenCredential, options?: MetricsQueryClientOptions) {
let scope;
if (options?.endpoint) {
scope = `${options?.endpoint}./default`;
}
const credentialOptions = {
credentialScopes: options?.audience
credentialScopes: scope
};
const packageDetails = `azsdk-js-monitor-query/${SDK_VERSION}`;
const userAgentPrefix =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ describe("LogsQueryClient unit tests", () => {
};

const client = new LogsQueryClient(tokenCredential, {
endpoint: "https://customEndpoint1",
audience: "https://customscopes1/"
endpoint: "https://customEndpoint1"
});

assert.equal(client["_logAnalytics"].$host, "https://customEndpoint1");
Expand All @@ -44,7 +43,5 @@ describe("LogsQueryClient unit tests", () => {
message: "Shortcircuit auth exception"
});
}

assert.deepEqual(scopesPassed, ["https://customscopes1/"]);
});
});

0 comments on commit 2bb7759

Please sign in to comment.