Skip to content

Commit

Permalink
CodeGen from PR 22122 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 65fa4ae8230d3cfd9789f09f99de79762dda0026 into d60e51137381d590fd5dbe76f7baacf7402eb653
  • Loading branch information
SDKAuto committed Jan 11, 2023
1 parent 95572c3 commit e5de82d
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 157 deletions.
20 changes: 2 additions & 18 deletions sdk/loadtestservice/arm-loadtesting/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
# Release History

## 1.0.0-beta.3 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

## 1.0.0-beta.2 (2023-01-06)

**Features**

-bugs Fixed

## 1.0.0-beta.1 (2022-11-24)

## 1.0.0 (2023-01-11)

The package of @azure/arm-loadtesting is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart).
2 changes: 1 addition & 1 deletion sdk/loadtestservice/arm-loadtesting/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 Microsoft
Copyright (c) 2023 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
107 changes: 2 additions & 105 deletions sdk/loadtestservice/arm-loadtesting/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Azure Load Testing client library for JavaScript
# Azure LoadTest client library for JavaScript

This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure LoadTest client.

LoadTest client provides access to LoadTest Resource and it's status operations.

[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtestservice/arm-loadtesting) |
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-loadtesting) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-loadtesting?view=azure-node-preview) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-loadtesting) |
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)

## Getting started
Expand Down Expand Up @@ -64,109 +64,6 @@ const client = new LoadTestClient(new DefaultAzureCredential(), subscriptionId);
// const client = new LoadTestClient(credential, subscriptionId);
```

### Create an Azure Load Testing resource

Create a new Azure Load Testing resource.
```javascript
loadTestResourceCreatePayload = {
location: "westus2"
};

const resource = await client.loadTests.beginCreateOrUpdateAndWait(
"sample-rg",
"sample-loadtesting-resource",
loadTestResourceCreatePayload
);

console.log(resource);
```

Create a new Azure Load Testing resource with managed identity and customer managed key encryption.
```javascript
loadTestResourceCreatePayload = {
location: "westus2",
tags: { team: "testing" },
identity: {
type: 'SystemAssigned, UserAssigned',
userAssignedIdentities: {
'/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1': {}
}
},
encryption: {
identity: {
type: 'UserAssigned',
resourceId: '/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1'
},
keyUrl: 'https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde'
}
};

const resource = await client.loadTests.beginCreateOrUpdateAndWait(
"sample-rg",
"sample-loadtesting-resource",
loadTestResourceCreatePayload
);

console.log(resource);
```

### Get an Azure Load Testing resource

```javascript
let resourceName = 'sample-loadtesting-resource';
let resourceGroupName = 'sample-rg';

const resource = await client.loadTests.get(
resourceGroupName,
resourceName
);

console.log(resource);
```

### Update an Azure Load Testing resource

```javascript
loadTestResourcePatchPayload = {
tags: { team: "testing-dev" },
identity: {
type: 'SystemAssigned, UserAssigned',
userAssignedIdentities: {
// removing a user-assigned managed identity by assigning the value in the payload as null
'/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1': null,
'/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity2': {}
}
},
encryption: {
// use system-assigned managed identity for CMK encryption
identity: {
type: 'SystemAssigned',
resourceId: null
},
keyUrl: 'https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde'
}
};

const resource = await client.loadTests.beginUpdateAndWait(
"sample-rg",
"sample-loadtesting-resource",
loadTestResourcePatchPayload
);

console.log(resource);
```

### Delete an Azure Load Testing resource

```javascript
let resourceName = 'sample-loadtesting-resource';
let resourceGroupName = 'sample-rg';

const result = await client.loadTests.beginDeleteAndWait(
resourceGroupName,
resourceName
);
```

### JavaScript Bundle
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
Expand Down
8 changes: 4 additions & 4 deletions sdk/loadtestservice/arm-loadtesting/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "7a54c1a83d14da431c0ae48c4315cba143084bce",
"commit": "f5cc64dff0ec000ad19a8db598fa737c65209129",
"readme": "specification/loadtestservice/resource-manager/readme.md",
"autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\loadtestservice\\resource-manager\\readme.md --use=@autorest/[email protected].3.20221108.1 --generate-sample=true",
"autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/loadtestservice/resource-manager/readme.md --use=@autorest/[email protected].5",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.4.2",
"use": "@autorest/[email protected].3.20221108.1"
"release_tool": "@azure-tools/js-sdk-release-tools@2.6.0",
"use": "@autorest/[email protected].5"
}
14 changes: 3 additions & 11 deletions sdk/loadtestservice/arm-loadtesting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for LoadTestClient.",
"version": "1.0.0-beta.3",
"version": "1.0.0",
"engines": {
"node": ">=14.0.0"
},
Expand Down Expand Up @@ -110,13 +110,5 @@
}
]
},
"autoPublish": true,
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-loadtesting?view=azure-node-preview"
}
}
"autoPublish": true
}
2 changes: 1 addition & 1 deletion sdk/loadtestservice/arm-loadtesting/src/loadTestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class LoadTestClient extends coreClient.ServiceClient {
credential: credentials
};

const packageDetails = `azsdk-js-arm-loadtesting/1.0.0-beta.3`;
const packageDetails = `azsdk-js-arm-loadtesting/1.0.0`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Expand All @@ -853,7 +852,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Expand All @@ -874,7 +872,6 @@ const listOutboundNetworkDependenciesEndpointsNextOperationSpec: coreClient.Oper
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Expand Down
8 changes: 4 additions & 4 deletions sdk/loadtestservice/arm-loadtesting/src/pagingHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export interface PageInfo {
const pageMap = new WeakMap<object, PageInfo>();

/**
* Given a result page from a pageable operation, returns a
* continuation token that can be used to begin paging from
* Given the last `.value` produced by the `byPage` iterator,
* returns a continuation token that can be used to begin paging from
* that point later.
* @param page A result object from calling .byPage() on a paged operation.
* @returns The continuation token that can be passed into byPage().
* @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
* @returns The continuation token that can be passed into byPage() during future calls.
*/
export function getContinuationToken(page: unknown): string | undefined {
if (typeof page !== "object" || page === null) {
Expand Down
43 changes: 43 additions & 0 deletions sdk/loadtestservice/arm-loadtesting/test/sampleTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/

import {
Recorder,
RecorderStartOptions,
env
} from "@azure-tools/test-recorder";
import { assert } from "chai";
import { Context } from "mocha";

const replaceableVariables: Record<string, string> = {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
SUBSCRIPTION_ID: "azure_subscription_id"
};

const recorderOptions: RecorderStartOptions = {
envSetupForPlayback: replaceableVariables
};

describe("My test", () => {
let recorder: Recorder;

beforeEach(async function(this: Context) {
recorder = new Recorder(this.currentTest);
await recorder.start(recorderOptions);
});

afterEach(async function() {
await recorder.stop();
});

it("sample test", async function() {
console.log("Hi, I'm a test!");
});
});
10 changes: 2 additions & 8 deletions sdk/loadtestservice/arm-loadtesting/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@
],
"declaration": true,
"outDir": "./dist-esm",
"importHelpers": true,
"paths": {
"@azure/arm-loadtesting": [
"./src/index"
]
}
"importHelpers": true
},
"include": [
"./src/**/*.ts",
"./test/**/*.ts",
"samples-dev/**/*.ts"
"./test/**/*.ts"
],
"exclude": [
"node_modules"
Expand Down

0 comments on commit e5de82d

Please sign in to comment.