Skip to content

Commit

Permalink
CodeGen from PR 12080 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 494a50dab47cdf9e091e36077da704ea44635600 into 88aae44f2ca08a5bf249f5cb64f9ce01d3429ec6
  • Loading branch information
SDKAuto committed Dec 12, 2020
1 parent 6c6ce54 commit 300ae8c
Show file tree
Hide file tree
Showing 24 changed files with 1,804 additions and 300 deletions.
15 changes: 9 additions & 6 deletions sdk/reservations/arm-reservations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install @azure/arm-reservations

### How to use

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

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

Expand All @@ -26,12 +26,14 @@ npm install @azure/ms-rest-nodeauth@"^3.0.0"

##### Sample code

```javascript
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
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
const { AzureReservationAPI } = require("@azure/arm-reservations");
const { interactiveLogin } = require("@azure/ms-rest-nodeauth");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

interactiveLogin().then((creds) => {
const client = new AzureReservationAPI(creds);
msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new AzureReservationAPI(creds, subscriptionId);
const subscriptionId = "testsubscriptionId";
const providerId = "testproviderId";
const location = "westus";
Expand Down Expand Up @@ -68,6 +70,7 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/arm-reservations/dist/arm-reservations.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
Expand All @@ -77,7 +80,7 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
// may cause redirects
authManager.login();
}
const client = new Azure.ArmReservations.AzureReservationAPI(res.creds);
const client = new Azure.ArmReservations.AzureReservationAPI(res.creds, subscriptionId);
const subscriptionId = "testsubscriptionId";
const providerId = "testproviderId";
const location = "westus";
Expand Down
4 changes: 2 additions & 2 deletions sdk/reservations/arm-reservations/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ 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.
Expand Down
9 changes: 6 additions & 3 deletions sdk/reservations/arm-reservations/src/azureReservationAPI.ts
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 @@ -24,6 +23,8 @@ class AzureReservationAPI extends AzureReservationAPIContext {
reservation: operations.Reservation;
reservationOrder: operations.ReservationOrder;
operation: operations.Operation;
calculateExchange: operations.CalculateExchange;
exchange: operations.Exchange;

/**
* Initializes a new instance of the AzureReservationAPI class.
Expand All @@ -38,6 +39,8 @@ class AzureReservationAPI extends AzureReservationAPIContext {
this.reservation = new operations.Reservation(this);
this.reservationOrder = new operations.ReservationOrder(this);
this.operation = new operations.Operation(this);
this.calculateExchange = new operations.CalculateExchange(this);
this.exchange = new operations.Exchange(this);
}

/**
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 Down
Original file line number Diff line number Diff line change
@@ -1,6 +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 regenerated.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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 {
BillingInformation,
CalculateExchangeOperationResultResponse,
CalculateExchangePostHeaders,
CalculateExchangeRequest,
CalculateExchangeRequestProperties,
CalculateExchangeResponseProperties,
ErrorModel,
ExchangePolicyError,
ExchangePolicyErrors,
ExtendedErrorInfo,
OperationResultError,
Price,
PurchaseRequest,
PurchaseRequestPropertiesReservedResourceProperties,
ReservationToExchange,
ReservationToPurchaseCalculateExchange,
ReservationToReturn,
SkuName
} from "../models/mappers";
24 changes: 24 additions & 0 deletions sdk/reservations/arm-reservations/src/models/exchangeMappers.ts
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 {
BillingInformation,
ErrorModel,
ExchangeOperationResultResponse,
ExchangePolicyError,
ExchangePolicyErrors,
ExchangePostHeaders,
ExchangeRequest,
ExchangeRequestProperties,
ExchangeResponseProperties,
ExtendedErrorInfo,
OperationResultError,
Price,
ReservationToPurchaseExchange,
ReservationToReturnForExchange
} from "../models/mappers";
Loading

0 comments on commit 300ae8c

Please sign in to comment.