Skip to content

Commit

Permalink
Merge branch 'master' into 20181109release
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoningLiu authored Jul 26, 2019
2 parents be33ebe + ad35404 commit 643527a
Show file tree
Hide file tree
Showing 36 changed files with 190 additions and 301 deletions.
16 changes: 11 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@
###########

# Catch all
# /sdk/ @ramya-rao-a
/sdk/ @ramya-rao-a

# Core
# /sdk/core/
/sdk/core/abort-controller/ @daviwil
/sdk/core/core-amqp/ @ramya-rao-a
/sdk/core/core-auth/ @daviwil
/sdk/core/core-http/ @daviwil
/sdk/core/core-paging/ @daviwil

# Service teams
# /sdk/eventhub/
# /sdk/identity/
# /sdk/keyvault/
/sdk/eventhub/ @chradek @shivangireja
/sdk/servicebus/ @ramya-rao-a @shivangireja

/sdk/identity/ @daviwil
/sdk/keyvault/ @jonathandturner @sadasant
/sdk/storage/ @XiaoningLiu @jeremymeng @HarshaNalluru @vinjiang @jiacfan

# Management Plane
Expand Down
64 changes: 7 additions & 57 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions eng/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": false
}
2 changes: 1 addition & 1 deletion eng/pipelines/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
npm install yargs
displayName: "Install yargs"
- powershell: |
- pwsh: |
cd $(Build.SourcesDirectory)
node .\common\scripts\generate-doc.js --dgOp "dg" $(additionalArgs)
Copy-Item -Path $(Build.SourcesDirectory)/docGen/* -Destination $(Build.ArtifactStagingDirectory) -Recurse -Force
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/templates/steps/common.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
steps:
- powershell: |
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/Azure/azure-sdk-tools/verify-agent-os_1.1.0/scripts/python/verify_agent_os.py" -OutFile "verify_agent_os.py" | Wait-Process
- pwsh: |
Invoke-WebRequest -MaximumRetryCount 10 -Uri "https://raw.githubusercontent.com/Azure/azure-sdk-tools/verify-agent-os_1.1.0/scripts/python/verify_agent_os.py" -OutFile "verify_agent_os.py" | Wait-Process
workingDirectory: "$(Build.BinariesDirectory)"
displayName: "Download verify_agent_os.py"
Expand Down
7 changes: 3 additions & 4 deletions sdk/core/core-arm/lib/azureServiceClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

import { HttpOperationResponse, OperationArguments, OperationSpec, RequestOptionsBase, RequestPrepareOptions, ServiceClient, ServiceClientCredentials, ServiceClientOptions, TokenCredential, WebResource, getDefaultUserAgentValue as getDefaultUserAgentValueFromMsRest } from "@azure/core-http";
import { HttpOperationResponse, OperationArguments, OperationSpec, RequestOptionsBase, RequestPrepareOptions, ServiceClient, ServiceClientOptions, TokenCredential, WebResource, getDefaultUserAgentValue as getDefaultUserAgentValueFromMsRest } from "@azure/core-http";
import { createLROPollerFromInitialResponse, createLROPollerFromPollState, LROPoller } from "./lroPoller";
import { LROPollState } from "./lroPollStrategy";
import * as Constants from "./util/constants";
Expand All @@ -27,8 +27,7 @@ export interface AzureServiceClientOptions extends ServiceClientOptions {
* Initializes a new instance of the AzureServiceClient class.
* @constructor
*
* @param {ServiceClientCredentials | TokenCredential} credentials - ApplicationTokenCredentials,
* UserTokenCredentials, or TokenCredential object used for authentication.
* @param {TokenCredential} credentials - The TokenCredential used for authentication.
* @param {AzureServiceClientOptions} options - The parameter options used by AzureServiceClient
*/
export class AzureServiceClient extends ServiceClient {
Expand All @@ -38,7 +37,7 @@ export class AzureServiceClient extends ServiceClient {
*/
public longRunningOperationRetryTimeout?: number;

constructor(credentials: ServiceClientCredentials | TokenCredential, options?: AzureServiceClientOptions) {
constructor(credentials: TokenCredential, options?: AzureServiceClientOptions) {
super(credentials, options = updateOptionsWithDefaultValues(options));

// For convenience, if the credentials have an associated AzureEnvironment,
Expand Down
12 changes: 6 additions & 6 deletions sdk/core/core-arm/samples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

<head>
<title>My Todos</title>
<script type="text/javascript" src="../node_modules/ms-rest-ts/msRestBundle.js"></script>
<script type="text/javascript" src="../msRestAzureBundle.js"></script>
<script type="text/javascript" src="../node_modules/@azure/core-http/dist/coreHttp.browser.js"></script>
<script type="text/javascript" src="../dist/coreArm.js"></script>

<script type="text/javascript">
document.write("hello world");
const subscriptionId = "subscriptionId";
const token = "token";
const creds = new msRest.TokenCredentials(token);
const client = new msRestAzure.AzureServiceClient(creds);
const creds = new Azure.Core.HTTP.RawTokenCredential(token);
const client = new Azure.Core.ARM.AzureServiceClient(creds);
const req = {
url: `https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.Storage/storageAccounts?api-version=2015-06-15`,
method: "GET"
Expand All @@ -23,4 +23,4 @@
<body>
</body>

</html>
</html>
2 changes: 1 addition & 1 deletion sdk/core/core-arm/samples/node-sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const apiVersion = "2017-06-01";
// 1.5 in the curl tab you will see the actual curl request that has the bearer token in it
// 1.6 copy paste that token here. That token is valid for 1 hour
const token = "token";
const creds = new coreHttp.TokenCredentials(token);
const creds = new coreHttp.RawTokenCredential(token);
const client = new coreArm.AzureServiceClient(creds, clientOptions);
const req: coreHttp.RequestPrepareOptions = {
url: `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Storage/storageAccounts/${accountName}?api-version=${apiVersion}`,
Expand Down
17 changes: 8 additions & 9 deletions sdk/core/core-arm/test/azureServiceClientTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

import assert from "assert";
import { HttpHeaders, HttpOperationResponse, RequestOptionsBase, RestError, TokenCredentials, WebResource, OperationArguments, OperationSpec, Serializer } from "@azure/core-http";
import { HttpHeaders, HttpOperationResponse, RequestOptionsBase, RestError, SimpleTokenCredential, WebResource, OperationArguments, OperationSpec, Serializer } from "@azure/core-http";
import { AzureServiceClient, AzureServiceClientOptions, updateOptionsWithDefaultValues } from "../lib/azureServiceClient";
import * as msAssert from "./msAssert";
import { LROPoller } from "../lib/lroPoller";
Expand All @@ -11,28 +11,27 @@ import { CloudErrorMapper } from "../lib/cloudError";
describe("AzureServiceClient", () => {
describe("constructor", () => {
it("with no options provided", () => {
const client = new AzureServiceClient(new TokenCredentials("my-fake-token"));
const client = new AzureServiceClient(new SimpleTokenCredential("my-fake-token"));
assert.strictEqual(client.acceptLanguage, "en-us");
assert.strictEqual(client.longRunningOperationRetryTimeout, undefined);
});

it("with acceptLanguage provided", () => {
const client = new AzureServiceClient(new TokenCredentials("my-fake-token"), { acceptLanguage: "my-fake-language" });
const client = new AzureServiceClient(new SimpleTokenCredential("my-fake-token"), { acceptLanguage: "my-fake-language" });
assert.strictEqual(client.acceptLanguage, "my-fake-language");
assert.strictEqual(client.longRunningOperationRetryTimeout, undefined);
});

it("with longRunningOperationRetryTimeout provided", () => {
const client = new AzureServiceClient(new TokenCredentials("my-fake-token"), { longRunningOperationRetryTimeout: 2 });
const client = new AzureServiceClient(new SimpleTokenCredential("my-fake-token"), { longRunningOperationRetryTimeout: 2 });
assert.strictEqual(client.acceptLanguage, "en-us");
assert.strictEqual(client.longRunningOperationRetryTimeout, 2);
});

it("should apply the resourceManagerEndpointUrl from credentials", async function() {
const creds = {
signRequest: (request: WebResource) => Promise.resolve(request),
environment: { resourceManagerEndpointUrl: "foo" }
};
const creds = new SimpleTokenCredential("my-fake-token");
(creds as any).environment = { resourceManagerEndpointUrl: "foo" };

const client = new AzureServiceClient(creds);
// accessing protected property by casting
assert.strictEqual((client as any).baseUri, "foo");
Expand Down Expand Up @@ -2586,7 +2585,7 @@ function createServiceClient(responses: HttpResponse[]): AzureServiceClient {
}

function createServiceClientWithOptions(options: AzureServiceClientOptions, responses: HttpResponse[]): AzureServiceClient {
return new AzureServiceClient(new TokenCredentials("my-fake-token"), Object.assign({
return new AzureServiceClient(new SimpleTokenCredential("my-fake-token"), Object.assign({
httpClient: {
sendRequest(httpRequest: WebResource): Promise<HttpOperationResponse> {
const response: HttpResponse | undefined = responses.shift();
Expand Down
12 changes: 6 additions & 6 deletions sdk/core/core-arm/test/lroPollStrategyTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

import assert from "assert";
import { HttpHeaders, HttpOperationResponse, TokenCredentials, WebResource } from "@azure/core-http";
import { HttpHeaders, HttpOperationResponse, SimpleTokenCredential, WebResource } from "@azure/core-http";
import { AzureServiceClient } from "../lib/azureServiceClient";
import { getDelayInSeconds, isFinished } from "../lib/lroPollStrategy";

describe("LROPollStrategy", function () {
describe("getDelayInMilliseconds()", function () {
it("with no AzureServiceClient.longRunningOperationRetryTimeout value and no retry-after header", function () {
const azureServiceClient = new AzureServiceClient(new TokenCredentials("my-fake-token"));
const azureServiceClient = new AzureServiceClient(new SimpleTokenCredential("my-fake-token"));
const previousResponse: HttpOperationResponse = {
request: new WebResource(),
status: 200,
Expand All @@ -19,7 +19,7 @@ describe("LROPollStrategy", function () {
});

it("with 11 AzureServiceClient.longRunningOperationRetryTimeout and no retry-after header", function () {
const azureServiceClient = new AzureServiceClient(new TokenCredentials("my-fake-token"), { longRunningOperationRetryTimeout: 11 });
const azureServiceClient = new AzureServiceClient(new SimpleTokenCredential("my-fake-token"), { longRunningOperationRetryTimeout: 11 });
const previousResponse: HttpOperationResponse = {
request: new WebResource(),
status: 200,
Expand All @@ -29,7 +29,7 @@ describe("LROPollStrategy", function () {
});

it("with no AzureServiceClient.longRunningOperationRetryTimeout value and 12 retry-after header", function () {
const azureServiceClient = new AzureServiceClient(new TokenCredentials("my-fake-token"));
const azureServiceClient = new AzureServiceClient(new SimpleTokenCredential("my-fake-token"));
const previousResponse: HttpOperationResponse = {
request: new WebResource(),
status: 200,
Expand All @@ -39,7 +39,7 @@ describe("LROPollStrategy", function () {
});

it("with no AzureServiceClient.longRunningOperationRetryTimeout value and spam retry-after header", function () {
const azureServiceClient = new AzureServiceClient(new TokenCredentials("my-fake-token"));
const azureServiceClient = new AzureServiceClient(new SimpleTokenCredential("my-fake-token"));
const previousResponse: HttpOperationResponse = {
request: new WebResource(),
status: 200,
Expand All @@ -49,7 +49,7 @@ describe("LROPollStrategy", function () {
});

it("with 11 AzureServiceClient.longRunningOperationRetryTimeout and 12 retry-after header", function () {
const azureServiceClient = new AzureServiceClient(new TokenCredentials("my-fake-token"), { longRunningOperationRetryTimeout: 11 });
const azureServiceClient = new AzureServiceClient(new SimpleTokenCredential("my-fake-token"), { longRunningOperationRetryTimeout: 11 });
const previousResponse: HttpOperationResponse = {
request: new WebResource(),
status: 200,
Expand Down
8 changes: 8 additions & 0 deletions sdk/core/core-auth/review/core-auth.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ export interface GetTokenOptions {
// @public
export function isTokenCredential(credential: any): credential is TokenCredential;

// @public
export class SimpleTokenCredential implements TokenCredential {
constructor(token: string, expiresOn?: Date);
expiresOn: Date;
getToken(_scopes: string | string[], _options?: GetTokenOptions): Promise<AccessToken | null>;
token: string;
}

// @public
export interface TokenCredential {
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
Expand Down
1 change: 1 addition & 0 deletions sdk/core/core-auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export {
isTokenCredential
} from "./tokenCredential";

export { SimpleTokenCredential } from "./simpleTokenCredential";
export { AbortSignalLike } from '@azure/abort-controller';
Loading

0 comments on commit 643527a

Please sign in to comment.