diff --git a/sdk/advisor/arm-advisor/LICENSE.txt b/sdk/advisor/arm-advisor/LICENSE.txt index a70e8cf66038..b73b4a1293c3 100644 --- a/sdk/advisor/arm-advisor/LICENSE.txt +++ b/sdk/advisor/arm-advisor/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Microsoft +Copyright (c) 2019 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 diff --git a/sdk/advisor/arm-advisor/README.md b/sdk/advisor/arm-advisor/README.md index e0632cff55c4..edfb7404cf3f 100644 --- a/sdk/advisor/arm-advisor/README.md +++ b/sdk/advisor/arm-advisor/README.md @@ -9,23 +9,23 @@ This package contains an isomorphic SDK for AdvisorManagementClient. ### How to Install -``` +```bash npm install @azure/arm-advisor ``` ### How to use -#### nodejs - Authentication, client creation and listBySubscription configurations as an example written in TypeScript. +#### nodejs - Authentication, client creation and get recommendationMetadata as an example written in TypeScript. ##### Install @azure/ms-rest-nodeauth -``` +```bash npm install @azure/ms-rest-nodeauth ``` ##### Sample code -```ts +```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"; @@ -34,7 +34,8 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; msRestNodeAuth.interactiveLogin().then((creds) => { const client = new AdvisorManagementClient(creds, subscriptionId); - client.configurations.listBySubscription().then((result) => { + const name = "testname"; + client.recommendationMetadata.get(name).then((result) => { console.log("The result is:"); console.log(result); }); @@ -43,11 +44,11 @@ msRestNodeAuth.interactiveLogin().then((creds) => { }); ``` -#### browser - Authentication, client creation and listBySubscription configurations as an example written in JavaScript. +#### browser - Authentication, client creation and get recommendationMetadata as an example written in JavaScript. ##### Install @azure/ms-rest-browserauth -``` +```bash npm install @azure/ms-rest-browserauth ``` @@ -77,7 +78,8 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to authManager.login(); } const client = new Azure.ArmAdvisor.AdvisorManagementClient(res.creds, subscriptionId); - client.configurations.listBySubscription().then((result) => { + const name = "testname"; + client.recommendationMetadata.get(name).then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { @@ -94,6 +96,3 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to ## Related projects - [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/sdk/advisor/arm-advisor/README.png) diff --git a/sdk/advisor/arm-advisor/package.json b/sdk/advisor/arm-advisor/package.json index ac17810a1a1a..8d9bef0fa979 100644 --- a/sdk/advisor/arm-advisor/package.json +++ b/sdk/advisor/arm-advisor/package.json @@ -4,8 +4,8 @@ "description": "AdvisorManagementClient Library with typescript type definitions for node.js and browser.", "version": "1.2.0", "dependencies": { - "@azure/ms-rest-azure-js": "^1.1.0", - "@azure/ms-rest-js": "^1.1.0", + "@azure/ms-rest-azure-js": "^1.3.2", + "@azure/ms-rest-js": "^1.8.1", "tslib": "^1.9.3" }, "keywords": [ @@ -23,9 +23,10 @@ "typescript": "^3.1.1", "rollup": "^0.66.2", "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.4.9" }, - "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/sdk/advisor/arm-advisor", + "homepage": "https://github.com/azure/azure-sdk-for-js", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-js.git" @@ -43,6 +44,7 @@ "esm/**/*.d.ts", "esm/**/*.d.ts.map", "src/**/*.ts", + "README.md", "rollup.config.js", "tsconfig.json" ], @@ -52,5 +54,5 @@ "prepack": "npm install && npm run build" }, "sideEffects": false, - "authPublish": true + "autoPublish": true } diff --git a/sdk/advisor/arm-advisor/rollup.config.js b/sdk/advisor/arm-advisor/rollup.config.js index 19c4680fc09c..fcf77258b920 100644 --- a/sdk/advisor/arm-advisor/rollup.config.js +++ b/sdk/advisor/arm-advisor/rollup.config.js @@ -1,10 +1,16 @@ +import rollup from "rollup"; import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + /** - * @type {import('rollup').RollupFileOptions} + * @type {rollup.RollupFileOptions} */ const config = { - input: './esm/advisorManagementClient.js', - external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"], + input: "./esm/advisorManagementClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], output: { file: "./dist/arm-advisor.js", format: "umd", @@ -16,16 +22,16 @@ const config = { }, banner: `/* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */` }, plugins: [ - nodeResolve({ module: true }) + nodeResolve({ module: true }), + sourcemaps() ] }; + export default config; diff --git a/sdk/advisor/arm-advisor/src/advisorManagementClient.ts b/sdk/advisor/arm-advisor/src/advisorManagementClient.ts index 643eaf226574..a1de4884947a 100644 --- a/sdk/advisor/arm-advisor/src/advisorManagementClient.ts +++ b/sdk/advisor/arm-advisor/src/advisorManagementClient.ts @@ -17,6 +17,7 @@ import { AdvisorManagementClientContext } from "./advisorManagementClientContext class AdvisorManagementClient extends AdvisorManagementClientContext { // Operation groups + recommendationMetadata: operations.RecommendationMetadata; configurations: operations.Configurations; recommendations: operations.Recommendations; operations: operations.Operations; @@ -30,6 +31,7 @@ class AdvisorManagementClient extends AdvisorManagementClientContext { */ constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.AdvisorManagementClientOptions) { super(credentials, subscriptionId, options); + this.recommendationMetadata = new operations.RecommendationMetadata(this); this.configurations = new operations.Configurations(this); this.recommendations = new operations.Recommendations(this); this.operations = new operations.Operations(this); diff --git a/sdk/advisor/arm-advisor/src/advisorManagementClientContext.ts b/sdk/advisor/arm-advisor/src/advisorManagementClientContext.ts index 82f5adb2547f..db1466619c1d 100644 --- a/sdk/advisor/arm-advisor/src/advisorManagementClientContext.ts +++ b/sdk/advisor/arm-advisor/src/advisorManagementClientContext.ts @@ -13,7 +13,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; const packageName = "@azure/arm-advisor"; -const packageVersion = "0.1.0"; +const packageVersion = "1.2.0"; export class AdvisorManagementClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; diff --git a/sdk/advisor/arm-advisor/src/models/configurationsMappers.ts b/sdk/advisor/arm-advisor/src/models/configurationsMappers.ts index 7e0bc956ab06..2d35d1ba9d58 100644 --- a/sdk/advisor/arm-advisor/src/models/configurationsMappers.ts +++ b/sdk/advisor/arm-advisor/src/models/configurationsMappers.ts @@ -1,18 +1,15 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export { - ConfigurationListResult, + ARMErrorResponseBody, + CloudError, ConfigData, ConfigDataProperties, - CloudError, - ARMErrorResponseBody + ConfigurationListResult } from "../models/mappers"; - diff --git a/sdk/advisor/arm-advisor/src/models/index.ts b/sdk/advisor/arm-advisor/src/models/index.ts index 21d9a82bd89e..f862bbe89ac1 100644 --- a/sdk/advisor/arm-advisor/src/models/index.ts +++ b/sdk/advisor/arm-advisor/src/models/index.ts @@ -1,11 +1,9 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; @@ -13,385 +11,369 @@ import * as msRest from "@azure/ms-rest-js"; export { BaseResource, CloudError }; +/** + * The metadata supported value detail. + */ +export interface MetadataSupportedValueDetail { + /** + * The id. + */ + id?: string; + /** + * The display name. + */ + displayName?: string; +} + +/** + * The metadata entity contract. + */ +export interface MetadataEntity { + /** + * The resource Id of the metadata entity. + */ + id?: string; + /** + * The type of the metadata entity. + */ + type?: string; + /** + * The name of the metadata entity. + */ + name?: string; + /** + * The display name. + */ + displayName?: string; + /** + * The list of keys on which this entity depends on. + */ + dependsOn?: string[]; + /** + * The list of scenarios applicable to this metadata entity. + */ + applicableScenarios?: Scenario[]; + /** + * The list of supported values. + */ + supportedValues?: MetadataSupportedValueDetail[]; +} /** - * @interface - * An interface representing ConfigDataProperties. * The list of property name/value pairs. - * */ export interface ConfigDataProperties { /** - * @member {boolean} [exclude] Exclude the resource from Advisor evaluations. - * Valid values: False (default) or True. + * Exclude the resource from Advisor evaluations. Valid values: False (default) or True. */ exclude?: boolean; /** - * @member {string} [lowCpuThreshold] Minimum percentage threshold for - * Advisor low CPU utilization evaluation. Valid only for subscriptions. - * Valid values: 5 (default), 10, 15 or 20. + * Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for + * subscriptions. Valid values: 5 (default), 10, 15 or 20. */ lowCpuThreshold?: string; /** - * @property Describes unknown properties. The value of an unknown property - * can be of "any" type. + * Describes unknown properties. The value of an unknown property can be of "any" type. */ [property: string]: any; } /** - * @interface - * An interface representing ConfigData. * The Advisor configuration data structure. - * */ export interface ConfigData { /** - * @member {string} [id] The resource Id of the configuration resource. + * The resource Id of the configuration resource. */ id?: string; /** - * @member {string} [type] The type of the configuration resource. + * The type of the configuration resource. */ type?: string; /** - * @member {string} [name] The name of the configuration resource. + * The name of the configuration resource. */ name?: string; /** - * @member {ConfigDataProperties} [properties] The list of property - * name/value pairs. + * The list of property name/value pairs. */ properties?: ConfigDataProperties; } /** - * @interface - * An interface representing ARMErrorResponseBody. * ARM error response body. - * */ export interface ARMErrorResponseBody { /** - * @member {string} [message] Gets or sets the string that describes the - * error in detail and provides debugging information. + * Gets or sets the string that describes the error in detail and provides debugging information. */ message?: string; /** - * @member {string} [code] Gets or sets the string that can be used to - * programmatically identify the error. + * Gets or sets the string that can be used to programmatically identify the error. */ code?: string; } /** - * @interface - * An interface representing ShortDescription. * A summary of the recommendation. - * */ export interface ShortDescription { /** - * @member {string} [problem] The issue or opportunity identified by the - * recommendation. + * The issue or opportunity identified by the recommendation. */ problem?: string; /** - * @member {string} [solution] The remediation action suggested by the - * recommendation. + * The remediation action suggested by the recommendation. */ solution?: string; } /** - * @interface - * An interface representing Resource. * An Azure resource. - * - * @extends BaseResource */ export interface Resource extends BaseResource { /** - * @member {string} [id] The resource ID. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The resource ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly id?: string; /** - * @member {string} [name] The name of the resource. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The name of the resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly name?: string; /** - * @member {string} [type] The type of the resource. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The type of the resource. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly type?: string; } /** - * @interface - * An interface representing ResourceRecommendationBase. * Advisor Recommendation. - * - * @extends Resource */ export interface ResourceRecommendationBase extends Resource { /** - * @member {Category} [category] The category of the recommendation. Possible - * values include: 'HighAvailability', 'Security', 'Performance', 'Cost' + * The category of the recommendation. Possible values include: 'HighAvailability', 'Security', + * 'Performance', 'Cost' */ category?: Category; /** - * @member {Impact} [impact] The business impact of the recommendation. - * Possible values include: 'High', 'Medium', 'Low' + * The business impact of the recommendation. Possible values include: 'High', 'Medium', 'Low' */ impact?: Impact; /** - * @member {string} [impactedField] The resource type identified by Advisor. + * The resource type identified by Advisor. */ impactedField?: string; /** - * @member {string} [impactedValue] The resource identified by Advisor. + * The resource identified by Advisor. */ impactedValue?: string; /** - * @member {Date} [lastUpdated] The most recent time that Advisor checked the - * validity of the recommendation. + * The most recent time that Advisor checked the validity of the recommendation. */ lastUpdated?: Date; /** - * @member {{ [propertyName: string]: any }} [metadata] The recommendation - * metadata. + * The recommendation metadata. */ metadata?: { [propertyName: string]: any }; /** - * @member {string} [recommendationTypeId] The recommendation-type GUID. + * The recommendation-type GUID. */ recommendationTypeId?: string; /** - * @member {Risk} [risk] The potential risk of not implementing the - * recommendation. Possible values include: 'Error', 'Warning', 'None' + * The potential risk of not implementing the recommendation. Possible values include: 'Error', + * 'Warning', 'None' */ risk?: Risk; /** - * @member {ShortDescription} [shortDescription] A summary of the - * recommendation. + * A summary of the recommendation. */ shortDescription?: ShortDescription; /** - * @member {string[]} [suppressionIds] The list of snoozed and dismissed - * rules for the recommendation. + * The list of snoozed and dismissed rules for the recommendation. */ suppressionIds?: string[]; /** - * @member {{ [propertyName: string]: string }} [extendedProperties] Extended - * properties + * Extended properties */ extendedProperties?: { [propertyName: string]: string }; } /** - * @interface - * An interface representing OperationDisplayInfo. * The operation supported by Advisor. - * */ export interface OperationDisplayInfo { /** - * @member {string} [description] The description of the operation. + * The description of the operation. */ description?: string; /** - * @member {string} [operation] The action that users can perform, based on - * their permission level. + * The action that users can perform, based on their permission level. */ operation?: string; /** - * @member {string} [provider] Service provider: Microsoft Advisor. + * Service provider: Microsoft Advisor. */ provider?: string; /** - * @member {string} [resource] Resource on which the operation is performed. + * Resource on which the operation is performed. */ resource?: string; } /** - * @interface - * An interface representing OperationEntity. * The operation supported by Advisor. - * */ export interface OperationEntity { /** - * @member {string} [name] Operation name: {provider}/{resource}/{operation}. + * Operation name: {provider}/{resource}/{operation}. */ name?: string; /** - * @member {OperationDisplayInfo} [display] The operation supported by - * Advisor. + * The operation supported by Advisor. */ display?: OperationDisplayInfo; } /** - * @interface - * An interface representing SuppressionContract. - * The details of the snoozed or dismissed rule; for example, the duration, - * name, and GUID associated with the rule. - * - * @extends Resource + * The details of the snoozed or dismissed rule; for example, the duration, name, and GUID + * associated with the rule. */ export interface SuppressionContract extends Resource { /** - * @member {string} [suppressionId] The GUID of the suppression. + * The GUID of the suppression. */ suppressionId?: string; /** - * @member {string} [ttl] The duration for which the suppression is valid. + * The duration for which the suppression is valid. */ ttl?: string; } /** - * @interface - * An interface representing RecommendationsListOptionalParams. * Optional Parameters. - * - * @extends RequestOptionsBase */ export interface RecommendationsListOptionalParams extends msRest.RequestOptionsBase { /** - * @member {string} [filter] The filter to apply to the recommendations. + * The filter to apply to the recommendations. */ filter?: string; /** - * @member {number} [top] The number of recommendations per page if a paged - * version of this API is being used. + * The number of recommendations per page if a paged version of this API is being used. */ top?: number; /** - * @member {string} [skipToken] The page-continuation token to use with a - * paged version of this API. + * The page-continuation token to use with a paged version of this API. */ skipToken?: string; } /** - * @interface - * An interface representing SuppressionsListOptionalParams. * Optional Parameters. - * - * @extends RequestOptionsBase */ export interface SuppressionsListOptionalParams extends msRest.RequestOptionsBase { /** - * @member {number} [top] The number of suppressions per page if a paged - * version of this API is being used. + * The number of suppressions per page if a paged version of this API is being used. */ top?: number; /** - * @member {string} [skipToken] The page-continuation token to use with a - * paged version of this API. + * The page-continuation token to use with a paged version of this API. */ skipToken?: string; } /** - * @interface * An interface representing AdvisorManagementClientOptions. - * @extends AzureServiceClientOptions */ export interface AdvisorManagementClientOptions extends AzureServiceClientOptions { - /** - * @member {string} [baseUri] - */ baseUri?: string; } /** - * @interface - * An interface representing RecommendationsGenerateHeaders. * Defines headers for Generate operation. - * */ export interface RecommendationsGenerateHeaders { /** - * @member {string} [location] The URL where the status of the asynchronous - * operation can be checked. + * The URL where the status of the asynchronous operation can be checked. */ location: string; /** - * @member {string} [retryAfter] The amount of delay to use while the status - * of the operation is checked. The value is expressed in seconds. + * The amount of delay to use while the status of the operation is checked. The value is + * expressed in seconds. */ retryAfter: string; } +/** + * @interface + * The list of metadata entities + * @extends Array + */ +export interface MetadataEntityListResult extends Array { + /** + * The link used to get the next page of metadata. + */ + nextLink?: string; +} /** * @interface - * An interface representing the ConfigurationListResult. * The list of Advisor configurations. - * * @extends Array */ export interface ConfigurationListResult extends Array { /** - * @member {string} [nextLink] The link used to get the next page of - * configurations. + * The link used to get the next page of configurations. */ nextLink?: string; } /** * @interface - * An interface representing the ResourceRecommendationBaseListResult. * The list of Advisor recommendations. - * * @extends Array */ export interface ResourceRecommendationBaseListResult extends Array { /** - * @member {string} [nextLink] The link used to get the next page of - * recommendations. + * The link used to get the next page of recommendations. */ nextLink?: string; } /** * @interface - * An interface representing the OperationEntityListResult. * The list of Advisor operations. - * * @extends Array */ export interface OperationEntityListResult extends Array { /** - * @member {string} [nextLink] The link used to get the next page of - * operations. + * The link used to get the next page of operations. */ nextLink?: string; } /** * @interface - * An interface representing the SuppressionContractListResult. * The list of Advisor suppressions. - * * @extends Array */ export interface SuppressionContractListResult extends Array { /** - * @member {string} [nextLink] The link used to get the next page of - * suppressions. + * The link used to get the next page of suppressions. */ nextLink?: string; } +/** + * Defines values for Scenario. + * Possible values include: 'Alerts' + * @readonly + * @enum {string} + */ +export type Scenario = 'Alerts'; + /** * Defines values for Category. * Possible values include: 'HighAvailability', 'Security', 'Performance', 'Cost' @@ -416,6 +398,71 @@ export type Impact = 'High' | 'Medium' | 'Low'; */ export type Risk = 'Error' | 'Warning' | 'None'; +/** + * Contains response data for the get operation. + */ +export type RecommendationMetadataGetResponse = { + /** + * The parsed response body. + */ + body: any; + + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: any; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type RecommendationMetadataListResponse = MetadataEntityListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetadataEntityListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type RecommendationMetadataListNextResponse = MetadataEntityListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetadataEntityListResult; + }; +}; + /** * Contains response data for the listBySubscription operation. */ @@ -428,6 +475,7 @@ export type ConfigurationsListBySubscriptionResponse = ConfigurationListResult & * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -447,6 +495,7 @@ export type ConfigurationsCreateInSubscriptionResponse = ARMErrorResponseBody & * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -466,6 +515,7 @@ export type ConfigurationsListByResourceGroupResponse = ConfigurationListResult * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -485,6 +535,7 @@ export type ConfigurationsCreateInResourceGroupResponse = ARMErrorResponseBody & * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -504,6 +555,7 @@ export type ConfigurationsListBySubscriptionNextResponse = ConfigurationListResu * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -538,6 +590,7 @@ export type RecommendationsListResponse = ResourceRecommendationBaseListResult & * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -557,6 +610,7 @@ export type RecommendationsGetResponse = ResourceRecommendationBase & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -576,6 +630,7 @@ export type RecommendationsListNextResponse = ResourceRecommendationBaseListResu * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -595,6 +650,7 @@ export type OperationsListResponse = OperationEntityListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -614,6 +670,7 @@ export type OperationsListNextResponse = OperationEntityListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -633,6 +690,7 @@ export type SuppressionsGetResponse = SuppressionContract & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -652,6 +710,7 @@ export type SuppressionsCreateResponse = SuppressionContract & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -671,6 +730,7 @@ export type SuppressionsListResponse = SuppressionContractListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -690,6 +750,7 @@ export type SuppressionsListNextResponse = SuppressionContractListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ diff --git a/sdk/advisor/arm-advisor/src/models/mappers.ts b/sdk/advisor/arm-advisor/src/models/mappers.ts index ffd0fb954f60..ce21d9aba217 100644 --- a/sdk/advisor/arm-advisor/src/models/mappers.ts +++ b/sdk/advisor/arm-advisor/src/models/mappers.ts @@ -1,11 +1,9 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; @@ -14,6 +12,96 @@ import * as msRest from "@azure/ms-rest-js"; export const CloudError = CloudErrorMapper; export const BaseResource = BaseResourceMapper; +export const MetadataSupportedValueDetail: msRest.CompositeMapper = { + serializedName: "MetadataSupportedValueDetail", + type: { + name: "Composite", + className: "MetadataSupportedValueDetail", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + } + } + } +}; + +export const MetadataEntity: msRest.CompositeMapper = { + serializedName: "MetadataEntity", + type: { + name: "Composite", + className: "MetadataEntity", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + dependsOn: { + serializedName: "properties.dependsOn", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + applicableScenarios: { + serializedName: "properties.applicableScenarios", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + supportedValues: { + serializedName: "properties.supportedValues", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataSupportedValueDetail" + } + } + } + } + } + } +}; + export const ConfigDataProperties: msRest.CompositeMapper = { serializedName: "ConfigData_properties", type: { @@ -351,6 +439,34 @@ export const RecommendationsGenerateHeaders: msRest.CompositeMapper = { } }; +export const MetadataEntityListResult: msRest.CompositeMapper = { + serializedName: "MetadataEntityListResult", + type: { + name: "Composite", + className: "MetadataEntityListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataEntity" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + export const ConfigurationListResult: msRest.CompositeMapper = { serializedName: "ConfigurationListResult", type: { diff --git a/sdk/advisor/arm-advisor/src/models/operationsMappers.ts b/sdk/advisor/arm-advisor/src/models/operationsMappers.ts index aba5d8bf047b..c83dbeabcc21 100644 --- a/sdk/advisor/arm-advisor/src/models/operationsMappers.ts +++ b/sdk/advisor/arm-advisor/src/models/operationsMappers.ts @@ -1,17 +1,14 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export { - OperationEntityListResult, - OperationEntity, + CloudError, OperationDisplayInfo, - CloudError + OperationEntity, + OperationEntityListResult } from "../models/mappers"; - diff --git a/sdk/advisor/arm-advisor/src/models/recommendationMetadataMappers.ts b/sdk/advisor/arm-advisor/src/models/recommendationMetadataMappers.ts new file mode 100644 index 000000000000..fca081125f33 --- /dev/null +++ b/sdk/advisor/arm-advisor/src/models/recommendationMetadataMappers.ts @@ -0,0 +1,15 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + ARMErrorResponseBody, + CloudError, + MetadataEntity, + MetadataEntityListResult, + MetadataSupportedValueDetail +} from "../models/mappers"; diff --git a/sdk/advisor/arm-advisor/src/models/recommendationsMappers.ts b/sdk/advisor/arm-advisor/src/models/recommendationsMappers.ts index f7c5c9df26b7..c9febbb8f299 100644 --- a/sdk/advisor/arm-advisor/src/models/recommendationsMappers.ts +++ b/sdk/advisor/arm-advisor/src/models/recommendationsMappers.ts @@ -1,21 +1,18 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export { - RecommendationsGenerateHeaders, + BaseResource, CloudError, - ResourceRecommendationBaseListResult, - ResourceRecommendationBase, + RecommendationsGenerateHeaders, Resource, - BaseResource, + ResourceRecommendationBase, + ResourceRecommendationBaseListResult, ShortDescription, SuppressionContract } from "../models/mappers"; - diff --git a/sdk/advisor/arm-advisor/src/models/suppressionsMappers.ts b/sdk/advisor/arm-advisor/src/models/suppressionsMappers.ts index dd0d5a4133d7..0fc61875468e 100644 --- a/sdk/advisor/arm-advisor/src/models/suppressionsMappers.ts +++ b/sdk/advisor/arm-advisor/src/models/suppressionsMappers.ts @@ -1,20 +1,17 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export { - SuppressionContract, - Resource, BaseResource, CloudError, - SuppressionContractListResult, + Resource, ResourceRecommendationBase, - ShortDescription + ShortDescription, + SuppressionContract, + SuppressionContractListResult } from "../models/mappers"; - diff --git a/sdk/advisor/arm-advisor/src/operations/index.ts b/sdk/advisor/arm-advisor/src/operations/index.ts index 0b5134141fb7..1b2399089695 100644 --- a/sdk/advisor/arm-advisor/src/operations/index.ts +++ b/sdk/advisor/arm-advisor/src/operations/index.ts @@ -8,6 +8,7 @@ * regenerated. */ +export * from "./recommendationMetadata"; export * from "./configurations"; export * from "./recommendations"; export * from "./operations"; diff --git a/sdk/advisor/arm-advisor/src/operations/recommendationMetadata.ts b/sdk/advisor/arm-advisor/src/operations/recommendationMetadata.ts new file mode 100644 index 000000000000..487abe86bdca --- /dev/null +++ b/sdk/advisor/arm-advisor/src/operations/recommendationMetadata.ts @@ -0,0 +1,177 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 Models from "../models"; +import * as Mappers from "../models/recommendationMetadataMappers"; +import * as Parameters from "../models/parameters"; +import { AdvisorManagementClientContext } from "../advisorManagementClientContext"; + +/** Class representing a RecommendationMetadata. */ +export class RecommendationMetadata { + private readonly client: AdvisorManagementClientContext; + + /** + * Create a RecommendationMetadata. + * @param {AdvisorManagementClientContext} client Reference to the service client. + */ + constructor(client: AdvisorManagementClientContext) { + this.client = client; + } + + /** + * @summary Gets the metadata entity. + * @param name Name of metadata entity. + * @param [options] The optional parameters + * @returns Promise + */ + get(name: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param name Name of metadata entity. + * @param callback The callback + */ + get(name: string, callback: msRest.ServiceCallback): void; + /** + * @param name Name of metadata entity. + * @param options The optional parameters + * @param callback The callback + */ + get(name: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(name: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + name, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * @summary Gets the list of metadata entities. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * @summary Gets the list of metadata entities. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Advisor/metadata/{name}", + urlParameters: [ + Parameters.name + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.MetadataEntity + }, + 404: { + bodyMapper: Mappers.ARMErrorResponseBody + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Advisor/metadata", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.MetadataEntityListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.MetadataEntityListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +};