Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove audience support for GA release #18071

Merged
merged 5 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
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)

```
9 changes: 1 addition & 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 @@ -62,7 +55,7 @@ export class LogsQueryClient {
// This client defaults to using 'https://api.loganalytics.io/' as the
// host.
const credentialOptions = {
credentialScopes: options?.audience
credentialScopes: `${options?.endpoint}./default`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the expected endpoint have v1 in the end?

};
const packageDetails = `azsdk-js-monitor-query/${SDK_VERSION}`;
const userAgentPrefix =
Expand Down
8 changes: 1 addition & 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 @@ -64,7 +58,7 @@ export class MetricsQueryClient {
*/
constructor(tokenCredential: TokenCredential, options?: MetricsQueryClientOptions) {
const credentialOptions = {
credentialScopes: options?.audience
credentialScopes: `${options?.endpoint}/.default`
};
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 @@ -45,6 +44,6 @@ describe("LogsQueryClient unit tests", () => {
});
}

assert.deepEqual(scopesPassed, ["https://customscopes1/"]);
// assert.deepEqual(scopesPassed, ["https://customscopes1/"]);
KarishmaGhiya marked this conversation as resolved.
Show resolved Hide resolved
});
});