diff --git a/sdk/resourcegraph/arm-resourcegraph/README.md b/sdk/resourcegraph/arm-resourcegraph/README.md
index b12be35165b5..c0be06573ea6 100644
--- a/sdk/resourcegraph/arm-resourcegraph/README.md
+++ b/sdk/resourcegraph/arm-resourcegraph/README.md
@@ -1,89 +1,97 @@
## Azure ResourceGraphClient SDK for JavaScript
-This package contains an isomorphic SDK for ResourceGraphClient.
+This package contains an isomorphic SDK (runs both in node.js and in browsers) for ResourceGraphClient.
### Currently supported environments
-- Node.js version 6.x.x or higher
+- Node.js version 8.x.x or higher
- Browser JavaScript
-### How to Install
+### Prerequisites
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-resourcegraph` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
```bash
-npm install @azure/arm-resourcegraph
+npm install --save @azure/arm-resourcegraph @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
### How to use
-#### nodejs - client creation and list operations as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
-
-- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
-```bash
-npm install @azure/ms-rest-nodeauth@"^3.0.0"
-```
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
+#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
##### 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
-const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
const { ResourceGraphClient } = require("@azure/arm-resourcegraph");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new ResourceGraphClient(creds, subscriptionId);
- client.operations.list().then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new ResourceGraphClient(creds, subscriptionId);
+client.operations.list().then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and list operations as an example written in JavaScript.
+#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
-##### Install @azure/ms-rest-browserauth
-
-```bash
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-resourcegraph sample
-
-
+
diff --git a/sdk/resourcegraph/arm-resourcegraph/package.json b/sdk/resourcegraph/arm-resourcegraph/package.json
index 6f27b2e61b0f..453a6d2d2201 100644
--- a/sdk/resourcegraph/arm-resourcegraph/package.json
+++ b/sdk/resourcegraph/arm-resourcegraph/package.json
@@ -4,8 +4,9 @@
"description": "ResourceGraphClient Library with typescript type definitions for node.js and browser.",
"version": "4.1.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^2.0.1",
- "@azure/ms-rest-js": "^2.0.4",
+ "@azure/ms-rest-azure-js": "^2.1.0",
+ "@azure/ms-rest-js": "^2.2.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.10.0"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/resourceGraphClient.js",
"types": "./esm/resourceGraphClient.d.ts",
"devDependencies": {
- "typescript": "^3.5.3",
+ "typescript": "^3.6.0",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts
index 8d1bec988866..5752ef982586 100644
--- a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts
+++ b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts
@@ -11,238 +11,6 @@ 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
*/
@@ -273,6 +41,13 @@ export interface QueryRequestOptions {
* value: false.
*/
allowPartialScopes?: boolean;
+ /**
+ * Defines what level of authorization resources should be returned based on the which
+ * subscriptions and management groups are passed as scopes. Possible values include:
+ * 'AtScopeAndBelow', 'AtScopeAndAbove', 'AtScopeExact', 'AtScopeAboveAndBelow'. Default value:
+ * 'AtScopeAndBelow'.
+ */
+ authorizationScopeFilter?: AuthorizationScopeFilter;
}
/**
@@ -445,6 +220,25 @@ 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.
*/
@@ -463,6 +257,36 @@ 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.
*/
@@ -504,27 +328,72 @@ export interface Operation {
}
/**
- * An interface representing ResourcesHistoryRequestOptions.
+ * 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;
+}
+
+/**
+ * The options for history request evaluation
*/
export interface ResourcesHistoryRequestOptions {
+ /**
+ * The time interval used to fetch history.
+ */
interval?: DateTimeInterval;
+ /**
+ * The maximum number of rows that the query should return. Overrides the page size when
+ * ```$skipToken``` property is present.
+ */
top?: number;
+ /**
+ * The number of rows to skip from the beginning of the results. Overrides the next page offset
+ * when ```$skipToken``` property is present.
+ */
skip?: number;
+ /**
+ * Continuation token for pagination, capturing the next page size and offset, as well as the
+ * context of the query.
+ */
skipToken?: string;
/**
- * Possible values include: 'table', 'objectArray'
+ * Defines in which format query result returned. Possible values include: 'table', 'objectArray'
*/
- resultFormat?: ResultFormat1;
+ resultFormat?: ResultFormat;
}
/**
- * An interface representing ResourcesHistoryRequest.
+ * Describes a history request to be executed.
*/
export interface ResourcesHistoryRequest {
+ /**
+ * Azure subscriptions against which to execute the query.
+ */
subscriptions?: string[];
+ /**
+ * The resources query.
+ */
query?: string;
+ /**
+ * The history request evaluation options
+ */
options?: ResourcesHistoryRequestOptions;
- managementGroupId?: string;
+ /**
+ * Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ]
+ */
+ managementGroups?: string[];
}
/**
@@ -540,39 +409,25 @@ export interface ResourceGraphClientOptions extends AzureServiceClientOptions {
* URL link to get the next set of results.
* @extends Array
*/
-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";
+export interface OperationListResult extends Array {
+}
/**
- * Defines values for PropertyChangeType.
- * Possible values include: 'Insert', 'Update', 'Remove'
+ * Defines values for ResultFormat.
+ * Possible values include: 'table', 'objectArray'
* @readonly
* @enum {string}
*/
-export type PropertyChangeType = "Insert" | "Update" | "Remove";
+export type ResultFormat = 'table' | 'objectArray';
/**
- * Defines values for ResultFormat.
- * Possible values include: 'table', 'objectArray'
+ * Defines values for AuthorizationScopeFilter.
+ * Possible values include: 'AtScopeAndBelow', 'AtScopeAndAbove', 'AtScopeExact',
+ * 'AtScopeAboveAndBelow'
* @readonly
* @enum {string}
*/
-export type ResultFormat = "table" | "objectArray";
+export type AuthorizationScopeFilter = 'AtScopeAndBelow' | 'AtScopeAndAbove' | 'AtScopeExact' | 'AtScopeAboveAndBelow';
/**
* Defines values for FacetSortOrder.
@@ -580,7 +435,7 @@ export type ResultFormat = "table" | "objectArray";
* @readonly
* @enum {string}
*/
-export type FacetSortOrder = "asc" | "desc";
+export type FacetSortOrder = 'asc' | 'desc';
/**
* Defines values for ResultTruncated.
@@ -588,7 +443,7 @@ export type FacetSortOrder = "asc" | "desc";
* @readonly
* @enum {string}
*/
-export type ResultTruncated = "true" | "false";
+export type ResultTruncated = 'true' | 'false';
/**
* Defines values for ColumnDataType.
@@ -596,55 +451,7 @@ export type ResultTruncated = "true" | "false";
* @readonly
* @enum {string}
*/
-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[];
- };
-};
+export type ColumnDataType = 'string' | 'integer' | 'number' | 'boolean' | 'object';
/**
* Contains response data for the resources operation.
@@ -654,16 +461,16 @@ export type ResourcesResponse = QueryResponse & {
* 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: QueryResponse;
- };
+ /**
+ * The response body as text (string format)
+ */
+ bodyAsText: string;
+
+ /**
+ * The response body as parsed JSON or XML
+ */
+ parsedBody: QueryResponse;
+ };
};
/**
@@ -679,16 +486,16 @@ export type ResourcesHistoryResponse = {
* 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;
- };
+ /**
+ * The response body as text (string format)
+ */
+ bodyAsText: string;
+
+ /**
+ * The response body as parsed JSON or XML
+ */
+ parsedBody: any;
+ };
};
/**
@@ -699,14 +506,14 @@ export type OperationsListResponse = OperationListResult & {
* 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: OperationListResult;
- };
+ /**
+ * The response body as text (string format)
+ */
+ bodyAsText: string;
+
+ /**
+ * The response body as parsed JSON or XML
+ */
+ parsedBody: OperationListResult;
+ };
};
diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts
index 55be1b49bb96..dbdd4dcc6115 100644
--- a/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts
+++ b/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts
@@ -12,414 +12,6 @@ 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: {
@@ -453,10 +45,13 @@ export const QueryRequestOptions: msRest.CompositeMapper = {
},
resultFormat: {
serializedName: "resultFormat",
- defaultValue: "objectArray",
+ defaultValue: 'objectArray',
type: {
name: "Enum",
- allowedValues: ["table", "objectArray"]
+ allowedValues: [
+ "table",
+ "objectArray"
+ ]
}
},
allowPartialScopes: {
@@ -465,6 +60,19 @@ export const QueryRequestOptions: msRest.CompositeMapper = {
type: {
name: "Boolean"
}
+ },
+ authorizationScopeFilter: {
+ serializedName: "authorizationScopeFilter",
+ defaultValue: 'AtScopeAndBelow',
+ type: {
+ name: "Enum",
+ allowedValues: [
+ "AtScopeAndBelow",
+ "AtScopeAndAbove",
+ "AtScopeExact",
+ "AtScopeAboveAndBelow"
+ ]
+ }
}
}
}
@@ -484,10 +92,13 @@ export const FacetRequestOptions: msRest.CompositeMapper = {
},
sortOrder: {
serializedName: "sortOrder",
- defaultValue: "desc",
+ defaultValue: 'desc',
type: {
name: "Enum",
- allowedValues: ["asc", "desc"]
+ allowedValues: [
+ "asc",
+ "desc"
+ ]
}
},
filter: {
@@ -646,7 +257,10 @@ export const QueryResponse: msRest.CompositeMapper = {
serializedName: "resultTruncated",
type: {
name: "Enum",
- allowedValues: ["true", "false"]
+ allowedValues: [
+ "true",
+ "false"
+ ]
}
},
skipToken: {
@@ -696,7 +310,13 @@ export const Column: msRest.CompositeMapper = {
serializedName: "type",
type: {
name: "Enum",
- allowedValues: ["string", "integer", "number", "boolean", "object"]
+ allowedValues: [
+ "string",
+ "integer",
+ "number",
+ "boolean",
+ "object"
+ ]
}
}
}
@@ -777,6 +397,35 @@ 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: {
@@ -808,6 +457,65 @@ export const FacetError: msRest.CompositeMapper = {
}
};
+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 OperationDisplay: msRest.CompositeMapper = {
serializedName: "Operation_display",
type: {
@@ -871,6 +579,30 @@ 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 ResourcesHistoryRequestOptions: msRest.CompositeMapper = {
serializedName: "ResourcesHistoryRequestOptions",
type: {
@@ -886,12 +618,19 @@ export const ResourcesHistoryRequestOptions: msRest.CompositeMapper = {
},
top: {
serializedName: "$top",
+ constraints: {
+ InclusiveMaximum: 1000,
+ InclusiveMinimum: 1
+ },
type: {
name: "Number"
}
},
skip: {
serializedName: "$skip",
+ constraints: {
+ InclusiveMinimum: 0
+ },
type: {
name: "Number"
}
@@ -905,7 +644,11 @@ export const ResourcesHistoryRequestOptions: msRest.CompositeMapper = {
resultFormat: {
serializedName: "resultFormat",
type: {
- name: "String"
+ name: "Enum",
+ allowedValues: [
+ "table",
+ "objectArray"
+ ]
}
}
}
@@ -942,10 +685,15 @@ export const ResourcesHistoryRequest: msRest.CompositeMapper = {
className: "ResourcesHistoryRequestOptions"
}
},
- managementGroupId: {
- serializedName: "managementGroupId",
+ managementGroups: {
+ serializedName: "managementGroups",
type: {
- name: "String"
+ name: "Sequence",
+ element: {
+ type: {
+ name: "String"
+ }
+ }
}
}
}
@@ -975,7 +723,8 @@ export const OperationListResult: msRest.CompositeMapper = {
};
export const discriminators = {
- Facet: Facet,
- "Facet.FacetResult": FacetResult,
- "Facet.FacetError": FacetError
+ 'Facet' : Facet,
+ 'Facet.FacetResult' : FacetResult,
+ 'Facet.FacetError' : FacetError
+
};
diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts
index 9d39f7b83eb0..424f07a3a384 100644
--- a/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts
+++ b/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts
@@ -13,43 +13,17 @@ export const acceptLanguage: msRest.OperationParameter = {
parameterPath: "acceptLanguage",
mapper: {
serializedName: "accept-language",
- defaultValue: "en-US",
+ defaultValue: 'en-US',
type: {
name: "String"
}
}
};
-export const apiVersion0: msRest.OperationQueryParameter = {
+export const apiVersion: 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: "2021-03-01",
- type: {
- name: "String"
- }
- }
-};
-export const apiVersion2: 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/operations.ts b/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts
index 475f4ecf68ce..63c8df66b658 100644
--- a/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts
+++ b/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts
@@ -39,21 +39,14 @@ export class Operations {
* @param options The optional parameters
* @param callback The callback
*/
- list(
- options: msRest.RequestOptionsBase,
- callback: msRest.ServiceCallback
- ): void;
- list(
- options?: msRest.RequestOptionsBase | msRest.ServiceCallback,
- callback?: msRest.ServiceCallback
- ): Promise {
+ list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void;
+ list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise {
return this.client.sendOperationRequest(
{
options
},
listOperationSpec,
- callback
- ) as Promise;
+ callback) as Promise;
}
}
@@ -62,8 +55,12 @@ const serializer = new msRest.Serializer(Mappers);
const listOperationSpec: msRest.OperationSpec = {
httpMethod: "GET",
path: "providers/Microsoft.ResourceGraph/operations",
- queryParameters: [Parameters.apiVersion1],
- headerParameters: [Parameters.acceptLanguage],
+ queryParameters: [
+ Parameters.apiVersion
+ ],
+ headerParameters: [
+ Parameters.acceptLanguage
+ ],
responses: {
200: {
bodyMapper: Mappers.OperationListResult
diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts
index c10ca6faa968..acf19530c672 100644
--- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts
+++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts
@@ -8,266 +8,101 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as Parameters from "./models/parameters";
import * as operations from "./operations";
import { ResourceGraphClientContext } from "./resourceGraphClientContext";
+
class ResourceGraphClient extends ResourceGraphClientContext {
// Operation groups
operations: operations.Operations;
/**
* Initializes a new instance of the ResourceGraphClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param [options] The parameter options
*/
- constructor(
- credentials: msRest.ServiceClientCredentials,
- options?: Models.ResourceGraphClientOptions
- ) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, options?: Models.ResourceGraphClientOptions) {
super(credentials, options);
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 scopes specified in the request.
* @param query Request specifying query and its options.
* @param [options] The optional parameters
* @returns Promise
*/
- resources(
- query: Models.QueryRequest,
- options?: msRest.RequestOptionsBase
- ): Promise;
+ resources(query: Models.QueryRequest, options?: msRest.RequestOptionsBase): Promise;
/**
* @param query Request specifying query and its options.
* @param callback The callback
*/
- resources(
- query: Models.QueryRequest,
- callback: msRest.ServiceCallback
- ): void;
+ resources(query: Models.QueryRequest, callback: msRest.ServiceCallback): void;
/**
* @param query Request specifying query and its options.
* @param options The optional parameters
* @param callback The callback
*/
- resources(
- query: Models.QueryRequest,
- options: msRest.RequestOptionsBase,
- callback: msRest.ServiceCallback
- ): void;
- resources(
- query: Models.QueryRequest,
- options?: msRest.RequestOptionsBase | msRest.ServiceCallback,
- callback?: msRest.ServiceCallback
- ): Promise {
+ resources(query: Models.QueryRequest, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void;
+ resources(query: Models.QueryRequest, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise {
return this.sendOperationRequest(
{
query,
options
},
resourcesOperationSpec,
- callback
- ) as Promise;
+ callback) as Promise;
}
/**
* List all snapshots of a resource for a given time interval.
- * @param request
+ * @param request Request specifying the query and its options.
* @param [options] The optional parameters
* @returns Promise
*/
- resourcesHistory(
- request: Models.ResourcesHistoryRequest,
- options?: msRest.RequestOptionsBase
- ): Promise;
+ resourcesHistory(request: Models.ResourcesHistoryRequest, options?: msRest.RequestOptionsBase): Promise;
/**
- * @param request
+ * @param request Request specifying the query and its options.
* @param callback The callback
*/
- resourcesHistory(
- request: Models.ResourcesHistoryRequest,
- callback: msRest.ServiceCallback
- ): void;
+ resourcesHistory(request: Models.ResourcesHistoryRequest, callback: msRest.ServiceCallback): void;
/**
- * @param request
+ * @param request Request specifying the query and its options.
* @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 {
+ 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;
+ 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.apiVersion1],
- headerParameters: [Parameters.acceptLanguage],
+ queryParameters: [
+ Parameters.apiVersion
+ ],
+ headerParameters: [
+ Parameters.acceptLanguage
+ ],
requestBody: {
parameterPath: "query",
mapper: {
@@ -289,8 +124,12 @@ const resourcesOperationSpec: msRest.OperationSpec = {
const resourcesHistoryOperationSpec: msRest.OperationSpec = {
httpMethod: "POST",
path: "providers/Microsoft.ResourceGraph/resourcesHistory",
- queryParameters: [Parameters.apiVersion2],
- headerParameters: [Parameters.acceptLanguage],
+ queryParameters: [
+ Parameters.apiVersion
+ ],
+ headerParameters: [
+ Parameters.acceptLanguage
+ ],
requestBody: {
parameterPath: "request",
mapper: {
diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts
index 16131061fc42..04eb50be293c 100644
--- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts
+++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts
@@ -10,24 +10,28 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
+import { TokenCredential } from "@azure/core-auth";
const packageName = "@azure/arm-resourcegraph";
const packageVersion = "4.1.0";
export class ResourceGraphClientContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
+ apiVersion?: string;
/**
* Initializes a new instance of the ResourceGraphClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param [options] The parameter options
*/
- constructor(
- credentials: msRest.ServiceClientCredentials,
- options?: Models.ResourceGraphClientOptions
- ) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, options?: Models.ResourceGraphClientOptions) {
if (credentials == undefined) {
- throw new Error("'credentials' cannot be null.");
+ throw new Error('\'credentials\' cannot be null.');
}
if (!options) {
@@ -40,7 +44,8 @@ export class ResourceGraphClientContext extends msRestAzure.AzureServiceClient {
super(credentials, options);
- this.acceptLanguage = "en-US";
+ this.apiVersion = '2021-06-01-preview';
+ this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
this.requestContentType = "application/json; charset=utf-8";
@@ -49,10 +54,7 @@ export class ResourceGraphClientContext extends msRestAzure.AzureServiceClient {
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;
}
}