Skip to content

Commit

Permalink
CodeGen from PR 15671 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
update-typescript.md-for-resources (Azure#15671)

* update-typescript.md-for-resources

* update
  • Loading branch information
SDKAuto committed Aug 23, 2021
1 parent cadd8b2 commit ed043bd
Show file tree
Hide file tree
Showing 17 changed files with 954 additions and 944 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Microsoft
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
Expand Down
21 changes: 9 additions & 12 deletions sdk/managedapplications/arm-managedapplications/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Azure ManagedApplicationClient SDK for JavaScript
## Azure ApplicationClient SDK for JavaScript

This package contains an isomorphic SDK (runs both in Node.js and in browsers) for ManagedApplicationClient.
This package contains an isomorphic SDK (runs both in node.js and in browsers) for ApplicationClient.

### Currently supported environments

- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.
- Latest versions of Safari, Chrome, Edge and Firefox.

### Prerequisites

Expand All @@ -21,7 +21,6 @@ Install both packages using the below command:
```bash
npm install --save @azure/arm-managedapplications @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.

Expand All @@ -37,21 +36,19 @@ If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/

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 listOperations as an example written in JavaScript.
#### nodejs - Authentication, client creation, and listOperations as an example written in JavaScript.

##### Sample code

```javascript
const { DefaultAzureCredential } = require("@azure/identity");
const { ManagedApplicationClient } = require("@azure/arm-managedapplications");
const { ApplicationClient } = require("@azure/arm-managedapplications");
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 ManagedApplicationClient(creds, subscriptionId);

const client = new ApplicationClient(creds, subscriptionId);
client.listOperations().then((result) => {
console.log("The result is:");
console.log(result);
Expand All @@ -61,7 +58,7 @@ client.listOperations().then((result) => {
});
```

#### browser - Authentication, client creation, and listOperations as an example written in JavaScript.
#### browser - Authentication, client creation, and listOperations 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.
Expand All @@ -86,9 +83,9 @@ In browser applications, we recommend using the `InteractiveBrowserCredential` t
const credential = new InteractiveBrowserCredential(
{
clientId: "<client id for your Azure AD app>",
tenantId: "<optional tenant for your organization>"
tenant: "<optional tenant for your organization>"
});
const client = new Azure.ArmManagedapplications.ManagedApplicationClient(creds, subscriptionId);
const client = new Azure.ArmManagedapplications.ApplicationClient(creds, subscriptionId);
client.listOperations().then((result) => {
console.log("The result is:");
console.log(result);
Expand Down
20 changes: 10 additions & 10 deletions sdk/managedapplications/arm-managedapplications/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@azure/arm-managedapplications",
"author": "Microsoft Corporation",
"description": "ManagedApplicationClient Library with typescript type definitions for node.js and browser.",
"description": "ApplicationClient Library with typescript type definitions for node.js and browser.",
"version": "1.1.1",
"dependencies": {
"@azure/ms-rest-azure-js": "^1.4.0",
"@azure/ms-rest-js": "^1.11.0",
"@azure/ms-rest-azure-js": "^2.1.0",
"@azure/ms-rest-js": "^2.2.0",
"@azure/core-auth": "^1.1.4",
"tslib": "^1.9.3"
"tslib": "^1.10.0"
},
"keywords": [
"node",
Expand All @@ -18,16 +18,16 @@
],
"license": "MIT",
"main": "./dist/arm-managedapplications.js",
"module": "./esm/managedApplicationClient.js",
"types": "./esm/managedApplicationClient.d.ts",
"module": "./esm/applicationClient.js",
"types": "./esm/applicationClient.d.ts",
"devDependencies": {
"typescript": "^3.6.0",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"uglify-js": "^3.4.9"
"uglify-js": "^3.6.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/feature/v4/sdk/managedapplications/arm-managedapplications",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/managedapplications/arm-managedapplications",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sourcemaps from "rollup-plugin-sourcemaps";
* @type {rollup.RollupFileOptions}
*/
const config = {
input: "./esm/managedApplicationClient.js",
input: "./esm/applicationClient.js",
external: [
"@azure/ms-rest-js",
"@azure/ms-rest-azure-js"
Expand All @@ -21,15 +21,15 @@ const config = {
"@azure/ms-rest-azure-js": "msRestAzure"
},
banner: `/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* 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({ module: true }),
nodeResolve({ mainFields: ['module', 'main'] }),
sourcemaps()
]
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* 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
Expand All @@ -14,16 +13,16 @@ import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as Parameters from "./models/parameters";
import * as operations from "./operations";
import { ManagedApplicationClientContext } from "./managedApplicationClientContext";
import { ApplicationClientContext } from "./applicationClientContext";


class ManagedApplicationClient extends ManagedApplicationClientContext {
class ApplicationClient extends ApplicationClientContext {
// Operation groups
appliances: operations.Appliances;
applianceDefinitions: operations.ApplianceDefinitions;
applications: operations.Applications;
applicationDefinitions: operations.ApplicationDefinitions;

/**
* Initializes a new instance of the ManagedApplicationClient class.
* Initializes a new instance of the ApplicationClient 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
Expand All @@ -33,10 +32,10 @@ class ManagedApplicationClient extends ManagedApplicationClientContext {
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ManagedApplicationClientOptions) {
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ApplicationClientOptions) {
super(credentials, subscriptionId, options);
this.appliances = new operations.Appliances(this);
this.applianceDefinitions = new operations.ApplianceDefinitions(this);
this.applications = new operations.Applications(this);
this.applicationDefinitions = new operations.ApplicationDefinitions(this);
}

/**
Expand Down Expand Up @@ -121,6 +120,9 @@ const listOperationsNextOperationSpec: msRest.OperationSpec = {
urlParameters: [
Parameters.nextPageLink
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
Expand All @@ -136,9 +138,9 @@ const listOperationsNextOperationSpec: msRest.OperationSpec = {
};

export {
ManagedApplicationClient,
ManagedApplicationClientContext,
Models as ManagedApplicationModels,
Mappers as ManagedApplicationMappers
ApplicationClient,
ApplicationClientContext,
Models as ApplicationModels,
Mappers as ApplicationMappers
};
export * from "./operations";
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* 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
Expand All @@ -10,19 +9,19 @@

import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import { TokenCredential } from "@azure/core-auth";

const packageName = "@azure/arm-managedapplications";
const packageVersion = "1.1.1";

export class ManagedApplicationClientContext extends msRestAzure.AzureServiceClient {
export class ApplicationClientContext extends msRestAzure.AzureServiceClient {
credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
apiVersion?: string;

/**
* Initializes a new instance of the ManagedApplicationClient class.
* Initializes a new instance of the ApplicationClient 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
Expand All @@ -32,7 +31,7 @@ export class ManagedApplicationClientContext extends msRestAzure.AzureServiceCli
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ManagedApplicationClientOptions) {
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ApplicationClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
Expand All @@ -50,7 +49,7 @@ export class ManagedApplicationClientContext extends msRestAzure.AzureServiceCli

super(credentials, options);

this.apiVersion = '2016-09-01-preview';
this.apiVersion = '2018-06-01';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* 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 {
Appliance,
ApplianceArtifact,
ApplianceDefinition,
ApplianceListResult,
AppliancePatchable,
ApplianceProviderAuthorization,
Application,
ApplicationArtifact,
ApplicationDefinition,
ApplicationDefinitionListResult,
ApplicationPatchable,
ApplicationProviderAuthorization,
BaseResource,
ErrorResponse,
GenericResource,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Application,
ApplicationArtifact,
ApplicationDefinition,
ApplicationListResult,
ApplicationPatchable,
ApplicationProviderAuthorization,
BaseResource,
ErrorResponse,
GenericResource,
Identity,
Plan,
PlanPatchable,
Resource,
Sku
} from "../models/mappers";
Loading

0 comments on commit ed043bd

Please sign in to comment.