Skip to content

Commit

Permalink
CodeGen from PR 12281 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 3cd5abdb85f8771c26bb9b8dcd946c8de259e43c into ffc5119f58e1e302748bd21aff7bc01acd2b6d13
  • Loading branch information
SDKAuto committed Jan 11, 2021
1 parent 6e03f88 commit 18da49d
Show file tree
Hide file tree
Showing 25 changed files with 2,892 additions and 2,190 deletions.
2 changes: 1 addition & 1 deletion sdk/reservations/arm-reservations/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 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
33 changes: 15 additions & 18 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 list reservation as an example written in TypeScript.

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

Expand All @@ -26,17 +26,16 @@ 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");

interactiveLogin().then((creds) => {
const client = new AzureReservationAPI(creds);
const subscriptionId = "testsubscriptionId";
const providerId = "testproviderId";
const location = "westus";
const resourceName = "testresourceName";
client.quota.get(subscriptionId, providerId, location, resourceName).then((result) => {
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new AzureReservationAPI(creds, subscriptionId);
const reservationOrderId = "testreservationOrderId";
client.reservation.list(reservationOrderId).then((result) => {
console.log("The result is:");
console.log(result);
});
Expand All @@ -45,7 +44,7 @@ interactiveLogin().then((creds) => {
});
```

#### browser - Authentication, client creation and get quota as an example written in JavaScript.
#### browser - Authentication, client creation and list reservation as an example written in JavaScript.

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

Expand All @@ -68,6 +67,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,12 +77,9 @@ 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 subscriptionId = "testsubscriptionId";
const providerId = "testproviderId";
const location = "westus";
const resourceName = "testresourceName";
client.quota.get(subscriptionId, providerId, location, resourceName).then((result) => {
const client = new Azure.ArmReservations.AzureReservationAPI(res.creds, subscriptionId);
const reservationOrderId = "testreservationOrderId";
client.reservation.list(reservationOrderId).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
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
25 changes: 13 additions & 12 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 @@ -18,12 +17,13 @@ import { AzureReservationAPIContext } from "./azureReservationAPIContext";

class AzureReservationAPI extends AzureReservationAPIContext {
// Operation groups
quota: operations.Quota;
quotaRequestStatus: operations.QuotaRequestStatus;
autoQuotaIncrease: operations.AutoQuotaIncrease;
reservation: operations.Reservation;
reservationOrder: operations.ReservationOrder;
operation: operations.Operation;
calculateExchange: operations.CalculateExchange;
exchange: operations.Exchange;
quota: operations.Quota;
quotaRequestStatus: operations.QuotaRequestStatus;

/**
* Initializes a new instance of the AzureReservationAPI class.
Expand All @@ -32,12 +32,13 @@ class AzureReservationAPI extends AzureReservationAPIContext {
*/
constructor(credentials: msRest.ServiceClientCredentials, options?: Models.AzureReservationAPIOptions) {
super(credentials, options);
this.quota = new operations.Quota(this);
this.quotaRequestStatus = new operations.QuotaRequestStatus(this);
this.autoQuotaIncrease = new operations.AutoQuotaIncrease(this);
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);
this.quota = new operations.Quota(this);
this.quotaRequestStatus = new operations.QuotaRequestStatus(this);
}

/**
Expand Down Expand Up @@ -113,9 +114,9 @@ const getCatalogOperationSpec: msRest.OperationSpec = {
Parameters.subscriptionId
],
queryParameters: [
Parameters.apiVersion1,
Parameters.apiVersion0,
Parameters.reservedResourceType,
Parameters.location1
Parameters.location0
],
headerParameters: [
Parameters.acceptLanguage
Expand Down Expand Up @@ -149,7 +150,7 @@ const getAppliedReservationListOperationSpec: msRest.OperationSpec = {
Parameters.subscriptionId
],
queryParameters: [
Parameters.apiVersion1
Parameters.apiVersion0
],
headerParameters: [
Parameters.acceptLanguage
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

This file was deleted.

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";
27 changes: 27 additions & 0 deletions sdk/reservations/arm-reservations/src/models/exchangeMappers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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,
PurchaseRequest,
PurchaseRequestPropertiesReservedResourceProperties,
ReservationToPurchaseExchange,
ReservationToReturnForExchange,
SkuName
} from "../models/mappers";
Loading

0 comments on commit 18da49d

Please sign in to comment.