Skip to content

Commit

Permalink
CodeGen from PR 11712 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 1ea7d1bcb17d8cffb7ac2e3a4482847d579dc7d1 into eea7c0141c0b7ad9f66f8ba06560b549c6b3b014
  • Loading branch information
SDKAuto committed Dec 1, 2020
1 parent 6c6ce54 commit 26240b1
Show file tree
Hide file tree
Showing 15 changed files with 1,686 additions and 217 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) 2020 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
22 changes: 11 additions & 11 deletions sdk/managedapplications/arm-managedapplications/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Azure ManagedApplicationClient SDK for JavaScript
## Azure ApplicationClient SDK for JavaScript

This package contains an isomorphic SDK for ManagedApplicationClient.
This package contains an isomorphic SDK for ApplicationClient.

### Currently supported environments

Expand All @@ -15,25 +15,25 @@ npm install @azure/arm-managedapplications

### How to use

#### nodejs - Authentication, client creation and listOperations as an example written in TypeScript.
#### nodejs - client creation and listOperations as an example written in TypeScript.

##### Install @azure/ms-rest-nodeauth

- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
```bash
npm install @azure/ms-rest-nodeauth
npm install @azure/ms-rest-nodeauth@"^3.0.0"
```

##### Sample code

While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
```typescript
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { ManagedApplicationClient, ManagedApplicationModels, ManagedApplicationMappers } from "@azure/arm-managedapplications";
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
const { ApplicationClient } = require("@azure/arm-managedapplications");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
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 Down Expand Up @@ -76,7 +76,7 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
// may cause redirects
authManager.login();
}
const client = new Azure.ArmManagedapplications.ManagedApplicationClient(res.creds, subscriptionId);
const client = new Azure.ArmManagedapplications.ApplicationClient(res.creds, subscriptionId);
client.listOperations().then((result) => {
console.log("The result is:");
console.log(result);
Expand All @@ -95,4 +95,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to

- [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%2Fsdk%2Fmanagedapplications%2Farm-managedapplications%2FREADME.png)
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/managedapplications/arm-managedapplications/README.png)
20 changes: 10 additions & 10 deletions sdk/managedapplications/arm-managedapplications/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"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.0.2",
"dependencies": {
"@azure/ms-rest-azure-js": "^1.3.2",
"@azure/ms-rest-js": "^1.8.1",
"tslib": "^1.9.3"
"@azure/ms-rest-azure-js": "^2.0.1",
"@azure/ms-rest-js": "^2.0.4",
"tslib": "^1.10.0"
},
"keywords": [
"node",
Expand All @@ -17,14 +17,14 @@
],
"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.1.1",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.4.0",
"typescript": "^3.5.3",
"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/master/sdk/managedapplications/arm-managedapplications",
"repository": {
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
@@ -0,0 +1,140 @@
/*
* 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/mappers";
import * as Parameters from "./models/parameters";
import * as operations from "./operations";
import { ApplicationClientContext } from "./applicationClientContext";


class ApplicationClient extends ApplicationClientContext {
// Operation groups
applications: operations.Applications;
applicationDefinitions: operations.ApplicationDefinitions;

/**
* Initializes a new instance of the ApplicationClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ApplicationClientOptions) {
super(credentials, subscriptionId, options);
this.applications = new operations.Applications(this);
this.applicationDefinitions = new operations.ApplicationDefinitions(this);
}

/**
* Lists all of the available Microsoft.Solutions REST API operations.
* @param [options] The optional parameters
* @returns Promise<Models.ListOperationsResponse>
*/
listOperations(options?: msRest.RequestOptionsBase): Promise<Models.ListOperationsResponse>;
/**
* @param callback The callback
*/
listOperations(callback: msRest.ServiceCallback<Models.OperationListResult>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
listOperations(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.OperationListResult>): void;
listOperations(options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.OperationListResult>, callback?: msRest.ServiceCallback<Models.OperationListResult>): Promise<Models.ListOperationsResponse> {
return this.sendOperationRequest(
{
options
},
listOperationsOperationSpec,
callback) as Promise<Models.ListOperationsResponse>;
}

/**
* Lists all of the available Microsoft.Solutions REST API operations.
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param [options] The optional parameters
* @returns Promise<Models.ListOperationsNextResponse>
*/
listOperationsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise<Models.ListOperationsNextResponse>;
/**
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param callback The callback
*/
listOperationsNext(nextPageLink: string, callback: msRest.ServiceCallback<Models.OperationListResult>): void;
/**
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param options The optional parameters
* @param callback The callback
*/
listOperationsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.OperationListResult>): void;
listOperationsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.OperationListResult>, callback?: msRest.ServiceCallback<Models.OperationListResult>): Promise<Models.ListOperationsNextResponse> {
return this.sendOperationRequest(
{
nextPageLink,
options
},
listOperationsNextOperationSpec,
callback) as Promise<Models.ListOperationsNextResponse>;
}
}

// Operation Specifications
const serializer = new msRest.Serializer(Mappers);
const listOperationsOperationSpec: msRest.OperationSpec = {
httpMethod: "GET",
path: "providers/Microsoft.Solutions/operations",
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
responses: {
200: {
bodyMapper: Mappers.OperationListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
serializer
};

const listOperationsNextOperationSpec: 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.CloudError
}
},
serializer
};

export {
ApplicationClient,
ApplicationClientContext,
Models as ApplicationModels,
Mappers as ApplicationMappers
};
export * from "./operations";
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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";

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

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

/**
* Initializes a new instance of the ApplicationClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ApplicationClientOptions) {
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 = '2018-06-01';
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;
}
}
}
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,
ApplicationDefinitionListResult,
ApplicationPatchable,
ApplicationProviderAuthorization,
BaseResource,
ErrorResponse,
GenericResource,
Identity,
Plan,
PlanPatchable,
Resource,
Sku
} from "../models/mappers";
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 26240b1

Please sign in to comment.