diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts index 660018a2494d..d08ae6ed7dd2 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts @@ -31,9 +31,16 @@ export interface QueryRequestOptions { */ skip?: number; /** - * Defines in which format query result returned. Possible values include: 'table', 'objectArray' + * Defines in which format query result returned. Possible values include: 'table', + * 'objectArray'. Default value: 'objectArray'. */ resultFormat?: ResultFormat; + /** + * Only applicable for tenant and management group level queries to decide whether to allow + * partial scopes for result in case the number of subscriptions exceed allowed limits. Default + * value: false. + */ + allowPartialScopes?: boolean; } /** @@ -83,9 +90,9 @@ export interface QueryRequest { */ subscriptions?: string[]; /** - * The management group identifier. + * Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ] */ - managementGroupId?: string; + managementGroups?: string[]; /** * The resources query. */ @@ -139,11 +146,11 @@ export interface QueryResponse { resultTruncated: ResultTruncated; /** * When present, the value can be passed to a subsequent query call (together with the same query - * and subscriptions used in the current request) to retrieve the next page of data. + * and scopes used in the current request) to retrieve the next page of data. */ skipToken?: string; /** - * Query output in tabular format. + * Query output in JObject array or Table format. */ data: any; /** @@ -201,7 +208,7 @@ export interface FacetResult { */ count: number; /** - * A table containing the desired facets. Only present if the facet is valid. + * A JObject array or Table containing the desired facets. Only present if the facet is valid. */ data: any; } @@ -313,204 +320,6 @@ export interface Operation { origin?: string; } -/** - * 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 resource for a changes request. - */ - resourceId: 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 flag if set to true will fetch property changes - */ - fetchPropertyChanges?: 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 ID of the resource - */ - 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 resource for a change details request. - */ - resourceId: string; - /** - * Specifies the change ID. - */ - changeId: 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. */ @@ -559,38 +368,6 @@ export type ResultTruncated = 'true' | 'false'; */ export type ColumnDataType = 'string' | 'integer' | 'number' | 'boolean' | 'object'; -/** - * 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 ResultFormat1. - * Possible values include: 'table', 'objectArray' - * @readonly - * @enum {string} - */ -export type ResultFormat1 = 'table' | 'objectArray'; - /** * Contains response data for the resources operation. */ @@ -611,71 +388,6 @@ export type ResourcesResponse = QueryResponse & { }; }; -/** - * 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 = ResourceChangeData & { - /** - * 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 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 d18a0e735f9c..cf8d8d3fbc41 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts @@ -45,6 +45,7 @@ export const QueryRequestOptions: msRest.CompositeMapper = { }, resultFormat: { serializedName: "resultFormat", + defaultValue: 'objectArray', type: { name: "Enum", allowedValues: [ @@ -52,6 +53,13 @@ export const QueryRequestOptions: msRest.CompositeMapper = { "objectArray" ] } + }, + allowPartialScopes: { + serializedName: "allowPartialScopes", + defaultValue: false, + type: { + name: "Boolean" + } } } } @@ -141,10 +149,15 @@ export const QueryRequest: msRest.CompositeMapper = { } } }, - managementGroupId: { - serializedName: "managementGroupId", + managementGroups: { + serializedName: "managementGroups", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "String" + } + } } }, query: { @@ -553,386 +566,6 @@ export const Operation: msRest.CompositeMapper = { } }; -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: { - resourceId: { - required: true, - serializedName: "resourceId", - 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" - } - }, - fetchPropertyChanges: { - serializedName: "fetchPropertyChanges", - 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: { - resourceId: { - required: true, - serializedName: "resourceId", - type: { - name: "String" - } - }, - changeId: { - required: true, - serializedName: "changeId", - type: { - name: "String" - } - } - } - } -}; - -export const ResourcesHistoryRequestOptions: msRest.CompositeMapper = { - serializedName: "ResourcesHistoryRequestOptions", - type: { - name: "Composite", - className: "ResourcesHistoryRequestOptions", - modelProperties: { - interval: { - serializedName: "interval", - type: { - name: "Composite", - className: "DateTimeInterval" - } - }, - top: { - serializedName: "$top", - type: { - name: "Number" - } - }, - skip: { - serializedName: "$skip", - type: { - name: "Number" - } - }, - skipToken: { - serializedName: "$skipToken", - type: { - name: "String" - } - }, - resultFormat: { - serializedName: "resultFormat", - type: { - name: "String" - } - } - } - } -}; - -export const ResourcesHistoryRequest: msRest.CompositeMapper = { - serializedName: "ResourcesHistoryRequest", - type: { - name: "Composite", - className: "ResourcesHistoryRequest", - modelProperties: { - subscriptions: { - serializedName: "subscriptions", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - query: { - serializedName: "query", - type: { - name: "String" - } - }, - options: { - serializedName: "options", - type: { - name: "Composite", - className: "ResourcesHistoryRequestOptions" - } - }, - managementGroupId: { - serializedName: "managementGroupId", - type: { - name: "String" - } - } - } - } -}; - export const OperationListResult: msRest.CompositeMapper = { serializedName: "OperationListResult", type: { diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts index 798ae10551d4..057f0d05d84e 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts @@ -30,8 +30,7 @@ class ResourceGraphClient extends ResourceGraphClientContext { } /** - * Queries the resources managed by Azure Resource Manager for all subscriptions specified in the - * request. + * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * @param query Request specifying query and its options. * @param [options] The optional parameters * @returns Promise @@ -57,90 +56,6 @@ class ResourceGraphClient extends ResourceGraphClientContext { resourcesOperationSpec, callback) as Promise; } - - /** - * 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; - } - - /** - * 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 @@ -172,92 +87,6 @@ const resourcesOperationSpec: msRest.OperationSpec = { serializer }; -const resourceChangesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.ResourceGraph/resourceChanges", - queryParameters: [ - Parameters.apiVersion - ], - 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.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.ResourceChangeDetailsRequestParameters, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.ResourceChangeData - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const resourcesHistoryOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.ResourceGraph/resourcesHistory", - queryParameters: [ - Parameters.apiVersion - ], - 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 fe9d71c58900..a04c7a084d65 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts @@ -31,24 +31,24 @@ export class ResourceGraphClientContext extends msRestAzure.AzureServiceClient { if (!options) { options = {}; } - if (!options.userAgent) { + if(!options.userAgent) { const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; } super(credentials, options); - this.apiVersion = '2020-04-01-preview'; + this.apiVersion = '2021-03-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; this.requestContentType = "application/json; charset=utf-8"; this.credentials = credentials; - if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage; } - if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; } }