Skip to content

Commit

Permalink
CodeGen from PR 14481 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 7418abf0130f8f5ad8e71bdca311b63f7868ae97 into 689766ce89ed3776328e34bde7ddba9ee257cf6d
  • Loading branch information
SDKAuto committed May 19, 2021
1 parent 4e7d629 commit 238c1fd
Show file tree
Hide file tree
Showing 21 changed files with 3,583 additions and 784 deletions.
2 changes: 1 addition & 1 deletion sdk/hybridcompute/arm-hybridcompute/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
17 changes: 8 additions & 9 deletions sdk/hybridcompute/arm-hybridcompute/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install @azure/arm-hybridcompute

### How to use

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

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

Expand All @@ -26,19 +26,18 @@ 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 { HybridComputeManagementClient, HybridComputeManagementModels, HybridComputeManagementMappers } from "@azure/arm-hybridcompute";
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
const { HybridComputeManagementClient } = require("@azure/arm-hybridcompute");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new HybridComputeManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const name = "testname";
const machineName = "testmachineName";
const expand = "instanceView";
client.machines.get(resourceGroupName, name, expand).then((result) => {
client.machines.get(resourceGroupName, machineName, expand).then((result) => {
console.log("The result is:");
console.log(result);
});
Expand Down Expand Up @@ -82,9 +81,9 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
}
const client = new Azure.ArmHybridcompute.HybridComputeManagementClient(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const name = "testname";
const machineName = "testmachineName";
const expand = "instanceView";
client.machines.get(resourceGroupName, name, expand).then((result) => {
client.machines.get(resourceGroupName, machineName, expand).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand Down
4 changes: 2 additions & 2 deletions sdk/hybridcompute/arm-hybridcompute/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
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/*
* 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.
*/

import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as Parameters from "./models/parameters";
import * as operations from "./operations";
import { HybridComputeManagementClientContext } from "./hybridComputeManagementClientContext";

Expand All @@ -20,23 +21,91 @@ class HybridComputeManagementClient extends HybridComputeManagementClientContext
machines: operations.Machines;
machineExtensions: operations.MachineExtensions;
operations: operations.Operations;
privateLinkScopes: operations.PrivateLinkScopes;
privateLinkResources: operations.PrivateLinkResources;
privateEndpointConnections: operations.PrivateEndpointConnections;

/**
* Initializes a new instance of the HybridComputeManagementClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HybridComputeManagementClientOptions) {
super(credentials, subscriptionId, options);
this.machines = new operations.Machines(this);
this.machineExtensions = new operations.MachineExtensions(this);
this.operations = new operations.Operations(this);
this.privateLinkScopes = new operations.PrivateLinkScopes(this);
this.privateLinkResources = new operations.PrivateLinkResources(this);
this.privateEndpointConnections = new operations.PrivateEndpointConnections(this);
}

/**
* The operation to Upgrade Machine Extensions.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param machineName The name of the hybrid machine.
* @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation.
* @param [options] The optional parameters
* @returns Promise<msRest.RestResponse>
*/
upgradeExtensions(resourceGroupName: string, machineName: string, extensionUpgradeParameters: Models.MachineExtensionUpgrade, options?: msRest.RequestOptionsBase): Promise<msRest.RestResponse> {
return this.beginUpgradeExtensions(resourceGroupName,machineName,extensionUpgradeParameters,options)
.then(lroPoller => lroPoller.pollUntilFinished());
}

/**
* The operation to Upgrade Machine Extensions.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param machineName The name of the hybrid machine.
* @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation.
* @param [options] The optional parameters
* @returns Promise<msRestAzure.LROPoller>
*/
beginUpgradeExtensions(resourceGroupName: string, machineName: string, extensionUpgradeParameters: Models.MachineExtensionUpgrade, options?: msRest.RequestOptionsBase): Promise<msRestAzure.LROPoller> {
return this.sendLRORequest(
{
resourceGroupName,
machineName,
extensionUpgradeParameters,
options
},
beginUpgradeExtensionsOperationSpec,
options);
}
}

// Operation Specifications
const serializer = new msRest.Serializer(Mappers);
const beginUpgradeExtensionsOperationSpec: msRest.OperationSpec = {
httpMethod: "POST",
path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions",
urlParameters: [
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.machineName0
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
requestBody: {
parameterPath: "extensionUpgradeParameters",
mapper: {
...Mappers.MachineExtensionUpgrade,
required: true
}
},
responses: {
202: {},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};

export {
HybridComputeManagementClient,
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 @@ -17,14 +16,13 @@ const packageVersion = "2.0.0";

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

/**
* Initializes a new instance of the HybridComputeManagementClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HybridComputeManagementClientOptions) {
Expand All @@ -38,25 +36,25 @@ export class HybridComputeManagementClientContext extends msRestAzure.AzureServi
if (!options) {
options = {};
}
if (!options.userAgent) {
if(!options.userAgent) {
const defaultUserAgent = msRestAzure.getDefaultUserAgentValue();
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
}

super(credentials, options);

this.apiVersion = '2020-08-02';
this.apiVersion = '2021-05-17-preview';
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) {
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
}
Expand Down
Loading

0 comments on commit 238c1fd

Please sign in to comment.