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-serialconsole] add cli.md for serialconsole #445

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
2 changes: 1 addition & 1 deletion sdk/serialconsole/arm-serialconsole/LICENSE.txt
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
14 changes: 7 additions & 7 deletions sdk/serialconsole/arm-serialconsole/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ npm install @azure/arm-serialconsole

### How to use

#### nodejs - Authentication, client creation and operations list as an example written in TypeScript.
#### nodejs - Authentication, 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
Expand All @@ -34,7 +35,7 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new MicrosoftSerialConsoleClient(creds, subscriptionId);
client.list.operations().then((result) => {
client.listOperations().then((result) => {
console.log("The result is:");
console.log(result);
});
Expand All @@ -43,7 +44,7 @@ msRestNodeAuth.interactiveLogin().then((creds) => {
});
```

#### browser - Authentication, client creation and operations list as an example written in JavaScript.
#### browser - Authentication, client creation and listOperations as an example written in JavaScript.

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

Expand Down Expand Up @@ -77,7 +78,7 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
authManager.login();
}
const client = new Azure.ArmSerialconsole.MicrosoftSerialConsoleClient(res.creds, subscriptionId);
client.list.operations().then((result) => {
client.listOperations().then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand All @@ -95,5 +96,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%2Fserialconsole%2Farm-serialconsole%2FREADME.png)
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/serialconsole/arm-serialconsole/README.png)
20 changes: 10 additions & 10 deletions sdk/serialconsole/arm-serialconsole/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "MicrosoftSerialConsoleClient Library with typescript type definitions for node.js and browser.",
"version": "1.0.0",
"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 @@ -20,19 +20,19 @@
"module": "./esm/microsoftSerialConsoleClient.js",
"types": "./esm/microsoftSerialConsoleClient.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",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/serialconsole/arm-serialconsole",
"repository": {
"type": "git",
"url": "https://github.com/azure/azure-sdk-for-js.git"
"url": "https://github.com/Azure/azure-sdk-for-js.git"
},
"bugs": {
"url": "https://github.com/azure/azure-sdk-for-js/issues"
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"files": [
"dist/**/*.js",
Expand Down
2 changes: 1 addition & 1 deletion sdk/serialconsole/arm-serialconsole/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const config = {
*/`
},
plugins: [
nodeResolve({ module: true }),
nodeResolve({ mainFields: ['module', 'main'] }),
sourcemaps()
]
};
Expand Down
226 changes: 215 additions & 11 deletions sdk/serialconsole/arm-serialconsole/src/microsoftSerialConsoleClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,240 @@
import * as msRest from "@azure/ms-rest-js";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
import * as Parameters from "./models/parameters";
import { MicrosoftSerialConsoleClientContext } from "./microsoftSerialConsoleClientContext";


