diff --git a/sdk/loadtestservice/arm-loadtestservice/LICENSE.txt b/sdk/loadtestservice/arm-loadtestservice/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/loadtestservice/arm-loadtestservice/README.md b/sdk/loadtestservice/arm-loadtestservice/README.md new file mode 100644 index 000000000000..de79889d69b2 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/README.md @@ -0,0 +1,106 @@ +## Azure LoadTestClient SDK for JavaScript + +This package contains an isomorphic SDK (runs both in node.js and in browsers) for LoadTestClient. + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +You must have an [Azure subscription](https://azure.microsoft.com/free/). + +### How to install + +To use this SDK in your project, you will need to install two packages. +- `@azure/arm-loadtestservice` that contains the client. +- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory. + +Install both packages using the below command: +```bash +npm install --save @azure/arm-loadtestservice @azure/identity +``` +> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features. +If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options. + +### How to use + +- If you are writing a client side browser application, + - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions. + - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below. +- If you are writing a server side application, + - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples) + - Complete the set up steps required by the credential if any. + - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below. + +In the below samples, we pass the credential and the Azure subscription id to instantiate the client. +Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started. +#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript. + +##### Sample code + +```javascript +const { DefaultAzureCredential } = require("@azure/identity"); +const { LoadTestClient } = require("@azure/arm-loadtestservice"); +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples +// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead. +const creds = new DefaultAzureCredential(); +const client = new LoadTestClient(creds, subscriptionId); +client.operations.list().then((result) => { + console.log("The result is:"); + console.log(result); +}).catch((err) => { + console.log("An error occurred:"); + console.error(err); +}); +``` + +#### browser - Authentication, client creation, and list operations as an example written in JavaScript. + +In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser. + - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser. + - Note down the client Id from the previous step and use it in the browser sample below. + +##### Sample code + +- index.html + +```html + + + + @azure/arm-loadtestservice sample + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/loadtestservice/arm-loadtestservice/README.png) diff --git a/sdk/loadtestservice/arm-loadtestservice/package.json b/sdk/loadtestservice/arm-loadtestservice/package.json new file mode 100644 index 000000000000..7c05cd62bbc8 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/package.json @@ -0,0 +1,59 @@ +{ + "name": "@azure/arm-loadtestservice", + "author": "Microsoft Corporation", + "description": "LoadTestClient Library with typescript type definitions for node.js and browser.", + "version": "1.0.0", + "dependencies": { + "@azure/ms-rest-azure-js": "^2.1.0", + "@azure/ms-rest-js": "^2.2.0", + "@azure/core-auth": "^1.1.4", + "tslib": "^1.10.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/arm-loadtestservice.js", + "module": "./esm/loadTestClient.js", + "types": "./esm/loadTestClient.d.ts", + "devDependencies": { + "typescript": "^3.6.0", + "rollup": "^1.18.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.6.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/loadtestservice/arm-loadtestservice", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-loadtestservice.js.map'\" -o ./dist/arm-loadtestservice.min.js ./dist/arm-loadtestservice.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/loadtestservice/arm-loadtestservice/rollup.config.js b/sdk/loadtestservice/arm-loadtestservice/rollup.config.js new file mode 100644 index 000000000000..2f308ddaf468 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/rollup.config.js @@ -0,0 +1,37 @@ +import rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/loadTestClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-loadtestservice.js", + format: "umd", + name: "Azure.ArmLoadtestservice", + sourcemap: true, + globals: { + "@azure/ms-rest-js": "msRest", + "@azure/ms-rest-azure-js": "msRestAzure" + }, + banner: `/* + * 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. + */` + }, + plugins: [ + nodeResolve({ mainFields: ['module', 'main'] }), + sourcemaps() + ] +}; + +export default config; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/loadTestClient.ts b/sdk/loadtestservice/arm-loadtestservice/src/loadTestClient.ts new file mode 100644 index 000000000000..77d4c52a3ddf --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/loadTestClient.ts @@ -0,0 +1,49 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; +import { TokenCredential } from "@azure/core-auth"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as operations from "./operations"; +import { LoadTestClientContext } from "./loadTestClientContext"; + + +class LoadTestClient extends LoadTestClientContext { + // Operation groups + operations: operations.Operations; + loadTests: operations.LoadTests; + + /** + * Initializes a new instance of the LoadTestClient class. + * @param credentials Credentials needed for the client to connect to Azure. Credentials + * implementing the TokenCredential interface from the @azure/identity package are recommended. For + * more information about these credentials, see + * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the + * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and + * @azure/ms-rest-browserauth are also supported. + * @param subscriptionId The ID of the target subscription. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.LoadTestClientOptions) { + super(credentials, subscriptionId, options); + this.operations = new operations.Operations(this); + this.loadTests = new operations.LoadTests(this); + } +} + +// Operation Specifications + +export { + LoadTestClient, + LoadTestClientContext, + Models as LoadTestModels, + Mappers as LoadTestMappers +}; +export * from "./operations"; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/loadTestClientContext.ts b/sdk/loadtestservice/arm-loadtestservice/src/loadTestClientContext.ts new file mode 100644 index 000000000000..e54607bce19a --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/loadTestClientContext.ts @@ -0,0 +1,67 @@ +/* + * 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 * as Models from "./models"; +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import { TokenCredential } from "@azure/core-auth"; + +const packageName = "@azure/arm-loadtestservice"; +const packageVersion = "1.0.0"; + +export class LoadTestClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials | TokenCredential; + apiVersion?: string; + subscriptionId: string; + + /** + * Initializes a new instance of the LoadTestClient class. + * @param credentials Credentials needed for the client to connect to Azure. Credentials + * implementing the TokenCredential interface from the @azure/identity package are recommended. For + * more information about these credentials, see + * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the + * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and + * @azure/ms-rest-browserauth are also supported. + * @param subscriptionId The ID of the target subscription. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.LoadTestClientOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId == undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if (!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.apiVersion = '2021-12-01-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; + this.requestContentType = "application/json; charset=utf-8"; + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + } +} diff --git a/sdk/loadtestservice/arm-loadtestservice/src/models/index.ts b/sdk/loadtestservice/arm-loadtestservice/src/models/index.ts new file mode 100644 index 000000000000..f9530db258a1 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/models/index.ts @@ -0,0 +1,562 @@ +/* + * 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 { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export { BaseResource, CloudError }; + +/** + * Managed service identity (either system assigned, or none) + */ +export interface SystemAssignedServiceIdentity { + /** + * The service principal ID of the system assigned identity. This property will only be provided + * for a system assigned identity. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly principalId?: string; + /** + * The tenant ID of the system assigned identity. This property will only be provided for a + * system assigned identity. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly tenantId?: string; + /** + * Possible values include: 'None', 'SystemAssigned' + */ + type: SystemAssignedServiceIdentityType; +} + +/** + * Common fields that are returned in the response for all Azure Resource Manager resources + * @summary Resource + */ +export interface Resource extends BaseResource { + /** + * Fully qualified resource ID for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * The name of the resource + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + * "Microsoft.Storage/storageAccounts" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly systemData?: SystemData; +} + +/** + * The resource model definition for an Azure Resource Manager tracked top level resource which has + * 'tags' and a 'location' + * @summary Tracked Resource + */ +export interface TrackedResource extends Resource { + /** + * Resource tags. + */ + tags?: { [propertyName: string]: string }; + /** + * The geo-location where the resource lives + */ + location: string; +} + +/** + * LoadTest details + */ +export interface LoadTestResource extends TrackedResource { + /** + * Description of the resource. + */ + description?: string; + /** + * Resource provisioning state. Possible values include: 'Succeeded', 'Failed', 'Canceled', + * 'Deleted' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly provisioningState?: ResourceState; + /** + * Resource data plane URI. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly dataPlaneURI?: string; + /** + * The type of identity used for the resource. + */ + identity?: SystemAssignedServiceIdentity; +} + +/** + * Load Test resource properties + */ +export interface LoadTestResourcePatchRequestBodyProperties { + /** + * Description of the resource. + */ + description?: string; +} + +/** + * LoadTest resource patch request body. + */ +export interface LoadTestResourcePatchRequestBody { + /** + * Resource tags. + */ + tags?: any; + /** + * The type of identity used for the resource. + */ + identity?: SystemAssignedServiceIdentity; + /** + * Load Test resource properties + */ + properties?: LoadTestResourcePatchRequestBodyProperties; +} + +/** + * Metadata pertaining to creation and last modification of the resource. + */ +export interface SystemData { + /** + * The identity that created the resource. + */ + createdBy?: string; + /** + * The type of identity that created the resource. Possible values include: 'User', + * 'Application', 'ManagedIdentity', 'Key' + */ + createdByType?: CreatedByType; + /** + * The timestamp of resource creation (UTC). + */ + createdAt?: Date; + /** + * The identity that last modified the resource. + */ + lastModifiedBy?: string; + /** + * The type of identity that last modified the resource. Possible values include: 'User', + * 'Application', 'ManagedIdentity', 'Key' + */ + lastModifiedByType?: CreatedByType; + /** + * The timestamp of resource last modification (UTC) + */ + lastModifiedAt?: Date; +} + +/** + * The resource model definition for a Azure Resource Manager proxy resource. It will not have tags + * and a location + * @summary Proxy Resource + */ +export interface ProxyResource extends Resource { +} + +/** + * The resource model definition for an Azure Resource Manager resource with an etag. + * @summary Entity Resource + */ +export interface AzureEntityResource extends Resource { + /** + * Resource Etag. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly etag?: string; +} + +/** + * The resource management error additional info. + */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; + /** + * The additional info. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly info?: any; +} + +/** + * The error detail. + */ +export interface ErrorDetail { + /** + * The error code. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly code?: string; + /** + * The error message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * The error target. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly target?: string; + /** + * The error details. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** + * Common error response for all Azure Resource Manager APIs to return error details for failed + * operations. (This also follows the OData error response format.). + * @summary Error response + */ +export interface ErrorResponse { + /** + * The error object. + */ + error?: ErrorDetail; +} + +/** + * Localized display information for this particular operation. + */ +export interface OperationDisplay { + /** + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly provider?: string; + /** + * The localized friendly name of the resource type related to this operation. E.g. "Virtual + * Machines" or "Job Schedule Collections". + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly resource?: string; + /** + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create + * or Update Virtual Machine", "Restart Virtual Machine". + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly operation?: string; + /** + * The short, localized friendly description of the operation; suitable for tool tips and + * detailed views. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly description?: string; +} + +/** + * Details of a REST API operation, returned from the Resource Provider Operations API + * @summary REST API Operation + */ +export interface Operation { + /** + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * Whether the operation applies to data-plane. This is "true" for data-plane operations and + * "false" for ARM/control-plane operations. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly isDataAction?: boolean; + /** + * Localized display information for this particular operation. + */ + display?: OperationDisplay; + /** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + * logs UX. Default value is "user,system". Possible values include: 'user', 'system', + * 'user,system' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly origin?: Origin; + /** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * Possible values include: 'Internal' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly actionType?: ActionType; +} + +/** + * An interface representing LoadTestClientOptions. + */ +export interface LoadTestClientOptions extends AzureServiceClientOptions { + baseUri?: string; +} + +/** + * @interface + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + * to get the next set of results. + * @extends Array + */ +export interface OperationListResult extends Array { + /** + * URL to get the next set of operation list results (if there are any). + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly nextLink?: string; +} + +/** + * @interface + * List of resources page result. + * @extends Array + */ +export interface LoadTestResourcePageList extends Array { + /** + * Link to next page of resources. + */ + nextLink?: string; +} + +/** + * Defines values for ResourceState. + * Possible values include: 'Succeeded', 'Failed', 'Canceled', 'Deleted' + * @readonly + * @enum {string} + */ +export type ResourceState = 'Succeeded' | 'Failed' | 'Canceled' | 'Deleted'; + +/** + * Defines values for SystemAssignedServiceIdentityType. + * Possible values include: 'None', 'SystemAssigned' + * @readonly + * @enum {string} + */ +export type SystemAssignedServiceIdentityType = 'None' | 'SystemAssigned'; + +/** + * Defines values for CreatedByType. + * Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + * @readonly + * @enum {string} + */ +export type CreatedByType = 'User' | 'Application' | 'ManagedIdentity' | 'Key'; + +/** + * Defines values for Origin. + * Possible values include: 'user', 'system', 'user,system' + * @readonly + * @enum {string} + */ +export type Origin = 'user' | 'system' | 'user,system'; + +/** + * Defines values for ActionType. + * Possible values include: 'Internal' + * @readonly + * @enum {string} + */ +export type ActionType = 'Internal'; + +/** + * Contains response data for the list operation. + */ +export type OperationsListResponse = OperationListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OperationsListNextResponse = OperationListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationListResult; + }; +}; + +/** + * Contains response data for the listBySubscription operation. + */ +export type LoadTestsListBySubscriptionResponse = LoadTestResourcePageList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: LoadTestResourcePageList; + }; +}; + +/** + * Contains response data for the listByResourceGroup operation. + */ +export type LoadTestsListByResourceGroupResponse = LoadTestResourcePageList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: LoadTestResourcePageList; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type LoadTestsGetResponse = LoadTestResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: LoadTestResource; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type LoadTestsCreateOrUpdateResponse = LoadTestResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: LoadTestResource; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type LoadTestsUpdateResponse = LoadTestResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: LoadTestResource; + }; +}; + +/** + * Contains response data for the listBySubscriptionNext operation. + */ +export type LoadTestsListBySubscriptionNextResponse = LoadTestResourcePageList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: LoadTestResourcePageList; + }; +}; + +/** + * Contains response data for the listByResourceGroupNext operation. + */ +export type LoadTestsListByResourceGroupNextResponse = LoadTestResourcePageList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: LoadTestResourcePageList; + }; +}; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/models/loadTestsMappers.ts b/sdk/loadtestservice/arm-loadtestservice/src/models/loadTestsMappers.ts new file mode 100644 index 000000000000..eecfde59951f --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/models/loadTestsMappers.ts @@ -0,0 +1,24 @@ +/* + * 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. + */ + +export { + AzureEntityResource, + BaseResource, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + LoadTestResource, + LoadTestResourcePageList, + LoadTestResourcePatchRequestBody, + LoadTestResourcePatchRequestBodyProperties, + ProxyResource, + Resource, + SystemAssignedServiceIdentity, + SystemData, + TrackedResource +} from "../models/mappers"; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/models/mappers.ts b/sdk/loadtestservice/arm-loadtestservice/src/models/mappers.ts new file mode 100644 index 000000000000..da8ce4ae305c --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/models/mappers.ts @@ -0,0 +1,519 @@ +/* + * 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 { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export const CloudError = CloudErrorMapper; +export const BaseResource = BaseResourceMapper; + +export const SystemAssignedServiceIdentity: msRest.CompositeMapper = { + serializedName: "SystemAssignedServiceIdentity", + type: { + name: "Composite", + className: "SystemAssignedServiceIdentity", + modelProperties: { + principalId: { + readOnly: true, + serializedName: "principalId", + type: { + name: "Uuid" + } + }, + tenantId: { + readOnly: true, + serializedName: "tenantId", + type: { + name: "Uuid" + } + }, + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const Resource: msRest.CompositeMapper = { + serializedName: "Resource", + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + systemData: { + readOnly: true, + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const TrackedResource: msRest.CompositeMapper = { + serializedName: "TrackedResource", + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + location: { + required: true, + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const LoadTestResource: msRest.CompositeMapper = { + serializedName: "LoadTestResource", + type: { + name: "Composite", + className: "LoadTestResource", + modelProperties: { + ...TrackedResource.type.modelProperties, + description: { + serializedName: "properties.description", + constraints: { + MaxLength: 512 + }, + type: { + name: "String" + } + }, + provisioningState: { + readOnly: true, + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + dataPlaneURI: { + readOnly: true, + serializedName: "properties.dataPlaneURI", + constraints: { + MaxLength: 2083 + }, + type: { + name: "String" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "SystemAssignedServiceIdentity" + } + } + } + } +}; + +export const LoadTestResourcePatchRequestBodyProperties: msRest.CompositeMapper = { + serializedName: "LoadTestResourcePatchRequestBody_properties", + type: { + name: "Composite", + className: "LoadTestResourcePatchRequestBodyProperties", + modelProperties: { + description: { + serializedName: "description", + constraints: { + MaxLength: 512 + }, + type: { + name: "String" + } + } + } + } +}; + +export const LoadTestResourcePatchRequestBody: msRest.CompositeMapper = { + serializedName: "LoadTestResourcePatchRequestBody", + type: { + name: "Composite", + className: "LoadTestResourcePatchRequestBody", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Object" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "SystemAssignedServiceIdentity" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "LoadTestResourcePatchRequestBodyProperties" + } + } + } + } +}; + +export const SystemData: msRest.CompositeMapper = { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ProxyResource: msRest.CompositeMapper = { + serializedName: "ProxyResource", + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const AzureEntityResource: msRest.CompositeMapper = { + serializedName: "AzureEntityResource", + type: { + name: "Composite", + className: "AzureEntityResource", + modelProperties: { + ...Resource.type.modelProperties, + etag: { + readOnly: true, + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorAdditionalInfo: msRest.CompositeMapper = { + serializedName: "ErrorAdditionalInfo", + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + info: { + readOnly: true, + serializedName: "info", + type: { + name: "Object" + } + } + } + } +}; + +export const ErrorDetail: msRest.CompositeMapper = { + serializedName: "ErrorDetail", + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + readOnly: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + }, + target: { + readOnly: true, + serializedName: "target", + type: { + name: "String" + } + }, + details: { + readOnly: true, + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + readOnly: true, + serializedName: "additionalInfo", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const OperationDisplay: msRest.CompositeMapper = { + serializedName: "Operation_display", + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + readOnly: true, + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + readOnly: true, + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + readOnly: true, + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + readOnly: true, + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const Operation: msRest.CompositeMapper = { + serializedName: "Operation", + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + readOnly: true, + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + readOnly: true, + serializedName: "origin", + type: { + name: "String" + } + }, + actionType: { + readOnly: true, + serializedName: "actionType", + type: { + name: "String" + } + } + } + } +}; + +export const OperationListResult: msRest.CompositeMapper = { + serializedName: "OperationListResult", + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + readOnly: true, + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + readOnly: true, + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const LoadTestResourcePageList: msRest.CompositeMapper = { + serializedName: "LoadTestResourcePageList", + type: { + name: "Composite", + className: "LoadTestResourcePageList", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LoadTestResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/models/operationsMappers.ts b/sdk/loadtestservice/arm-loadtestservice/src/models/operationsMappers.ts new file mode 100644 index 000000000000..fddc3077d64b --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/models/operationsMappers.ts @@ -0,0 +1,16 @@ +/* + * 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. + */ + +export { + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + Operation, + OperationDisplay, + OperationListResult +} from "../models/mappers"; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/models/parameters.ts b/sdk/loadtestservice/arm-loadtestservice/src/models/parameters.ts new file mode 100644 index 000000000000..172fa72035c8 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/models/parameters.ts @@ -0,0 +1,82 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; + +export const acceptLanguage: msRest.OperationParameter = { + parameterPath: "acceptLanguage", + mapper: { + serializedName: "accept-language", + defaultValue: 'en-US', + type: { + name: "String" + } + } +}; +export const apiVersion: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + serializedName: "api-version", + constraints: { + MinLength: 1 + }, + type: { + name: "String" + } + } +}; +export const loadTestName: msRest.OperationURLParameter = { + parameterPath: "loadTestName", + mapper: { + required: true, + serializedName: "loadTestName", + type: { + name: "String" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const resourceGroupName: msRest.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + required: true, + serializedName: "resourceGroupName", + constraints: { + MaxLength: 90, + MinLength: 1 + }, + type: { + name: "String" + } + } +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + constraints: { + MinLength: 1 + }, + type: { + name: "String" + } + } +}; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/operations/index.ts b/sdk/loadtestservice/arm-loadtestservice/src/operations/index.ts new file mode 100644 index 000000000000..0b8a3094c925 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/operations/index.ts @@ -0,0 +1,11 @@ +/* + * 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. + */ + +export * from "./operations"; +export * from "./loadTests"; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/operations/loadTests.ts b/sdk/loadtestservice/arm-loadtestservice/src/operations/loadTests.ts new file mode 100644 index 000000000000..f3c2dfab57b5 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/operations/loadTests.ts @@ -0,0 +1,481 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as Models from "../models"; +import * as Mappers from "../models/loadTestsMappers"; +import * as Parameters from "../models/parameters"; +import { LoadTestClientContext } from "../loadTestClientContext"; + +/** Class representing a LoadTests. */ +export class LoadTests { + private readonly client: LoadTestClientContext; + + /** + * Create a LoadTests. + * @param {LoadTestClientContext} client Reference to the service client. + */ + constructor(client: LoadTestClientContext) { + this.client = client; + } + + /** + * Lists loadtests resources in a subscription. + * @param [options] The optional parameters + * @returns Promise + */ + listBySubscription(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + listBySubscription(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + listBySubscription(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listBySubscription(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listBySubscriptionOperationSpec, + callback) as Promise; + } + + /** + * Lists loadtest resources in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param [options] The optional parameters + * @returns Promise + */ + listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The optional parameters + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + options + }, + listByResourceGroupOperationSpec, + callback) as Promise; + } + + /** + * Get a LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceGroupName: string, loadTestName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param callback The callback + */ + get(resourceGroupName: string, loadTestName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param options The optional parameters + * @param callback The callback + */ + get(resourceGroupName: string, loadTestName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceGroupName: string, loadTestName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + loadTestName, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Create or update LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResource LoadTest resource data + * @param [options] The optional parameters + * @returns Promise + */ + createOrUpdate(resourceGroupName: string, loadTestName: string, loadTestResource: Models.LoadTestResource, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResource LoadTest resource data + * @param callback The callback + */ + createOrUpdate(resourceGroupName: string, loadTestName: string, loadTestResource: Models.LoadTestResource, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResource LoadTest resource data + * @param options The optional parameters + * @param callback The callback + */ + createOrUpdate(resourceGroupName: string, loadTestName: string, loadTestResource: Models.LoadTestResource, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + createOrUpdate(resourceGroupName: string, loadTestName: string, loadTestResource: Models.LoadTestResource, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + loadTestName, + loadTestResource, + options + }, + createOrUpdateOperationSpec, + callback) as Promise; + } + + /** + * Update a loadtest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data + * @param [options] The optional parameters + * @returns Promise + */ + update(resourceGroupName: string, loadTestName: string, loadTestResourcePatchRequestBody: Models.LoadTestResourcePatchRequestBody, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data + * @param callback The callback + */ + update(resourceGroupName: string, loadTestName: string, loadTestResourcePatchRequestBody: Models.LoadTestResourcePatchRequestBody, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data + * @param options The optional parameters + * @param callback The callback + */ + update(resourceGroupName: string, loadTestName: string, loadTestResourcePatchRequestBody: Models.LoadTestResourcePatchRequestBody, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + update(resourceGroupName: string, loadTestName: string, loadTestResourcePatchRequestBody: Models.LoadTestResourcePatchRequestBody, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + loadTestName, + loadTestResourcePatchRequestBody, + options + }, + updateOperationSpec, + callback) as Promise; + } + + /** + * Delete a LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(resourceGroupName: string, loadTestName: string, options?: msRest.RequestOptionsBase): Promise { + return this.beginDeleteMethod(resourceGroupName,loadTestName,options) + .then(lroPoller => lroPoller.pollUntilFinished()); + } + + /** + * Delete a LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param [options] The optional parameters + * @returns Promise + */ + beginDeleteMethod(resourceGroupName: string, loadTestName: string, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + loadTestName, + options + }, + beginDeleteMethodOperationSpec, + options); + } + + /** + * Lists loadtests resources in a subscription. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listBySubscriptionNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listBySubscriptionNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listBySubscriptionNextOperationSpec, + callback) as Promise; + } + + /** + * Lists loadtest resources in a resource group. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listByResourceGroupNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listBySubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/loadTests", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.LoadTestResourcePageList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listByResourceGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.LoadTestResourcePageList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.loadTestName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.LoadTestResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const createOrUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.loadTestName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "loadTestResource", + mapper: { + ...Mappers.LoadTestResource, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.LoadTestResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.loadTestName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "loadTestResourcePatchRequestBody", + mapper: { + ...Mappers.LoadTestResourcePatchRequestBody, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.LoadTestResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const beginDeleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.loadTestName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.LoadTestResourcePageList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.LoadTestResourcePageList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/operations/operations.ts b/sdk/loadtestservice/arm-loadtestservice/src/operations/operations.ts new file mode 100644 index 000000000000..e5d752542967 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/operations/operations.ts @@ -0,0 +1,125 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/operationsMappers"; +import * as Parameters from "../models/parameters"; +import { LoadTestClientContext } from "../loadTestClientContext"; + +/** Class representing a Operations. */ +export class Operations { + private readonly client: LoadTestClientContext; + + /** + * Create a Operations. + * @param {LoadTestClientContext} client Reference to the service client. + */ + constructor(client: LoadTestClientContext) { + this.client = client; + } + + /** + * Lists all the available API operations for Load Test Resource. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Lists all the available API operations for Load Test Resource. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.LoadTestService/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/loadtestservice/arm-loadtestservice/tsconfig.json b/sdk/loadtestservice/arm-loadtestservice/tsconfig.json new file mode 100644 index 000000000000..422b584abd5e --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules"] +}