diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index f18d254644d6..814a38d18a75 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -734,6 +734,7 @@ packages: /@azure/ai-form-recognizer/3.1.0-beta.3: resolution: {integrity: sha512-+4QtFKNyxAmdqpcYjuAtmWKm/MuOe9kZsbpS9jA9h0YHzngNj5gc67AA4egV9BXOq9x+1phjYTNC/rxiOUr1uQ==} engines: {node: '>=8.0.0'} + deprecated: Please migrate to a supported (non-beta) version of this package dependencies: '@azure/core-auth': 1.4.0 '@azure/core-http': 1.2.6 @@ -3998,7 +3999,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.1.0-dev.20230410 + typescript: 5.1.0-dev.20230411 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8861,8 +8862,8 @@ packages: hasBin: true dev: false - /typescript/5.1.0-dev.20230410: - resolution: {integrity: sha512-7aQS6nNYt3XVJic6FBmnxasor6MZFwi5Odj0Z0UtHode4ID21KgCjFgJcdtiWrmSIZ/PLfrp6QiE179hwbB5tQ==} + /typescript/5.1.0-dev.20230411: + resolution: {integrity: sha512-3yO7RzC4rZID1/u1alMwKKAhp/kyDkFiR+73vsvK5z99GYRVbUJIy9f3w2pGNZI3K7YI5Hv1bN2XWkPgZhB2CA==} engines: {node: '>=12.20'} hasBin: true dev: false @@ -14339,7 +14340,7 @@ packages: dev: false file:projects/arm-resourcegraph.tgz: - resolution: {integrity: sha512-Y3O/5zIdWNxrec3wNgLP/9l2B1xIbJDNQohOSwbRzVuB34VW63l9jLy0dLn5OKzPkYMcXaaPhIL8fEBh2c7QJA==, tarball: file:projects/arm-resourcegraph.tgz} + resolution: {integrity: sha512-iOzHvFyi6gCMqDQb9SsHNNoOtX+kzQyfri5Lf3rsqbk0+p/UydyvauKJb2ZQsGspJrTwz/55lWsepHhbmaQn9w==, tarball: file:projects/arm-resourcegraph.tgz} name: '@rush-temp/arm-resourcegraph' version: 0.0.0 dependencies: @@ -14353,7 +14354,8 @@ packages: '@types/node': 14.18.42 chai: 4.3.7 cross-env: 7.0.3 - mkdirp: 1.0.4 + dotenv: 16.0.3 + mkdirp: 2.1.6 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 diff --git a/sdk/resourcegraph/arm-resourcegraph/CHANGELOG.md b/sdk/resourcegraph/arm-resourcegraph/CHANGELOG.md index 165e88d3d91e..a23aafbe993d 100644 --- a/sdk/resourcegraph/arm-resourcegraph/CHANGELOG.md +++ b/sdk/resourcegraph/arm-resourcegraph/CHANGELOG.md @@ -1,18 +1,8 @@ # Release History + +## 5.0.0-beta.4 (2023-04-12) -## 5.0.0-beta.4 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 5.0.0-beta.3 (2022-12-07) - -The package of @azure/arm-resourcegraph is using our next generation design principles since version 5.0.0-beta.3, which contains breaking changes. +The package of @azure/arm-resourcegraph is using our next generation design principles since version 5.0.0-beta.4, which contains breaking changes. To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). diff --git a/sdk/resourcegraph/arm-resourcegraph/LICENSE b/sdk/resourcegraph/arm-resourcegraph/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/resourcegraph/arm-resourcegraph/LICENSE +++ b/sdk/resourcegraph/arm-resourcegraph/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Microsoft +Copyright (c) 2023 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/_meta.json b/sdk/resourcegraph/arm-resourcegraph/_meta.json index 5f28e10d3afd..bd2fcc2ba552 100644 --- a/sdk/resourcegraph/arm-resourcegraph/_meta.json +++ b/sdk/resourcegraph/arm-resourcegraph/_meta.json @@ -1,8 +1,8 @@ { - "commit": "0cd7b3e83d5e7e21222dcc4bdde4565562da0cdf", - "readme": "specification\\resourcegraph\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\resourcegraph\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.4 --generate-sample=true", + "commit": "d459b0d6dee3fa23850778680cbc81755748e4d1", + "readme": "specification/resourcegraph/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/resourcegraph/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.10", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.5.2", - "use": "@autorest/typescript@6.0.0-rc.4" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", + "use": "@autorest/typescript@6.0.0-rc.10" } \ No newline at end of file diff --git a/sdk/resourcegraph/arm-resourcegraph/package.json b/sdk/resourcegraph/arm-resourcegraph/package.json index e496dc91507a..d0506000e4bc 100644 --- a/sdk/resourcegraph/arm-resourcegraph/package.json +++ b/sdk/resourcegraph/arm-resourcegraph/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -31,12 +31,13 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -47,7 +48,6 @@ "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcegraph/arm-resourcegraph", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -109,12 +109,5 @@ ] }, "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-resourcegraph?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcegraph/arm-resourcegraph" +} \ No newline at end of file diff --git a/sdk/resourcegraph/arm-resourcegraph/review/arm-resourcegraph.api.md b/sdk/resourcegraph/arm-resourcegraph/review/arm-resourcegraph.api.md index c9b51b93ed30..0e8507e1dc03 100644 --- a/sdk/resourcegraph/arm-resourcegraph/review/arm-resourcegraph.api.md +++ b/sdk/resourcegraph/arm-resourcegraph/review/arm-resourcegraph.api.md @@ -11,6 +11,12 @@ import { PagedAsyncIterableIterator } from '@azure/core-paging'; // @public export type AuthorizationScopeFilter = "AtScopeAndBelow" | "AtScopeAndAbove" | "AtScopeExact" | "AtScopeAboveAndBelow"; +// @public +export type ChangeCategory = "User" | "System"; + +// @public +export type ChangeType = "Create" | "Update" | "Delete"; + // @public export interface Column { name: string; @@ -120,6 +126,9 @@ export interface OperationsListOptionalParams extends coreClient.OperationOption // @public export type OperationsListResponse = OperationListResult; +// @public +export type PropertyChangeType = "Insert" | "Update" | "Remove"; + // @public export interface QueryRequest { facets?: FacetRequest[]; @@ -149,15 +158,75 @@ export interface QueryResponse { totalRecords: number; } +// @public +export interface ResourceChangeData { + afterSnapshot: ResourceChangeDataAfterSnapshot; + beforeSnapshot: ResourceChangeDataBeforeSnapshot; + changeId: string; + changeType?: ChangeType; + propertyChanges?: ResourcePropertyChange[]; + resourceId?: string; +} + +// @public +export interface ResourceChangeDataAfterSnapshot extends ResourceSnapshotData { +} + +// @public +export interface ResourceChangeDataBeforeSnapshot extends ResourceSnapshotData { +} + +// @public +export interface ResourceChangeDetailsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ResourceChangeDetailsRequestParameters { + changeIds: string[]; + resourceIds: string[]; +} + +// @public +export type ResourceChangeDetailsResponse = ResourceChangeData[]; + +// @public +export interface ResourceChangeList { + changes?: ResourceChangeData[]; + skipToken?: any; +} + +// @public +export interface ResourceChangesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ResourceChangesRequestParameters { + fetchPropertyChanges?: boolean; + fetchSnapshots?: boolean; + interval: ResourceChangesRequestParametersInterval; + resourceIds?: string[]; + skipToken?: string; + subscriptionId?: string; + table?: string; + top?: number; +} + +// @public +export interface ResourceChangesRequestParametersInterval extends DateTimeInterval { +} + +// @public +export type ResourceChangesResponse = ResourceChangeList; + // @public (undocumented) export class ResourceGraphClient extends coreClient.ServiceClient { // (undocumented) $host: string; constructor(credentials: coreAuth.TokenCredential, options?: ResourceGraphClientOptionalParams); // (undocumented) - apiVersion: string; - // (undocumented) operations: Operations; + resourceChangeDetails(parameters: ResourceChangeDetailsRequestParameters, options?: ResourceChangeDetailsOptionalParams): Promise; + resourceChanges(parameters: ResourceChangesRequestParameters, options?: ResourceChangesOptionalParams): Promise; resources(query: QueryRequest, options?: ResourcesOptionalParams): Promise; resourcesHistory(request: ResourcesHistoryRequest, options?: ResourcesHistoryOptionalParams): Promise; } @@ -165,10 +234,18 @@ export class ResourceGraphClient extends coreClient.ServiceClient { // @public export interface ResourceGraphClientOptionalParams extends coreClient.ServiceClientOptions { $host?: string; - apiVersion?: string; endpoint?: string; } +// @public +export interface ResourcePropertyChange { + afterValue?: string; + beforeValue?: string; + changeCategory: ChangeCategory; + propertyChangeType: PropertyChangeType; + propertyName: string; +} + // @public export interface ResourcesHistoryOptionalParams extends coreClient.OperationOptions { } @@ -191,7 +268,16 @@ export interface ResourcesHistoryRequestOptions { } // @public -export type ResourcesHistoryResponse = Record; +export type ResourcesHistoryResponse = { + [propertyName: string]: any; +}; + +// @public +export interface ResourceSnapshotData { + content?: Record; + snapshotId?: string; + timestamp: Date; +} // @public export interface ResourcesOptionalParams extends coreClient.OperationOptions { diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts index 4723cd8e275a..ef75d917dd62 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts @@ -172,6 +172,91 @@ export interface DateTimeInterval { end: Date; } +/** 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; +} + +/** 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; +} + +/** 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 */ + changeType?: ChangeType; + /** An array of resource property change */ + propertyChanges?: ResourcePropertyChange[]; +} + +/** 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?: Record; +} + +/** 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. */ + changeCategory: ChangeCategory; + /** The property change Type */ + propertyChangeType: PropertyChangeType; +} + +/** 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[]; +} + /** Query output in tabular format. */ export interface Table { /** Query result column descriptors. */ @@ -208,6 +293,17 @@ export interface FacetError extends Facet { errors: ErrorDetails[]; } +/** Specifies the date and time interval for a changes request. */ +export interface ResourceChangesRequestParametersInterval + extends DateTimeInterval {} + +/** The snapshot before the change. */ +export interface ResourceChangeDataBeforeSnapshot + extends ResourceSnapshotData {} + +/** The snapshot after the change. */ +export interface ResourceChangeDataAfterSnapshot extends ResourceSnapshotData {} + /** Defines values for ResultFormat. */ export type ResultFormat = "table" | "objectArray"; /** Defines values for AuthorizationScopeFilter. */ @@ -220,6 +316,12 @@ export type AuthorizationScopeFilter = export type FacetSortOrder = "asc" | "desc"; /** Defines values for ResultTruncated. */ export type ResultTruncated = "true" | "false"; +/** Defines values for ChangeType. */ +export type ChangeType = "Create" | "Update" | "Delete"; +/** Defines values for ChangeCategory. */ +export type ChangeCategory = "User" | "System"; +/** Defines values for PropertyChangeType. */ +export type PropertyChangeType = "Insert" | "Update" | "Remove"; /** Defines values for ColumnDataType. */ export type ColumnDataType = | "string" @@ -240,7 +342,21 @@ export interface ResourcesHistoryOptionalParams extends coreClient.OperationOptions {} /** Contains response data for the resourcesHistory operation. */ -export type ResourcesHistoryResponse = Record; +export type ResourcesHistoryResponse = { [propertyName: string]: any }; + +/** Optional parameters. */ +export interface ResourceChangesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the resourceChanges operation. */ +export type ResourceChangesResponse = ResourceChangeList; + +/** Optional parameters. */ +export interface ResourceChangeDetailsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the resourceChangeDetails operation. */ +export type ResourceChangeDetailsResponse = ResourceChangeData[]; /** Optional parameters. */ export interface OperationsListOptionalParams @@ -254,8 +370,6 @@ export interface ResourceGraphClientOptionalParams extends coreClient.ServiceClientOptions { /** server parameter */ $host?: string; - /** Api Version */ - apiVersion?: string; /** Overrides client endpoint. */ endpoint?: string; } diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts index 1d45b2a7e03a..43b5088171a3 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts @@ -545,6 +545,261 @@ export const DateTimeInterval: coreClient.CompositeMapper = { } }; +export const ResourceChangesRequestParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceChangesRequestParameters", + modelProperties: { + resourceIds: { + serializedName: "resourceIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + subscriptionId: { + serializedName: "subscriptionId", + type: { + name: "String" + } + }, + interval: { + serializedName: "interval", + type: { + name: "Composite", + className: "ResourceChangesRequestParametersInterval" + } + }, + skipToken: { + serializedName: "$skipToken", + type: { + name: "String" + } + }, + top: { + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + serializedName: "$top", + type: { + name: "Number" + } + }, + table: { + serializedName: "table", + type: { + name: "String" + } + }, + fetchPropertyChanges: { + serializedName: "fetchPropertyChanges", + type: { + name: "Boolean" + } + }, + fetchSnapshots: { + serializedName: "fetchSnapshots", + type: { + name: "Boolean" + } + } + } + } +}; + +export const ResourceChangeList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceChangeList", + modelProperties: { + changes: { + serializedName: "changes", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceChangeData" + } + } + } + }, + skipToken: { + serializedName: "$skipToken", + type: { + name: "any" + } + } + } + } +}; + +export const ResourceChangeData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceChangeData", + modelProperties: { + resourceId: { + serializedName: "resourceId", + type: { + name: "String" + } + }, + changeId: { + serializedName: "changeId", + required: true, + type: { + name: "String" + } + }, + beforeSnapshot: { + serializedName: "beforeSnapshot", + type: { + name: "Composite", + className: "ResourceChangeDataBeforeSnapshot" + } + }, + afterSnapshot: { + 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 ResourceSnapshotData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceSnapshotData", + modelProperties: { + snapshotId: { + serializedName: "snapshotId", + type: { + name: "String" + } + }, + timestamp: { + serializedName: "timestamp", + required: true, + type: { + name: "DateTime" + } + }, + content: { + serializedName: "content", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const ResourcePropertyChange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourcePropertyChange", + modelProperties: { + propertyName: { + serializedName: "propertyName", + required: true, + type: { + name: "String" + } + }, + beforeValue: { + serializedName: "beforeValue", + type: { + name: "String" + } + }, + afterValue: { + serializedName: "afterValue", + type: { + name: "String" + } + }, + changeCategory: { + serializedName: "changeCategory", + required: true, + type: { + name: "Enum", + allowedValues: ["User", "System"] + } + }, + propertyChangeType: { + serializedName: "propertyChangeType", + required: true, + type: { + name: "Enum", + allowedValues: ["Insert", "Update", "Remove"] + } + } + } + } +}; + +export const ResourceChangeDetailsRequestParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceChangeDetailsRequestParameters", + modelProperties: { + resourceIds: { + serializedName: "resourceIds", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + changeIds: { + serializedName: "changeIds", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + export const Table: coreClient.CompositeMapper = { type: { name: "Composite", @@ -677,6 +932,36 @@ export const FacetError: coreClient.CompositeMapper = { } }; +export const ResourceChangesRequestParametersInterval: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceChangesRequestParametersInterval", + modelProperties: { + ...DateTimeInterval.type.modelProperties + } + } +}; + +export const ResourceChangeDataBeforeSnapshot: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceChangeDataBeforeSnapshot", + modelProperties: { + ...ResourceSnapshotData.type.modelProperties + } + } +}; + +export const ResourceChangeDataAfterSnapshot: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceChangeDataAfterSnapshot", + modelProperties: { + ...ResourceSnapshotData.type.modelProperties + } + } +}; + export let discriminators = { Facet: Facet, "Facet.FacetResult": FacetResult, diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts index 1a4e73d15e5c..f2309c7e22ff 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts @@ -13,7 +13,9 @@ import { } from "@azure/core-client"; import { QueryRequest as QueryRequestMapper, - ResourcesHistoryRequest as ResourcesHistoryRequestMapper + ResourcesHistoryRequest as ResourcesHistoryRequestMapper, + ResourceChangesRequestParameters as ResourceChangesRequestParametersMapper, + ResourceChangeDetailsRequestParameters as ResourceChangeDetailsRequestParametersMapper } from "../models/mappers"; export const contentType: OperationParameter = { @@ -60,7 +62,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-06-01-preview", + defaultValue: "2022-10-01", isConstant: true, serializedName: "api-version", type: { @@ -73,3 +75,37 @@ export const request: OperationParameter = { parameterPath: "request", mapper: ResourcesHistoryRequestMapper }; + +export const apiVersion1: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2021-06-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: ResourceChangesRequestParametersMapper +}; + +export const apiVersion2: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2020-09-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const parameters1: OperationParameter = { + parameterPath: "parameters", + mapper: ResourceChangeDetailsRequestParametersMapper +}; diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts index 973eea7a8eb2..de9c682c4b75 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts @@ -8,11 +8,6 @@ import * as coreClient from "@azure/core-client"; import * as coreRestPipeline from "@azure/core-rest-pipeline"; -import { - PipelineRequest, - PipelineResponse, - SendRequest -} from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { OperationsImpl } from "./operations"; import { Operations } from "./operationsInterfaces"; @@ -25,12 +20,17 @@ import { ResourcesResponse, ResourcesHistoryRequest, ResourcesHistoryOptionalParams, - ResourcesHistoryResponse + ResourcesHistoryResponse, + ResourceChangesRequestParameters, + ResourceChangesOptionalParams, + ResourceChangesResponse, + ResourceChangeDetailsRequestParameters, + ResourceChangeDetailsOptionalParams, + ResourceChangeDetailsResponse } from "./models"; export class ResourceGraphClient extends coreClient.ServiceClient { $host: string; - apiVersion: string; /** * Initializes a new instance of the ResourceGraphClient class. @@ -105,37 +105,7 @@ export class ResourceGraphClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-06-01-preview"; this.operations = new OperationsImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest( - request: PipelineRequest, - next: SendRequest - ): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - } - }; - this.pipeline.addPolicy(apiVersionPolicy); } /** @@ -168,6 +138,36 @@ export class ResourceGraphClient extends coreClient.ServiceClient { ); } + /** + * List changes to a resource for a given time interval. + * @param parameters the parameters for this request for changes. + * @param options The options parameters. + */ + resourceChanges( + parameters: ResourceChangesRequestParameters, + options?: ResourceChangesOptionalParams + ): Promise { + return this.sendOperationRequest( + { parameters, options }, + resourceChangesOperationSpec + ); + } + + /** + * Get resource change details. + * @param parameters The parameters for this request for resource change details. + * @param options The options parameters. + */ + resourceChangeDetails( + parameters: ResourceChangeDetailsRequestParameters, + options?: ResourceChangeDetailsOptionalParams + ): Promise { + return this.sendOperationRequest( + { parameters, options }, + resourceChangeDetailsOperationSpec + ); + } + operations: Operations; } // Operation Specifications @@ -205,7 +205,50 @@ const resourcesHistoryOperationSpec: coreClient.OperationSpec = { } }, requestBody: Parameters.request, - queryParameters: [Parameters.apiVersion], + queryParameters: [Parameters.apiVersion1], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const resourceChangesOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceGraph/resourceChanges", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ResourceChangeList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion2], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const resourceChangeDetailsOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceGraph/resourceChangeDetails", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ResourceChangeData" } + } + } + } + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion2], urlParameters: [Parameters.$host], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", diff --git a/sdk/resourcegraph/arm-resourcegraph/tsconfig.json b/sdk/resourcegraph/arm-resourcegraph/tsconfig.json index a3decb7f3969..3e6ae96443f3 100644 --- a/sdk/resourcegraph/arm-resourcegraph/tsconfig.json +++ b/sdk/resourcegraph/arm-resourcegraph/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-resourcegraph": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"