Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR @azure/arm-reservations] add reservations track2 config #2921

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 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 getCatalog 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");
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";
const resourceName = "testresourceName";
client.quota.get(subscriptionId, providerId, location, resourceName).then((result) => {
client.getCatalog(subscriptionId).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 getCatalog 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 client = new Azure.ArmReservations.AzureReservationAPI(res.creds, subscriptionId);
const subscriptionId = "testsubscriptionId";
const providerId = "testproviderId";
const location = "westus";
const resourceName = "testresourceName";
client.quota.get(subscriptionId, providerId, location, resourceName).then((result) => {
client.getCatalog(subscriptionId).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
40 changes: 15 additions & 25 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,11 @@ 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;
reservation: operations.Reservation;
operation: operations.Operation;
quota: operations.Quota;
quotaRequestStatus: operations.QuotaRequestStatus;

/**
* Initializes a new instance of the AzureReservationAPI class.
Expand All @@ -32,50 +30,44 @@ 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.reservation = new operations.Reservation(this);
this.operation = new operations.Operation(this);
this.quota = new operations.Quota(this);
this.quotaRequestStatus = new operations.QuotaRequestStatus(this);
}

/**
* @summary Get the regions and skus that are available for RI purchase for the specified Azure
* subscription.
* @param subscriptionId Id of the subscription
* @param reservedResourceType The type of the resource for which the skus should be provided.
* @param [options] The optional parameters
* @returns Promise<Models.GetCatalogResponse>
*/
getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams): Promise<Models.GetCatalogResponse>;
getCatalog(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise<Models.GetCatalogResponse>;
/**
* @param subscriptionId Id of the subscription
* @param reservedResourceType The type of the resource for which the skus should be provided.
* @param callback The callback
*/
getCatalog(subscriptionId: string, reservedResourceType: string, callback: msRest.ServiceCallback<Models.Catalog[]>): void;
getCatalog(subscriptionId: string, callback: msRest.ServiceCallback<Models.Catalog[]>): void;
/**
* @param subscriptionId Id of the subscription
* @param reservedResourceType The type of the resource for which the skus should be provided.
* @param options The optional parameters
* @param callback The callback
*/
getCatalog(subscriptionId: string, reservedResourceType: string, options: Models.AzureReservationAPIGetCatalogOptionalParams, callback: msRest.ServiceCallback<Models.Catalog[]>): void;
getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams | msRest.ServiceCallback<Models.Catalog[]>, callback?: msRest.ServiceCallback<Models.Catalog[]>): Promise<Models.GetCatalogResponse> {
getCatalog(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.Catalog[]>): void;
getCatalog(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.Catalog[]>, callback?: msRest.ServiceCallback<Models.Catalog[]>): Promise<Models.GetCatalogResponse> {
return this.sendOperationRequest(
{
subscriptionId,
reservedResourceType,
options
},
getCatalogOperationSpec,
callback) as Promise<Models.GetCatalogResponse>;
}

/**
* Get applicable `Reservation`s that are applied to this subscription or a resource group under
* this subscription.
* Get applicable `Reservation`s that are applied to this subscription.
* @summary Get list of applicable `Reservation`s.
* @param subscriptionId Id of the subscription
* @param [options] The optional parameters
Expand Down Expand Up @@ -113,9 +105,7 @@ const getCatalogOperationSpec: msRest.OperationSpec = {
Parameters.subscriptionId
],
queryParameters: [
Parameters.apiVersion1,
Parameters.reservedResourceType,
Parameters.location1
Parameters.apiVersion0
],
headerParameters: [
Parameters.acceptLanguage
Expand Down Expand Up @@ -149,7 +139,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.

Loading