class MicrosoftSerialConsoleClient extends MicrosoftSerialConsoleClientContext {
// Operation groups
list: operations.List;
listConsole: operations.ListConsole;
console: operations.Console;

/**
* Initializes a new instance of the MicrosoftSerialConsoleClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param subscriptionId The ID of the target subscription.
* @param subscriptionId Subscription ID which uniquely identifies the Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call requiring it.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MicrosoftSerialConsoleClientOptions) {
super(credentials, subscriptionId, options);
this.list = new operations.List(this);
this.listConsole = new operations.ListConsole(this);
this.console = new operations.Console(this);
}

/**
* Gets a list of Serial Console 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.SerialConsoleOperations>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
listOperations(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.SerialConsoleOperations>): void;
listOperations(options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.SerialConsoleOperations>, callback?: msRest.ServiceCallback<Models.SerialConsoleOperations>): Promise<Models.ListOperationsResponse> {
return this.sendOperationRequest(
{
options
},
listOperationsOperationSpec,
callback) as Promise<Models.ListOperationsResponse>;
}

/**
* Gets whether or not Serial Console is disabled for a given subscription
* @summary Get the disabled status for a subscription
* @param defaultParameter Default parameter. Leave the value as "default".
* @param [options] The optional parameters
* @returns Promise<Models.GetConsoleStatusResponse>
*/
getConsoleStatus(defaultParameter: string, options?: msRest.RequestOptionsBase): Promise<Models.GetConsoleStatusResponse>;
/**
* @param defaultParameter Default parameter. Leave the value as "default".
* @param callback The callback
*/
getConsoleStatus(defaultParameter: string, callback: msRest.ServiceCallback<any>): void;
/**
* @param defaultParameter Default parameter. Leave the value as "default".
* @param options The optional parameters
* @param callback The callback
*/
getConsoleStatus(defaultParameter: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<any>): void;
getConsoleStatus(defaultParameter: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<any>, callback?: msRest.ServiceCallback<any>): Promise<Models.GetConsoleStatusResponse> {
return this.sendOperationRequest(
{
defaultParameter,
options
},
getConsoleStatusOperationSpec,
callback) as Promise<Models.GetConsoleStatusResponse>;
}

/**
* Disables the Serial Console service for all VMs and VM scale sets in the provided subscription
* @summary Disable Serial Console for a subscription
* @param defaultParameter Default parameter. Leave the value as "default".
* @param [options] The optional parameters
* @returns Promise<Models.DisableConsoleResponse>
*/
disableConsole(defaultParameter: string, options?: msRest.RequestOptionsBase): Promise<Models.DisableConsoleResponse>;
/**
* @param defaultParameter Default parameter. Leave the value as "default".
* @param callback The callback
*/
disableConsole(defaultParameter: string, callback: msRest.ServiceCallback<any>): void;
/**
* @param defaultParameter Default parameter. Leave the value as "default".
* @param options The optional parameters
* @param callback The callback
*/
disableConsole(defaultParameter: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<any>): void;
disableConsole(defaultParameter: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<any>, callback?: msRest.ServiceCallback<any>): Promise<Models.DisableConsoleResponse> {
return this.sendOperationRequest(
{
defaultParameter,
options
},
disableConsoleOperationSpec,
callback) as Promise<Models.DisableConsoleResponse>;
}

/**
* Enables the Serial Console service for all VMs and VM scale sets in the provided subscription
* @summary Enable Serial Console for a subscription
* @param defaultParameter Default parameter. Leave the value as "default".
* @param [options] The optional parameters
* @returns Promise<Models.EnableConsoleResponse>
*/
enableConsole(defaultParameter: string, options?: msRest.RequestOptionsBase): Promise<Models.EnableConsoleResponse>;
/**
* @param defaultParameter Default parameter. Leave the value as "default".
* @param callback The callback
*/
enableConsole(defaultParameter: string, callback: msRest.ServiceCallback<any>): void;
/**
* @param defaultParameter Default parameter. Leave the value as "default".
* @param options The optional parameters
* @param callback The callback
*/
enableConsole(defaultParameter: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<any>): void;
enableConsole(defaultParameter: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<any>, callback?: msRest.ServiceCallback<any>): Promise<Models.EnableConsoleResponse> {
return this.sendOperationRequest(
{
defaultParameter,
options
},
enableConsoleOperationSpec,
callback) as Promise<Models.EnableConsoleResponse>;
}
}

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

const getConsoleStatusOperationSpec: msRest.OperationSpec = {
httpMethod: "GET",
path: "subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}",
urlParameters: [
Parameters.subscriptionId,
Parameters.defaultParameter
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
responses: {
200: {
bodyMapper: Mappers.SerialConsoleStatus
},
404: {
bodyMapper: Mappers.GetSerialConsoleSubscriptionNotFound
},
default: {
bodyMapper: Mappers.CloudError
}
},
serializer
};

const disableConsoleOperationSpec: msRest.OperationSpec = {
httpMethod: "POST",
path: "subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/disableConsole",
urlParameters: [
Parameters.subscriptionId,
Parameters.defaultParameter
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
responses: {
200: {
bodyMapper: Mappers.DisableSerialConsoleResult
},
404: {
bodyMapper: Mappers.GetSerialConsoleSubscriptionNotFound
},
default: {
bodyMapper: Mappers.CloudError
}
},
serializer
};

const enableConsoleOperationSpec: msRest.OperationSpec = {
httpMethod: "POST",
path: "subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/enableConsole",
urlParameters: [
Parameters.subscriptionId,
Parameters.defaultParameter
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
responses: {
200: {
bodyMapper: Mappers.EnableSerialConsoleResult
},
404: {
bodyMapper: Mappers.GetSerialConsoleSubscriptionNotFound
},
default: {
bodyMapper: Mappers.CloudError
}
},
serializer
};

export {
MicrosoftSerialConsoleClient,
MicrosoftSerialConsoleClientContext,
Models as MicrosoftSerialConsoleModels,
Mappers as MicrosoftSerialConsoleMappers
};
export * from "./operations";
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ const packageVersion = "1.0.0";

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

/**
* Initializes a new instance of the MicrosoftSerialConsoleClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param subscriptionId The ID of the target subscription.
* @param subscriptionId Subscription ID which uniquely identifies the Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call requiring it.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MicrosoftSerialConsoleClientOptions) {
Expand Down
12 changes: 0 additions & 12 deletions sdk/serialconsole/arm-serialconsole/src/models/consoleMappers.ts

This file was deleted.

Loading