Skip to content
Merged
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
10 changes: 6 additions & 4 deletions sdk/advisor/arm-advisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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

Expand All @@ -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);
});
Expand All @@ -43,7 +44,7 @@ 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

Expand Down Expand Up @@ -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) => {
Expand Down
2 changes: 2 additions & 0 deletions sdk/advisor/arm-advisor/lib/advisorManagementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
128 changes: 128 additions & 0 deletions sdk/advisor/arm-advisor/lib/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,58 @@ import * as msRest from "@azure/ms-rest-js";
export { BaseResource, CloudError };


/**
* @interface
* An interface representing MetadataSupportedValueDetail.
* The metadata supported value detail.
*
*/
export interface MetadataSupportedValueDetail {
/**
* @member {string} [id] The id.
*/
id?: string;
/**
* @member {string} [displayName] The display name.
*/
displayName?: string;
}

/**
* @interface
* An interface representing MetadataEntity.
* The metadata entity contract.
*
*/
export interface MetadataEntity {
/**
* @member {string} [id] The resource Id of the metadata entity.
*/
id?: string;
/**
* @member {string} [type] The type of the metadata entity.
*/
type?: string;
/**
* @member {string} [name] The name of the metadata entity.
*/
name?: string;
/**
* @member {string} [displayName] The display name.
*/
displayName?: string;
/**
* @member {string[]} [dependsOn] The list of keys on which this entity
* depends on.
*/
dependsOn?: string[];
/**
* @member {MetadataSupportedValueDetail[]} [supportedValues] The list of
* supported values.
*/
supportedValues?: MetadataSupportedValueDetail[];
}

/**
* @interface
* An interface representing ConfigDataProperties.
Expand Down Expand Up @@ -332,6 +384,21 @@ export interface RecommendationsGenerateHeaders {
}


/**
* @interface
* An interface representing the MetadataEntityListResult.
* The list of metadata entities
*
* @extends Array<MetadataEntity>
*/
export interface MetadataEntityListResult extends Array<MetadataEntity> {
/**
* @member {string} [nextLink] The link used to get the next page of
* metadata.
*/
nextLink?: string;
}

/**
* @interface
* An interface representing the ConfigurationListResult.
Expand Down Expand Up @@ -416,6 +483,67 @@ 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.
*/
Expand Down
107 changes: 107 additions & 0 deletions sdk/advisor/arm-advisor/lib/models/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,85 @@ 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"
}
}
}
},
supportedValues: {
serializedName: "properties.supportedValues",
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "MetadataSupportedValueDetail"
}
}
}
}
}
}
};

export const ConfigDataProperties: msRest.CompositeMapper = {
serializedName: "ConfigData_properties",
type: {
Expand Down Expand Up @@ -351,6 +430,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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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 {
MetadataEntity,
MetadataSupportedValueDetail,
ARMErrorResponseBody,
CloudError,
MetadataEntityListResult
} from "../models/mappers";

1 change: 1 addition & 0 deletions sdk/advisor/arm-advisor/lib/operations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* regenerated.
*/

export * from "./recommendationMetadata";
export * from "./configurations";
export * from "./recommendations";
export * from "./operations";
Expand Down
Loading