diff --git a/sdk/resourcegraph/arm-resourcegraph/LICENSE.txt b/sdk/resourcegraph/arm-resourcegraph/LICENSE.txt index b73b4a1293c3..2d3163745319 100644 --- a/sdk/resourcegraph/arm-resourcegraph/LICENSE.txt +++ b/sdk/resourcegraph/arm-resourcegraph/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 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 diff --git a/sdk/resourcegraph/arm-resourcegraph/README.md b/sdk/resourcegraph/arm-resourcegraph/README.md index d7b46347f758..b12be35165b5 100644 --- a/sdk/resourcegraph/arm-resourcegraph/README.md +++ b/sdk/resourcegraph/arm-resourcegraph/README.md @@ -15,21 +15,21 @@ npm install @azure/arm-resourcegraph ### How to use -#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. +#### nodejs - client creation and list operations 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 +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 { ResourceGraphClient, ResourceGraphModels, ResourceGraphMappers } from "@azure/arm-resourcegraph"; +const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; msRestNodeAuth.interactiveLogin().then((creds) => { @@ -95,4 +95,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%2Fresourcegraph%2Farm-resourcegraph%2FREADME.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/resourcegraph/arm-resourcegraph/README.png) diff --git a/sdk/resourcegraph/arm-resourcegraph/package.json b/sdk/resourcegraph/arm-resourcegraph/package.json index 86f2225cdcc8..0111bfa65edb 100644 --- a/sdk/resourcegraph/arm-resourcegraph/package.json +++ b/sdk/resourcegraph/arm-resourcegraph/package.json @@ -4,9 +4,9 @@ "description": "ResourceGraphClient Library with typescript type definitions for node.js and browser.", "version": "2.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", @@ -20,11 +20,11 @@ "module": "./esm/resourceGraphClient.js", "types": "./esm/resourceGraphClient.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/tree/master/sdk/resourcegraph/arm-resourcegraph", "repository": { diff --git a/sdk/resourcegraph/arm-resourcegraph/rollup.config.js b/sdk/resourcegraph/arm-resourcegraph/rollup.config.js index b2e2e088daec..b4a13e4ff3f9 100644 --- a/sdk/resourcegraph/arm-resourcegraph/rollup.config.js +++ b/sdk/resourcegraph/arm-resourcegraph/rollup.config.js @@ -21,15 +21,15 @@ 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. */` }, plugins: [ - nodeResolve({ module: true }), + nodeResolve({ mainFields: ['module', 'main'] }), sourcemaps() ] }; diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts index a14379f6e8f6..e4d33695e92f 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts @@ -1,6 +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 regenerated. @@ -11,6 +11,241 @@ import * as msRest from "@azure/ms-rest-js"; export { BaseResource, CloudError }; +/** + * An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. + * `[start, end)`. + */ +export interface DateTimeInterval { + /** + * A datetime indicating the inclusive/closed start of the time interval, i.e. `[`**`start`**`, + * end)`. Specifying a `start` that occurs chronologically after `end` will result in an error. + */ + start: Date; + /** + * A datetime indicating the exclusive/open end of the time interval, i.e. `[start, + * `**`end`**`)`. Specifying an `end` that occurs chronologically before `start` will result in + * an error. + */ + end: Date; +} + +/** + * Specifies the date and time interval for a changes request. + */ +export interface ResourceChangesRequestParametersInterval extends DateTimeInterval { +} + +/** + * The parameters for a specific changes request. + */ +export interface ResourceChangesRequestParameters { + /** + * Specifies the list of resources for a changes request. + */ + resourceIds?: string[]; + /** + * The subscription id of resources to query the changes from. + */ + subscriptionId?: string; + /** + * Specifies the date and time interval for a changes request. + */ + interval: ResourceChangesRequestParametersInterval; + /** + * Acts as the continuation token for paged responses. + */ + skipToken?: string; + /** + * The maximum number of changes the client can accept in a paged response. + */ + top?: number; + /** + * The table name to query resources from. + */ + table?: string; + /** + * The flag if set to true will fetch property changes + */ + fetchPropertyChanges?: boolean; + /** + * The flag if set to true will fetch change snapshots + */ + fetchSnapshots?: boolean; +} + +/** + * Data on a specific resource snapshot. + */ +export interface ResourceSnapshotData { + /** + * The ID of the snapshot. + */ + snapshotId?: string; + /** + * The time when the snapshot was created. + * The snapshot timestamp provides an approximation as to when a modification to a resource was + * detected. There can be a difference between the actual modification time and the detection + * time. This is due to differences in how operations that modify a resource are processed, + * versus how operation that record resource snapshots are processed. + */ + timestamp: Date; + /** + * The resource snapshot content (in resourceChangeDetails response only). + */ + content?: any; +} + +/** + * The snapshot before the change. + */ +export interface ResourceChangeDataBeforeSnapshot extends ResourceSnapshotData { +} + +/** + * The snapshot after the change. + */ +export interface ResourceChangeDataAfterSnapshot extends ResourceSnapshotData { +} + +/** + * The resource property change + */ +export interface ResourcePropertyChange { + /** + * The property name + */ + propertyName: string; + /** + * The property value in before snapshot + */ + beforeValue?: string; + /** + * The property value in after snapshot + */ + afterValue?: string; + /** + * The change category. Possible values include: 'User', 'System' + */ + changeCategory: ChangeCategory; + /** + * The property change Type. Possible values include: 'Insert', 'Update', 'Remove' + */ + propertyChangeType: PropertyChangeType; +} + +/** + * Data on a specific change, represented by a pair of before and after resource snapshots. + */ +export interface ResourceChangeData { + /** + * The resource for a change. + */ + resourceId?: string; + /** + * The change ID. Valid and unique within the specified resource only. + */ + changeId: string; + /** + * The snapshot before the change. + */ + beforeSnapshot: ResourceChangeDataBeforeSnapshot; + /** + * The snapshot after the change. + */ + afterSnapshot: ResourceChangeDataAfterSnapshot; + /** + * The change type for snapshot. PropertyChanges will be provided in case of Update change type. + * Possible values include: 'Create', 'Update', 'Delete' + */ + changeType?: ChangeType; + /** + * An array of resource property change + */ + propertyChanges?: ResourcePropertyChange[]; +} + +/** + * A list of changes associated with a resource over a specific time interval. + */ +export interface ResourceChangeList { + /** + * The pageable value returned by the operation, i.e. a list of changes to the resource. + * + * - The list is ordered from the most recent changes to the least recent changes. + * - This list will be empty if there were no changes during the requested interval. + * - The `Before` snapshot timestamp value of the oldest change can be outside of the specified + * time interval. + */ + changes?: ResourceChangeData[]; + /** + * Skip token that encodes the skip information while executing the current request + */ + skipToken?: any; +} + +/** + * The parameters for a specific change details request. + */ +export interface ResourceChangeDetailsRequestParameters { + /** + * Specifies the list of resources for a change details request. + */ + resourceIds: string[]; + /** + * Specifies the list of change IDs for a change details request. + */ + changeIds: string[]; +} + +/** + * An interface representing ErrorDetails. + * @summary Error details. + */ +export interface ErrorDetails { + /** + * Error code identifying the specific error. + */ + code: string; + /** + * A human readable error message. + */ + message: string; + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; +} + +/** + * Error details. + * @summary Error info. + */ +export interface ErrorModel { + /** + * Error code identifying the specific error. + */ + code: string; + /** + * A human readable error message. + */ + message: string; + /** + * Error details + */ + details?: ErrorDetails[]; +} + +/** + * An error response from the API. + * @summary Error response. + */ +export interface ErrorResponse { + /** + * Error information. + */ + error: ErrorModel; +} + /** * The options for query evaluation */ @@ -81,7 +316,11 @@ export interface QueryRequest { /** * Azure subscriptions against which to execute the query. */ - subscriptions: string[]; + subscriptions?: string[]; + /** + * The management group identifier. + */ + managementGroupId?: string; /** * The resources query. */ @@ -202,25 +441,6 @@ export interface FacetResult { data: any; } -/** - * An interface representing ErrorDetails. - * @summary Error details. - */ -export interface ErrorDetails { - /** - * Error code identifying the specific error. - */ - code: string; - /** - * A human readable error message. - */ - message: string; - /** - * Describes unknown properties. The value of an unknown property can be of "any" type. - */ - [property: string]: any; -} - /** * A facet whose execution resulted in an error. */ @@ -239,36 +459,6 @@ export interface FacetError { errors: ErrorDetails[]; } -/** - * Error details. - * @summary Error info. - */ -export interface ErrorModel { - /** - * Error code identifying the specific error. - */ - code: string; - /** - * A human readable error message. - */ - message: string; - /** - * Error details - */ - details?: ErrorDetails[]; -} - -/** - * An error response from the API. - * @summary Error response. - */ -export interface ErrorResponse { - /** - * Error information. - */ - error: ErrorModel; -} - /** * Display metadata associated with the operation. */ @@ -309,6 +499,30 @@ export interface Operation { origin?: string; } +/** + * An interface representing ResourcesHistoryRequestOptions. + */ +export interface ResourcesHistoryRequestOptions { + interval?: DateTimeInterval; + top?: number; + skip?: number; + skipToken?: string; + /** + * Possible values include: 'table', 'objectArray' + */ + resultFormat?: ResultFormat1; +} + +/** + * An interface representing ResourcesHistoryRequest. + */ +export interface ResourcesHistoryRequest { + subscriptions?: string[]; + query?: string; + options?: ResourcesHistoryRequestOptions; + managementGroupId?: string; +} + /** * An interface representing ResourceGraphClientOptions. */ @@ -325,6 +539,30 @@ export interface ResourceGraphClientOptions extends AzureServiceClientOptions { export interface OperationListResult extends Array { } +/** + * Defines values for ChangeType. + * Possible values include: 'Create', 'Update', 'Delete' + * @readonly + * @enum {string} + */ +export type ChangeType = 'Create' | 'Update' | 'Delete'; + +/** + * Defines values for ChangeCategory. + * Possible values include: 'User', 'System' + * @readonly + * @enum {string} + */ +export type ChangeCategory = 'User' | 'System'; + +/** + * Defines values for PropertyChangeType. + * Possible values include: 'Insert', 'Update', 'Remove' + * @readonly + * @enum {string} + */ +export type PropertyChangeType = 'Insert' | 'Update' | 'Remove'; + /** * Defines values for ResultFormat. * Possible values include: 'table', 'objectArray' @@ -357,6 +595,54 @@ export type ResultTruncated = 'true' | 'false'; */ export type ColumnDataType = 'string' | 'integer' | 'number' | 'boolean' | 'object'; +/** + * Defines values for ResultFormat1. + * Possible values include: 'table', 'objectArray' + * @readonly + * @enum {string} + */ +export type ResultFormat1 = 'table' | 'objectArray'; + +/** + * Contains response data for the resourceChanges operation. + */ +export type ResourceChangesResponse = ResourceChangeList & { + /** + * 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: ResourceChangeList; + }; +}; + +/** + * Contains response data for the resourceChangeDetails operation. + */ +export type ResourceChangeDetailsResponse = Array & { + /** + * 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: ResourceChangeData[]; + }; +}; + /** * Contains response data for the resources operation. */ @@ -377,6 +663,31 @@ export type ResourcesResponse = QueryResponse & { }; }; +/** + * Contains response data for the resourcesHistory operation. + */ +export type ResourcesHistoryResponse = { + /** + * 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. */ diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts index 13a1ca9222d6..541248955e90 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts @@ -1,6 +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 regenerated. @@ -12,6 +12,425 @@ import * as msRest from "@azure/ms-rest-js"; export const CloudError = CloudErrorMapper; export const BaseResource = BaseResourceMapper; +export const DateTimeInterval: msRest.CompositeMapper = { + serializedName: "DateTimeInterval", + type: { + name: "Composite", + className: "DateTimeInterval", + modelProperties: { + start: { + required: true, + serializedName: "start", + type: { + name: "DateTime" + } + }, + end: { + required: true, + serializedName: "end", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ResourceChangesRequestParametersInterval: msRest.CompositeMapper = { + serializedName: "ResourceChangesRequestParameters_interval", + type: { + name: "Composite", + className: "ResourceChangesRequestParametersInterval", + modelProperties: { + ...DateTimeInterval.type.modelProperties + } + } +}; + +export const ResourceChangesRequestParameters: msRest.CompositeMapper = { + serializedName: "ResourceChangesRequestParameters", + type: { + name: "Composite", + className: "ResourceChangesRequestParameters", + modelProperties: { + resourceIds: { + serializedName: "resourceIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + subscriptionId: { + serializedName: "subscriptionId", + type: { + name: "String" + } + }, + interval: { + required: true, + serializedName: "interval", + type: { + name: "Composite", + className: "ResourceChangesRequestParametersInterval" + } + }, + skipToken: { + serializedName: "$skipToken", + type: { + name: "String" + } + }, + top: { + serializedName: "$top", + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + type: { + name: "Number" + } + }, + table: { + serializedName: "table", + type: { + name: "String" + } + }, + fetchPropertyChanges: { + serializedName: "fetchPropertyChanges", + type: { + name: "Boolean" + } + }, + fetchSnapshots: { + serializedName: "fetchSnapshots", + type: { + name: "Boolean" + } + } + } + } +}; + +export const ResourceSnapshotData: msRest.CompositeMapper = { + serializedName: "ResourceSnapshotData", + type: { + name: "Composite", + className: "ResourceSnapshotData", + modelProperties: { + snapshotId: { + serializedName: "snapshotId", + type: { + name: "String" + } + }, + timestamp: { + required: true, + serializedName: "timestamp", + type: { + name: "DateTime" + } + }, + content: { + serializedName: "content", + type: { + name: "Object" + } + } + } + } +}; + +export const ResourceChangeDataBeforeSnapshot: msRest.CompositeMapper = { + serializedName: "ResourceChangeData_beforeSnapshot", + type: { + name: "Composite", + className: "ResourceChangeDataBeforeSnapshot", + modelProperties: { + ...ResourceSnapshotData.type.modelProperties + } + } +}; + +export const ResourceChangeDataAfterSnapshot: msRest.CompositeMapper = { + serializedName: "ResourceChangeData_afterSnapshot", + type: { + name: "Composite", + className: "ResourceChangeDataAfterSnapshot", + modelProperties: { + ...ResourceSnapshotData.type.modelProperties + } + } +}; + +export const ResourcePropertyChange: msRest.CompositeMapper = { + serializedName: "ResourcePropertyChange", + type: { + name: "Composite", + className: "ResourcePropertyChange", + modelProperties: { + propertyName: { + required: true, + serializedName: "propertyName", + type: { + name: "String" + } + }, + beforeValue: { + serializedName: "beforeValue", + type: { + name: "String" + } + }, + afterValue: { + serializedName: "afterValue", + type: { + name: "String" + } + }, + changeCategory: { + required: true, + serializedName: "changeCategory", + type: { + name: "Enum", + allowedValues: [ + "User", + "System" + ] + } + }, + propertyChangeType: { + required: true, + serializedName: "propertyChangeType", + type: { + name: "Enum", + allowedValues: [ + "Insert", + "Update", + "Remove" + ] + } + } + } + } +}; + +export const ResourceChangeData: msRest.CompositeMapper = { + serializedName: "ResourceChangeData", + type: { + name: "Composite", + className: "ResourceChangeData", + modelProperties: { + resourceId: { + serializedName: "resourceId", + type: { + name: "String" + } + }, + changeId: { + required: true, + serializedName: "changeId", + type: { + name: "String" + } + }, + beforeSnapshot: { + required: true, + serializedName: "beforeSnapshot", + type: { + name: "Composite", + className: "ResourceChangeDataBeforeSnapshot" + } + }, + afterSnapshot: { + required: true, + serializedName: "afterSnapshot", + type: { + name: "Composite", + className: "ResourceChangeDataAfterSnapshot" + } + }, + changeType: { + serializedName: "changeType", + type: { + name: "Enum", + allowedValues: [ + "Create", + "Update", + "Delete" + ] + } + }, + propertyChanges: { + serializedName: "propertyChanges", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourcePropertyChange" + } + } + } + } + } + } +}; + +export const ResourceChangeList: msRest.CompositeMapper = { + serializedName: "ResourceChangeList", + type: { + name: "Composite", + className: "ResourceChangeList", + modelProperties: { + changes: { + serializedName: "changes", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceChangeData" + } + } + } + }, + skipToken: { + serializedName: "$skipToken", + type: { + name: "Object" + } + } + } + } +}; + +export const ResourceChangeDetailsRequestParameters: msRest.CompositeMapper = { + serializedName: "ResourceChangeDetailsRequestParameters", + type: { + name: "Composite", + className: "ResourceChangeDetailsRequestParameters", + modelProperties: { + resourceIds: { + required: true, + serializedName: "resourceIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + changeIds: { + required: true, + serializedName: "changeIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ErrorDetails: msRest.CompositeMapper = { + serializedName: "ErrorDetails", + type: { + name: "Composite", + className: "ErrorDetails", + modelProperties: { + code: { + required: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + required: true, + serializedName: "message", + type: { + name: "String" + } + } + }, + additionalProperties: { + type: { + name: "Object" + } + } + } +}; + +export const ErrorModel: msRest.CompositeMapper = { + serializedName: "Error", + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + code: { + required: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + required: true, + serializedName: "message", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetails", + additionalProperties: { + type: { + name: "Object" + } + } + } + } + } + } + } + } +}; + +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + required: true, + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + } +}; + export const QueryRequestOptions: msRest.CompositeMapper = { serializedName: "QueryRequestOptions", type: { @@ -131,7 +550,6 @@ export const QueryRequest: msRest.CompositeMapper = { className: "QueryRequest", modelProperties: { subscriptions: { - required: true, serializedName: "subscriptions", type: { name: "Sequence", @@ -142,6 +560,12 @@ export const QueryRequest: msRest.CompositeMapper = { } } }, + managementGroupId: { + serializedName: "managementGroupId", + type: { + name: "String" + } + }, query: { required: true, serializedName: "query", @@ -366,35 +790,6 @@ export const FacetResult: msRest.CompositeMapper = { } }; -export const ErrorDetails: msRest.CompositeMapper = { - serializedName: "ErrorDetails", - type: { - name: "Composite", - className: "ErrorDetails", - modelProperties: { - code: { - required: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - required: true, - serializedName: "message", - type: { - name: "String" - } - } - }, - additionalProperties: { - type: { - name: "Object" - } - } - } -}; - export const FacetError: msRest.CompositeMapper = { serializedName: "FacetError", type: { @@ -426,91 +821,102 @@ export const FacetError: msRest.CompositeMapper = { } }; -export const ErrorModel: msRest.CompositeMapper = { - serializedName: "Error", +export const OperationDisplay: msRest.CompositeMapper = { + serializedName: "Operation_display", type: { name: "Composite", - className: "ErrorModel", + className: "OperationDisplay", modelProperties: { - code: { - required: true, - serializedName: "code", + provider: { + serializedName: "provider", type: { name: "String" } }, - message: { - required: true, - serializedName: "message", + resource: { + serializedName: "resource", type: { name: "String" } }, - details: { - serializedName: "details", + operation: { + serializedName: "operation", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetails", - additionalProperties: { - type: { - name: "Object" - } - } - } - } + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" } } } } }; -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", +export const Operation: msRest.CompositeMapper = { + serializedName: "Operation", type: { name: "Composite", - className: "ErrorResponse", + className: "Operation", modelProperties: { - error: { - required: true, - serializedName: "error", + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", type: { name: "Composite", - className: "ErrorModel" + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" } } } } }; -export const OperationDisplay: msRest.CompositeMapper = { - serializedName: "Operation_display", +export const ResourcesHistoryRequestOptions: msRest.CompositeMapper = { + serializedName: "ResourcesHistoryRequestOptions", type: { name: "Composite", - className: "OperationDisplay", + className: "ResourcesHistoryRequestOptions", modelProperties: { - provider: { - serializedName: "provider", + interval: { + serializedName: "interval", type: { - name: "String" + name: "Composite", + className: "DateTimeInterval" } }, - resource: { - serializedName: "resource", + top: { + serializedName: "$top", type: { - name: "String" + name: "Number" } }, - operation: { - serializedName: "operation", + skip: { + serializedName: "$skip", + type: { + name: "Number" + } + }, + skipToken: { + serializedName: "$skipToken", type: { name: "String" } }, - description: { - serializedName: "description", + resultFormat: { + serializedName: "resultFormat", type: { name: "String" } @@ -519,27 +925,38 @@ export const OperationDisplay: msRest.CompositeMapper = { } }; -export const Operation: msRest.CompositeMapper = { - serializedName: "Operation", +export const ResourcesHistoryRequest: msRest.CompositeMapper = { + serializedName: "ResourcesHistoryRequest", type: { name: "Composite", - className: "Operation", + className: "ResourcesHistoryRequest", modelProperties: { - name: { - serializedName: "name", + subscriptions: { + serializedName: "subscriptions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + query: { + serializedName: "query", type: { name: "String" } }, - display: { - serializedName: "display", + options: { + serializedName: "options", type: { name: "Composite", - className: "OperationDisplay" + className: "ResourcesHistoryRequestOptions" } }, - origin: { - serializedName: "origin", + managementGroupId: { + serializedName: "managementGroupId", type: { name: "String" } diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/operationsMappers.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/operationsMappers.ts index 65fc7dd1800a..654f4183efac 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/operationsMappers.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/operationsMappers.ts @@ -1,6 +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 regenerated. @@ -8,7 +8,9 @@ export { discriminators, - CloudError, + ErrorDetails, + ErrorModel, + ErrorResponse, Operation, OperationDisplay, OperationListResult diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts index 0d109216640f..065de9446442 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts @@ -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 @@ -20,11 +19,25 @@ export const acceptLanguage: msRest.OperationParameter = { } } }; -export const apiVersion: msRest.OperationQueryParameter = { +export const apiVersion0: msRest.OperationQueryParameter = { parameterPath: "apiVersion", mapper: { required: true, + isConstant: true, serializedName: "api-version", + defaultValue: '2020-09-01-preview', + type: { + name: "String" + } + } +}; +export const apiVersion1: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + isConstant: true, + serializedName: "api-version", + defaultValue: '2020-04-01-preview', type: { name: "String" } diff --git a/sdk/resourcegraph/arm-resourcegraph/src/operations/index.ts b/sdk/resourcegraph/arm-resourcegraph/src/operations/index.ts index 8a723d22b1d6..dfc0b9f0e394 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/operations/index.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/operations/index.ts @@ -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 diff --git a/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts b/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts index e49fe973def2..c77f457379d2 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts @@ -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 @@ -57,7 +56,7 @@ const listOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "providers/Microsoft.ResourceGraph/operations", queryParameters: [ - Parameters.apiVersion + Parameters.apiVersion1 ], headerParameters: [ Parameters.acceptLanguage @@ -67,7 +66,7 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.OperationListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts index 903e6857e059..8bc8e88a31b3 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts @@ -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 @@ -30,6 +29,62 @@ class ResourceGraphClient extends ResourceGraphClientContext { this.operations = new operations.Operations(this); } + /** + * List changes to a resource for a given time interval. + * @param parameters the parameters for this request for changes. + * @param [options] The optional parameters + * @returns Promise + */ + resourceChanges(parameters: Models.ResourceChangesRequestParameters, options?: msRest.RequestOptionsBase): Promise; + /** + * @param parameters the parameters for this request for changes. + * @param callback The callback + */ + resourceChanges(parameters: Models.ResourceChangesRequestParameters, callback: msRest.ServiceCallback): void; + /** + * @param parameters the parameters for this request for changes. + * @param options The optional parameters + * @param callback The callback + */ + resourceChanges(parameters: Models.ResourceChangesRequestParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + resourceChanges(parameters: Models.ResourceChangesRequestParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + parameters, + options + }, + resourceChangesOperationSpec, + callback) as Promise; + } + + /** + * Get resource change details. + * @param parameters The parameters for this request for resource change details. + * @param [options] The optional parameters + * @returns Promise + */ + resourceChangeDetails(parameters: Models.ResourceChangeDetailsRequestParameters, options?: msRest.RequestOptionsBase): Promise; + /** + * @param parameters The parameters for this request for resource change details. + * @param callback The callback + */ + resourceChangeDetails(parameters: Models.ResourceChangeDetailsRequestParameters, callback: msRest.ServiceCallback): void; + /** + * @param parameters The parameters for this request for resource change details. + * @param options The optional parameters + * @param callback The callback + */ + resourceChangeDetails(parameters: Models.ResourceChangeDetailsRequestParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + resourceChangeDetails(parameters: Models.ResourceChangeDetailsRequestParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + parameters, + options + }, + resourceChangeDetailsOperationSpec, + callback) as Promise; + } + /** * Queries the resources managed by Azure Resource Manager for all subscriptions specified in the * request. @@ -58,15 +113,108 @@ class ResourceGraphClient extends ResourceGraphClientContext { resourcesOperationSpec, callback) as Promise; } + + /** + * List all snapshots of a resource for a given time interval. + * @param request + * @param [options] The optional parameters + * @returns Promise + */ + resourcesHistory(request: Models.ResourcesHistoryRequest, options?: msRest.RequestOptionsBase): Promise; + /** + * @param request + * @param callback The callback + */ + resourcesHistory(request: Models.ResourcesHistoryRequest, callback: msRest.ServiceCallback): void; + /** + * @param request + * @param options The optional parameters + * @param callback The callback + */ + resourcesHistory(request: Models.ResourcesHistoryRequest, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + resourcesHistory(request: Models.ResourcesHistoryRequest, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + request, + options + }, + resourcesHistoryOperationSpec, + callback) as Promise; + } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); +const resourceChangesOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.ResourceGraph/resourceChanges", + queryParameters: [ + Parameters.apiVersion0 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "parameters", + mapper: { + ...Mappers.ResourceChangesRequestParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.ResourceChangeList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const resourceChangeDetailsOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.ResourceGraph/resourceChangeDetails", + queryParameters: [ + Parameters.apiVersion0 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "parameters", + mapper: { + ...Mappers.ResourceChangeDetailsRequestParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceChangeData" + } + } + } + } + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + const resourcesOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "providers/Microsoft.ResourceGraph/resources", queryParameters: [ - Parameters.apiVersion + Parameters.apiVersion1 ], headerParameters: [ Parameters.acceptLanguage @@ -89,6 +237,38 @@ const resourcesOperationSpec: msRest.OperationSpec = { serializer }; +const resourcesHistoryOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.ResourceGraph/resourcesHistory", + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "request", + mapper: { + ...Mappers.ResourcesHistoryRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Object" + } + } + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + export { ResourceGraphClient, ResourceGraphClientContext, diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts index 7cf3774b626c..3023cf8aa65c 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts @@ -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 @@ -17,7 +16,6 @@ const packageVersion = "2.0.0"; export class ResourceGraphClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; - apiVersion?: string; /** * Initializes a new instance of the ResourceGraphClient class. @@ -39,7 +37,6 @@ export class ResourceGraphClientContext extends msRestAzure.AzureServiceClient { super(credentials, options); - this.apiVersion = '2019-04-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; diff --git a/sdk/resourcegraph/arm-resourcegraph/tsconfig.json b/sdk/resourcegraph/arm-resourcegraph/tsconfig.json index 87bbf5b5fa49..422b584abd5e 100644 --- a/sdk/resourcegraph/arm-resourcegraph/tsconfig.json +++ b/sdk/resourcegraph/arm-resourcegraph/tsconfig.json @@ -9,7 +9,7 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6"], + "lib": ["es6", "dom"], "declaration": true, "outDir": "./esm", "importHelpers": true