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 1 commit
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
4 changes: 1 addition & 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,7 @@ export class LogsQueryClient {

// @public
export interface LogsQueryClientOptions extends CommonClientOptions {
audience?: string;
_audience?: string;
KarishmaGhiya marked this conversation as resolved.
Show resolved Hide resolved
endpoint?: string;
}

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

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

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


// (No @packageDocumentation comment for this package)

```
6 changes: 4 additions & 2 deletions sdk/monitor/monitor-query/src/logsQueryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ export interface LogsQueryClientOptions extends CommonClientOptions {
* The authentication scope will be set from this audience.
* Defaults to 'https://api.loganalytics.io/.default'
*/
audience?: string;
_audience?: string;
}

/**
* Client for Azure Log Analytics
*/
export class LogsQueryClient {
private _logAnalytics: AzureLogAnalytics;
private _audience?: string;

/**
* Construct a LogsClient that can be used to query logs using the Log Analytics Query language.
Expand All @@ -61,8 +62,9 @@ export class LogsQueryClient {
constructor(tokenCredential: TokenCredential, options?: LogsQueryClientOptions) {
// This client defaults to using 'https://api.loganalytics.io/' as the
// host.
this._audience = `${options?.endpoint}./default`;
const credentialOptions = {
credentialScopes: options?.audience
credentialScopes: this._audience
};
const packageDetails = `azsdk-js-monitor-query/${SDK_VERSION}`;
const userAgentPrefix =
Expand Down
10 changes: 3 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 @@ -56,15 +50,17 @@ export class MetricsQueryClient {
private _metricsClient: GeneratedMetricsClient;
private _definitionsClient: GeneratedMetricsDefinitionsClient;
private _namespacesClient: GeneratedMetricsNamespacesClient;
private _audience?: string;

/**
* Creates a MetricsQueryClient.
* @param tokenCredential - A TokenCredential that has rights to query metrics on resources.
* @param options - Options for the client like controlling request retries.
*/
constructor(tokenCredential: TokenCredential, options?: MetricsQueryClientOptions) {
this._audience = `${options?.endpoint}/.default`;
const credentialOptions = {
credentialScopes: options?.audience
credentialScopes: this._audience
};
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
});
});