* changes-track2-release

* update
This commit is contained in:
colawwj 2022-05-18 12:24:59 +08:00 коммит произвёл GitHub
Родитель 8c5a83d97d
Коммит d292c804a6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
38 изменённых файлов: 2322 добавлений и 2 удалений

Просмотреть файл

@ -30,6 +30,7 @@ specifiers:
'@rush-temp/arm-botservice': file:./projects/arm-botservice.tgz
'@rush-temp/arm-cdn': file:./projects/arm-cdn.tgz
'@rush-temp/arm-changeanalysis': file:./projects/arm-changeanalysis.tgz
'@rush-temp/arm-changes': file:./projects/arm-changes.tgz
'@rush-temp/arm-cognitiveservices': file:./projects/arm-cognitiveservices.tgz
'@rush-temp/arm-commerce': file:./projects/arm-commerce.tgz
'@rush-temp/arm-commerce-profile-2020-09-01-hybrid': file:./projects/arm-commerce-profile-2020-09-01-hybrid.tgz
@ -306,6 +307,7 @@ dependencies:
'@rush-temp/arm-botservice': file:projects/arm-botservice.tgz
'@rush-temp/arm-cdn': file:projects/arm-cdn.tgz
'@rush-temp/arm-changeanalysis': file:projects/arm-changeanalysis.tgz
'@rush-temp/arm-changes': file:projects/arm-changes.tgz
'@rush-temp/arm-cognitiveservices': file:projects/arm-cognitiveservices.tgz
'@rush-temp/arm-commerce': file:projects/arm-commerce.tgz
'@rush-temp/arm-commerce-profile-2020-09-01-hybrid': file:projects/arm-commerce-profile-2020-09-01-hybrid.tgz
@ -10015,6 +10017,34 @@ packages:
- supports-color
dev: false
file:projects/arm-changes.tgz:
resolution: {integrity: sha512-GjRZp1vTGS8ob6+d9JPg6a4LlbRmyEUnbqqK8melwrygg3PU1tAXFTE547m4vYiOVd/tARv7Z3Ty6cvykdGrAg==, tarball: file:projects/arm-changes.tgz}
name: '@rush-temp/arm-changes'
version: 0.0.0
dependencies:
'@azure-tools/test-recorder': 1.0.2
'@azure/identity': 2.0.4
'@microsoft/api-extractor': 7.18.11
'@rollup/plugin-commonjs': 21.1.0_rollup@2.73.0
'@rollup/plugin-json': 4.1.0_rollup@2.73.0
'@rollup/plugin-multi-entry': 4.1.0_rollup@2.73.0
'@rollup/plugin-node-resolve': 13.3.0_rollup@2.73.0
cross-env: 7.0.3
mkdirp: 1.0.4
mocha: 7.2.0
rimraf: 3.0.2
rollup: 2.73.0
rollup-plugin-sourcemaps: 0.6.3_rollup@2.73.0
tslib: 2.4.0
typescript: 4.2.4
uglify-js: 3.15.5
transitivePeerDependencies:
- '@types/node'
- debug
- encoding
- supports-color
dev: false
file:projects/arm-cognitiveservices.tgz:
resolution: {integrity: sha512-qRWhhPLtY+lfmRCzhOu3ZmyHFqghatlowWp5E0tWr0ck8fae0/EqwGhJT2lmpRoyMD8GwPoj/c0Fy6wLaiblKg==, tarball: file:projects/arm-cognitiveservices.tgz}
name: '@rush-temp/arm-cognitiveservices'

Просмотреть файл

@ -18,3 +18,5 @@ https://docs.microsoft.com/javascript/api/@azure/arm-scvmm?view=azure-node-previ
https://docs.microsoft.com/javascript/api/@azure/arm-servicelinker
https://docs.microsoft.com/javascript/api/@azure/arm-servicelinker?view=azure-node-preview
https://docs.microsoft.com/en-us/rest/api/index
https://docs.microsoft.com/javascript/api/@azure/arm-changes?view=azure-node-preview
https://docs.microsoft.com/javascript/api/@azure/arm-changes

Просмотреть файл

@ -1,7 +1,7 @@
/**
* This is the main configuration file for Rush.
* For full documentation, please see https://rushjs.io
*/ {
*/{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json",
/**
* (Required) This specifies the version of the Rush engine to be used in this repo.
@ -1690,6 +1690,11 @@
"packageName": "@azure/arm-servicelinker",
"projectFolder": "sdk/servicelinker/arm-servicelinker",
"versionPolicyName": "management"
},
{
"packageName": "@azure/arm-changes",
"projectFolder": "sdk/changes/arm-changes",
"versionPolicyName": "management"
}
]
}
}

Просмотреть файл

@ -0,0 +1,5 @@
# Release History
## 1.0.0 (2022-05-09)
The package of @azure/arm-changes is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart).

Просмотреть файл

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2022 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
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Просмотреть файл

@ -0,0 +1,109 @@
# Azure Changes client library for JavaScript
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Changes client.
The Resource Changes Client
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/changes/arm-changes) |
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-changes) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-changes) |
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
## Getting started
### Currently supported environments
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge and Firefox.
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
### Prerequisites
- An [Azure subscription][azure_sub].
### Install the `@azure/arm-changes` package
Install the Azure Changes client library for JavaScript with `npm`:
```bash
npm install @azure/arm-changes
```
### Create and authenticate a `ChangesClient`
To create a client object to access the Azure Changes API, you will need the `endpoint` of your Azure Changes resource and a `credential`. The Azure Changes client can use Azure Active Directory credentials to authenticate.
You can find the endpoint for your Azure Changes resource in the [Azure Portal][azure_portal].
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
```bash
npm install @azure/identity
```
You will also need to **register a new AAD application and grant access to Azure Changes** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
```javascript
const { ChangesClient } = require("@azure/arm-changes");
const { DefaultAzureCredential } = require("@azure/identity");
// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ChangesClient(new DefaultAzureCredential(), subscriptionId);
// For client-side applications running in the browser, use this code instead:
// const credential = new InteractiveBrowserCredential({
// tenantId: "<YOUR_TENANT_ID>",
// clientId: "<YOUR_CLIENT_ID>"
// });
// const client = new ChangesClient(credential, subscriptionId);
```
### JavaScript Bundle
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
## Key concepts
### ChangesClient
`ChangesClient` is the primary interface for developers using the Azure Changes client library. Explore the methods on this client object to understand the different features of the Azure Changes service that you can access.
## Troubleshooting
### Logging
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
```javascript
const { setLogLevel } = require("@azure/logger");
setLogLevel("info");
```
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
## Next steps
Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library.
## Contributing
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
## Related projects
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fchanges%2Farm-changes%2FREADME.png)
[azure_cli]: https://docs.microsoft.com/cli/azure
[azure_sub]: https://azure.microsoft.com/free/
[azure_sub]: https://azure.microsoft.com/free/
[azure_portal]: https://portal.azure.com
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential

Просмотреть файл

@ -0,0 +1,8 @@
{
"commit": "ee15422a60409285806e1673e191fe69333a7743",
"readme": "specification/resources/resource-manager/readme.md",
"autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\resources\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.3.0",
"use": "@autorest/typescript@6.0.0-alpha.19.20220408.1"
}

Просмотреть файл

@ -0,0 +1,31 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./dist-esm/src/index.d.ts",
"docModel": {
"enabled": true
},
"apiReport": {
"enabled": true,
"reportFolder": "./review"
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./types/arm-changes.d.ts"
},
"messages": {
"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
},
"extractorMessageReporting": {
"ae-missing-release-tag": {
"logLevel": "none"
},
"ae-unresolved-link": {
"logLevel": "none"
}
}
}
}

Просмотреть файл

@ -0,0 +1,116 @@
{
"name": "@azure/arm-changes",
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for ChangesClient.",
"version": "1.0.0",
"engines": {
"node": ">=12.0.0"
},
"dependencies": {
"@azure/core-paging": "^1.2.0",
"@azure/core-client": "^1.5.0",
"@azure/core-auth": "^1.3.0",
"@azure/core-rest-pipeline": "^1.8.0",
"tslib": "^2.2.0"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist-esm/src/index.js",
"types": "./types/arm-changes.d.ts",
"devDependencies": {
"@microsoft/api-extractor": "7.18.11",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-multi-entry": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"mkdirp": "^1.0.4",
"rollup": "^2.66.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"typescript": "~4.2.0",
"uglify-js": "^3.4.9",
"rimraf": "^3.0.0",
"@azure/identity": "^2.0.1",
"@azure-tools/test-recorder": "^1.0.0",
"mocha": "^7.1.1",
"cross-env": "^7.0.2"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/changes/arm-changes",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
},
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"files": [
"dist/**/*.js",
"dist/**/*.js.map",
"dist/**/*.d.ts",
"dist/**/*.d.ts.map",
"dist-esm/**/*.js",
"dist-esm/**/*.js.map",
"dist-esm/**/*.d.ts",
"dist-esm/**/*.d.ts.map",
"src/**/*.ts",
"README.md",
"LICENSE",
"rollup.config.js",
"tsconfig.json",
"review/*",
"CHANGELOG.md",
"types/*"
],
"scripts": {
"build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
"prepack": "npm run build",
"pack": "npm pack 2>&1",
"extract-api": "api-extractor run --local",
"lint": "echo skipped",
"audit": "echo skipped",
"clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"build:node": "echo skipped",
"build:browser": "echo skipped",
"build:test": "echo skipped",
"build:samples": "echo skipped.",
"check-format": "echo skipped",
"execute:samples": "echo skipped",
"format": "echo skipped",
"test": "npm run integration-test",
"test:node": "echo skipped",
"test:browser": "echo skipped",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
"unit-test:browser": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
"integration-test:browser": "echo skipped",
"docs": "echo skipped"
},
"sideEffects": false,
"//metadata": {
"constantPaths": [
{
"path": "src/changesClient.ts",
"prefix": "packageDetails"
}
]
},
"autoPublish": true,
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-changes?view=azure-node-preview"
}
}

Просмотреть файл

@ -0,0 +1,5 @@
let nock = require('nock');
module.exports.hash = "7a6be38bb8cb644d64b4094802301751";
module.exports.testInfo = {"uniqueName":{},"newDate":{}}

Просмотреть файл

@ -0,0 +1,139 @@
## API Report File for "@azure/arm-changes"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import * as coreAuth from '@azure/core-auth';
import * as coreClient from '@azure/core-client';
import { PagedAsyncIterableIterator } from '@azure/core-paging';
// @public
export interface ChangeAttributes {
readonly changesCount?: number;
readonly correlationId?: string;
readonly newResourceSnapshotId?: string;
readonly previousResourceSnapshotId?: string;
readonly timestamp?: string;
}
// @public
export interface ChangeBase {
readonly changeCategory?: ChangeCategory;
readonly newValue?: string;
readonly previousValue?: string;
readonly propertyChangeType?: PropertyChangeType;
}
// @public
export type ChangeCategory = "User" | "System";
// @public
export interface ChangeProperties {
changeAttributes?: ChangeAttributes;
changes?: {
[propertyName: string]: ChangeBase;
};
readonly changeType?: ChangeType;
readonly targetResourceId?: string;
readonly targetResourceType?: string;
}
// @public
export interface ChangeResourceListResult {
nextLink?: string;
value?: ChangeResourceResult[];
}
// @public
export type ChangeResourceResult = Resource & {
properties?: ChangeProperties;
};
// @public
export interface Changes {
get(resourceGroupName: string, resourceProviderNamespace: string, resourceType: string, resourceName: string, changeResourceId: string, options?: ChangesGetOptionalParams): Promise<ChangesGetResponse>;
list(resourceGroupName: string, resourceProviderNamespace: string, resourceType: string, resourceName: string, options?: ChangesListOptionalParams): PagedAsyncIterableIterator<ChangeResourceResult>;
}
// @public (undocumented)
export class ChangesClient extends coreClient.ServiceClient {
// (undocumented)
$host: string;
constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ChangesClientOptionalParams);
// (undocumented)
apiVersion: string;
// (undocumented)
changes: Changes;
// (undocumented)
subscriptionId: string;
}
// @public
export interface ChangesClientOptionalParams extends coreClient.ServiceClientOptions {
$host?: string;
apiVersion?: string;
endpoint?: string;
}
// @public
export interface ChangesGetOptionalParams extends coreClient.OperationOptions {
}
// @public
export type ChangesGetResponse = ChangeResourceResult;
// @public
export interface ChangesListNextOptionalParams extends coreClient.OperationOptions {
skipToken?: string;
top?: number;
}
// @public
export type ChangesListNextResponse = ChangeResourceListResult;
// @public
export interface ChangesListOptionalParams extends coreClient.OperationOptions {
skipToken?: string;
top?: number;
}
// @public
export type ChangesListResponse = ChangeResourceListResult;
// @public
export type ChangeType = "Update" | "Delete" | "Create";
// @public
export interface ErrorAdditionalInfo {
readonly info?: Record<string, unknown>;
readonly type?: string;
}
// @public
export interface ErrorDetail {
readonly additionalInfo?: ErrorAdditionalInfo[];
readonly code?: string;
readonly details?: ErrorDetail[];
readonly message?: string;
readonly target?: string;
}
// @public
export interface ErrorResponse {
error?: ErrorDetail;
}
// @public
export type PropertyChangeType = "Update" | "Insert" | "Remove";
// @public
export interface Resource {
readonly id?: string;
readonly name?: string;
readonly type?: string;
}
// (No @packageDocumentation comment for this package)
```

Просмотреть файл

@ -0,0 +1,122 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import nodeResolve from "@rollup/plugin-node-resolve";
import cjs from "@rollup/plugin-commonjs";
import sourcemaps from "rollup-plugin-sourcemaps";
import multiEntry from "@rollup/plugin-multi-entry";
import json from "@rollup/plugin-json";
import nodeBuiltins from "builtin-modules";
// #region Warning Handler
/**
* A function that can determine whether a rollup warning should be ignored. If
* the function returns `true`, then the warning will not be displayed.
*/
function ignoreNiseSinonEval(warning) {
return (
warning.code === "EVAL" &&
warning.id &&
(warning.id.includes("node_modules/nise") ||
warning.id.includes("node_modules/sinon")) === true
);
}
function ignoreChaiCircularDependency(warning) {
return (
warning.code === "CIRCULAR_DEPENDENCY" &&
warning.importer && warning.importer.includes("node_modules/chai") === true
);
}
const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
/**
* Construct a warning handler for the shared rollup configuration
* that ignores certain warnings that are not relevant to testing.
*/
function makeOnWarnForTesting() {
return (warning, warn) => {
// If every inhibitor returns false (i.e. no inhibitors), then show the warning
if (warningInhibitors.every((inhib) => !inhib(warning))) {
warn(warning);
}
};
}
// #endregion
function makeBrowserTestConfig() {
const config = {
input: {
include: ["dist-esm/test/**/*.spec.js"],
exclude: ["dist-esm/test/**/node/**"]
},
output: {
file: `dist-test/index.browser.js`,
format: "umd",
sourcemap: true
},
preserveSymlinks: false,
plugins: [
multiEntry({ exports: false }),
nodeResolve({
mainFields: ["module", "browser"]
}),
cjs(),
json(),
sourcemaps()
//viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
],
onwarn: makeOnWarnForTesting(),
// Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
// rollup started respecting the "sideEffects" field in package.json. Since
// our package.json sets "sideEffects=false", this also applies to test
// code, which causes all tests to be removed by tree-shaking.
treeshake: false
};
return config;
}
const defaultConfigurationOptions = {
disableBrowserBundle: false
};
export function makeConfig(pkg, options) {
options = {
...defaultConfigurationOptions,
...(options || {})
};
const baseConfig = {
// Use the package's module field if it has one
input: pkg["module"] || "dist-esm/src/index.js",
external: [
...nodeBuiltins,
...Object.keys(pkg.dependencies),
...Object.keys(pkg.devDependencies)
],
output: { file: "dist/index.js", format: "cjs", sourcemap: true },
preserveSymlinks: false,
plugins: [sourcemaps(), nodeResolve()]
};
const config = [baseConfig];
if (!options.disableBrowserBundle) {
config.push(makeBrowserTestConfig());
}
return config;
}
export default makeConfig(require("./package.json"));

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ChangesClient } from "@azure/arm-changes";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to Obtains the specified change resource for the target resource
*
* @summary Obtains the specified change resource for the target resource
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/GetChange.json
*/
async function getChange() {
const subscriptionId = "subscriptionId1";
const resourceGroupName = "resourceGroup1";
const resourceProviderNamespace = "resourceProvider1";
const resourceType = "resourceType1";
const resourceName = "resourceName1";
const changeResourceId = "1d58d72f-0719-4a48-9228-b7ea682885bf";
const credential = new DefaultAzureCredential();
const client = new ChangesClient(credential, subscriptionId);
const result = await client.changes.get(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
changeResourceId
);
console.log(result);
}
getChange().catch(console.error);

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ChangesClient } from "@azure/arm-changes";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to Obtains a list of change resources from the past 14 days for the target resource
*
* @summary Obtains a list of change resources from the past 14 days for the target resource
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/ListChanges.json
*/
async function listChanges() {
const subscriptionId = "subscriptionId1";
const resourceGroupName = "resourceGroup1";
const resourceProviderNamespace = "resourceProvider1";
const resourceType = "resourceType1";
const resourceName = "resourceName1";
const credential = new DefaultAzureCredential();
const client = new ChangesClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.changes.list(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName
)) {
resArray.push(item);
}
console.log(resArray);
}
listChanges().catch(console.error);

Просмотреть файл

@ -0,0 +1,52 @@
# client library samples for JavaScript
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [changesGetSample.js][changesgetsample] | Obtains the specified change resource for the target resource x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/GetChange.json |
| [changesListSample.js][changeslistsample] | Obtains a list of change resources from the past 14 days for the target resource x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/ListChanges.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node changesGetSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env node changesGetSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[changesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/changes/arm-changes/samples/v1/javascript/changesGetSample.js
[changeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/changes/arm-changes/samples/v1/javascript/changesListSample.js
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-changes?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/changes/arm-changes/README.md

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ChangesClient } = require("@azure/arm-changes");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Obtains the specified change resource for the target resource
*
* @summary Obtains the specified change resource for the target resource
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/GetChange.json
*/
async function getChange() {
const subscriptionId = "subscriptionId1";
const resourceGroupName = "resourceGroup1";
const resourceProviderNamespace = "resourceProvider1";
const resourceType = "resourceType1";
const resourceName = "resourceName1";
const changeResourceId = "1d58d72f-0719-4a48-9228-b7ea682885bf";
const credential = new DefaultAzureCredential();
const client = new ChangesClient(credential, subscriptionId);
const result = await client.changes.get(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
changeResourceId
);
console.log(result);
}
getChange().catch(console.error);

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { ChangesClient } = require("@azure/arm-changes");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Obtains a list of change resources from the past 14 days for the target resource
*
* @summary Obtains a list of change resources from the past 14 days for the target resource
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/ListChanges.json
*/
async function listChanges() {
const subscriptionId = "subscriptionId1";
const resourceGroupName = "resourceGroup1";
const resourceProviderNamespace = "resourceProvider1";
const resourceType = "resourceType1";
const resourceName = "resourceName1";
const credential = new DefaultAzureCredential();
const client = new ChangesClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.changes.list(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName
)) {
resArray.push(item);
}
console.log(resArray);
}
listChanges().catch(console.error);

Просмотреть файл

@ -0,0 +1,32 @@
{
"name": "@azure-samples/arm-changes-js",
"private": true,
"version": "1.0.0",
"description": " client library samples for JavaScript",
"engines": {
"node": ">=12.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/changes/arm-changes"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/changes/arm-changes",
"dependencies": {
"@azure/arm-changes": "latest",
"dotenv": "latest",
"@azure/identity": "^2.0.1"
}
}

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,65 @@
# client library samples for TypeScript
These sample programs show how to use the TypeScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [changesGetSample.ts][changesgetsample] | Obtains the specified change resource for the target resource x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/GetChange.json |
| [changesListSample.ts][changeslistsample] | Obtains a list of change resources from the past 14 days for the target resource x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/ListChanges.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
```bash
npm install -g typescript
```
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Compile the samples:
```bash
npm run build
```
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node dist/changesGetSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env node dist/changesGetSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[changesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/changes/arm-changes/samples/v1/typescript/src/changesGetSample.ts
[changeslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/changes/arm-changes/samples/v1/typescript/src/changesListSample.ts
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-changes?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/changes/arm-changes/README.md
[typescript]: https://www.typescriptlang.org/docs/home.html

Просмотреть файл

@ -0,0 +1,41 @@
{
"name": "@azure-samples/arm-changes-ts",
"private": true,
"version": "1.0.0",
"description": " client library samples for TypeScript",
"engines": {
"node": ">=12.0.0"
},
"scripts": {
"build": "tsc",
"prebuild": "rimraf dist/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/changes/arm-changes"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/changes/arm-changes",
"dependencies": {
"@azure/arm-changes": "latest",
"dotenv": "latest",
"@azure/identity": "^2.0.1"
},
"devDependencies": {
"@types/node": "^12.0.0",
"typescript": "~4.4.0",
"rimraf": "latest"
}
}

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ChangesClient } from "@azure/arm-changes";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to Obtains the specified change resource for the target resource
*
* @summary Obtains the specified change resource for the target resource
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/GetChange.json
*/
async function getChange() {
const subscriptionId = "subscriptionId1";
const resourceGroupName = "resourceGroup1";
const resourceProviderNamespace = "resourceProvider1";
const resourceType = "resourceType1";
const resourceName = "resourceName1";
const changeResourceId = "1d58d72f-0719-4a48-9228-b7ea682885bf";
const credential = new DefaultAzureCredential();
const client = new ChangesClient(credential, subscriptionId);
const result = await client.changes.get(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
changeResourceId
);
console.log(result);
}
getChange().catch(console.error);

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ChangesClient } from "@azure/arm-changes";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to Obtains a list of change resources from the past 14 days for the target resource
*
* @summary Obtains a list of change resources from the past 14 days for the target resource
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/ListChanges.json
*/
async function listChanges() {
const subscriptionId = "subscriptionId1";
const resourceGroupName = "resourceGroup1";
const resourceProviderNamespace = "resourceProvider1";
const resourceType = "resourceType1";
const resourceName = "resourceName1";
const credential = new DefaultAzureCredential();
const client = new ChangesClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.changes.list(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName
)) {
resArray.push(item);
}
console.log(resArray);
}
listChanges().catch(console.error);

Просмотреть файл

@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2018",
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"alwaysStrict": true,
"outDir": "dist",
"rootDir": "src"
},
"include": [
"src/**.ts"
]
}

Просмотреть файл

@ -0,0 +1,101 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as coreClient from "@azure/core-client";
import * as coreRestPipeline from "@azure/core-rest-pipeline";
import * as coreAuth from "@azure/core-auth";
import { ChangesImpl } from "./operations";
import { Changes } from "./operationsInterfaces";
import { ChangesClientOptionalParams } from "./models";
export class ChangesClient extends coreClient.ServiceClient {
$host: string;
subscriptionId: string;
apiVersion: string;
/**
* Initializes a new instance of the ChangesClient class.
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g.
* 00000000-0000-0000-0000-000000000000)
* @param options The parameter options
*/
constructor(
credentials: coreAuth.TokenCredential,
subscriptionId: string,
options?: ChangesClientOptionalParams
) {
if (credentials === undefined) {
throw new Error("'credentials' cannot be null");
}
if (subscriptionId === undefined) {
throw new Error("'subscriptionId' cannot be null");
}
// Initializing default values for options
if (!options) {
options = {};
}
const defaults: ChangesClientOptionalParams = {
requestContentType: "application/json; charset=utf-8",
credential: credentials
};
const packageDetails = `azsdk-js-arm-changes/1.0.0`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
: `${packageDetails}`;
if (!options.credentialScopes) {
options.credentialScopes = ["https://management.azure.com/.default"];
}
const optionsWithDefaults = {
...defaults,
...options,
userAgentOptions: {
userAgentPrefix
},
baseUri:
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
};
super(optionsWithDefaults);
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
(pipelinePolicy) =>
pipelinePolicy.name ===
coreRestPipeline.bearerTokenAuthenticationPolicyName
);
if (!bearerTokenAuthenticationPolicyFound) {
this.pipeline.removePolicy({
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
});
this.pipeline.addPolicy(
coreRestPipeline.bearerTokenAuthenticationPolicy({
scopes: `${optionsWithDefaults.baseUri}/.default`,
challengeCallbacks: {
authorizeRequestOnChallenge:
coreClient.authorizeRequestOnClaimChallenge
}
})
);
}
}
// Parameter assignments
this.subscriptionId = subscriptionId;
// Assigning values to Constant parameters
this.$host = options.$host || "https://management.azure.com";
this.apiVersion = options.apiVersion || "2022-05-01";
this.changes = new ChangesImpl(this);
}
changes: Changes;
}

Просмотреть файл

@ -0,0 +1,12 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
/// <reference lib="esnext.asynciterable" />
export * from "./models";
export { ChangesClient } from "./changesClient";
export * from "./operationsInterfaces";

Просмотреть файл

@ -0,0 +1,213 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as coreClient from "@azure/core-client";
/** The list of resources */
export interface ChangeResourceListResult {
/** The link used to get the next page of Change Resources */
nextLink?: string;
/** The list of resources */
value?: ChangeResourceResult[];
}
/** The properties of a change */
export interface ChangeProperties {
/**
* The fully qualified ID of the target resource that was changed
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly targetResourceId?: string;
/**
* The namespace and type of the resource
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly targetResourceType?: string;
/**
* The type of change that was captured in the resource
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly changeType?: ChangeType;
/** Details about the change resource */
changeAttributes?: ChangeAttributes;
/** A dictionary with changed property name as a key and the change details as the value */
changes?: { [propertyName: string]: ChangeBase };
}
/** Details about the change resource */
export interface ChangeAttributes {
/**
* The ARM correlation ID of the change resource
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly correlationId?: string;
/**
* The time the change(s) on the target resource ocurred
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly timestamp?: string;
/**
* The number of changes this resource captures
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly changesCount?: number;
/**
* The GUID of the previous snapshot
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly previousResourceSnapshotId?: string;
/**
* The GUID of the new snapshot
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly newResourceSnapshotId?: string;
}
/** An individual change on the target resource */
export interface ChangeBase {
/**
* The type of change that occurred
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly propertyChangeType?: PropertyChangeType;
/**
* The entity that made the change
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly changeCategory?: ChangeCategory;
/**
* The target resource property value before the change
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly previousValue?: string;
/**
* The target resource property value after the change
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly newValue?: string;
}
/** Common fields that are returned in the response for all Azure Resource Manager resources */
export interface Resource {
/**
* Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly id?: string;
/**
* The name of the resource
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly name?: string;
/**
* The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly type?: string;
}
/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */
export interface ErrorResponse {
/** The error object. */
error?: ErrorDetail;
}
/** The error detail. */
export interface ErrorDetail {
/**
* The error code.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly code?: string;
/**
* The error message.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly message?: string;
/**
* The error target.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly target?: string;
/**
* The error details.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly details?: ErrorDetail[];
/**
* The error additional info.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly additionalInfo?: ErrorAdditionalInfo[];
}
/** The resource management error additional info. */
export interface ErrorAdditionalInfo {
/**
* The additional info type.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly type?: string;
/**
* The additional info.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly info?: Record<string, unknown>;
}
/** Change Resource */
export type ChangeResourceResult = Resource & {
/** The properties of a change */
properties?: ChangeProperties;
};
/** Defines values for ChangeType. */
export type ChangeType = "Update" | "Delete" | "Create";
/** Defines values for PropertyChangeType. */
export type PropertyChangeType = "Update" | "Insert" | "Remove";
/** Defines values for ChangeCategory. */
export type ChangeCategory = "User" | "System";
/** Optional parameters. */
export interface ChangesListOptionalParams extends coreClient.OperationOptions {
/** (Optional) Set the maximum number of results per response. */
top?: number;
/** (Optional) The page-continuation token */
skipToken?: string;
}
/** Contains response data for the list operation. */
export type ChangesListResponse = ChangeResourceListResult;
/** Optional parameters. */
export interface ChangesGetOptionalParams extends coreClient.OperationOptions {}
/** Contains response data for the get operation. */
export type ChangesGetResponse = ChangeResourceResult;
/** Optional parameters. */
export interface ChangesListNextOptionalParams
extends coreClient.OperationOptions {
/** (Optional) Set the maximum number of results per response. */
top?: number;
/** (Optional) The page-continuation token */
skipToken?: string;
}
/** Contains response data for the listNext operation. */
export type ChangesListNextResponse = ChangeResourceListResult;
/** Optional parameters. */
export interface ChangesClientOptionalParams
extends coreClient.ServiceClientOptions {
/** server parameter */
$host?: string;
/** Api Version */
apiVersion?: string;
/** Overrides client endpoint. */
endpoint?: string;
}

Просмотреть файл

@ -0,0 +1,307 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as coreClient from "@azure/core-client";
export const ChangeResourceListResult: coreClient.CompositeMapper = {
type: {
name: "Composite",
className: "ChangeResourceListResult",
modelProperties: {
nextLink: {
serializedName: "nextLink",
type: {
name: "String"
}
},
value: {
serializedName: "value",
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "ChangeResourceResult"
}
}
}
}
}
}
};
export const ChangeProperties: coreClient.CompositeMapper = {
type: {
name: "Composite",
className: "ChangeProperties",
modelProperties: {
targetResourceId: {
serializedName: "targetResourceId",
readOnly: true,
type: {
name: "String"
}
},
targetResourceType: {
serializedName: "targetResourceType",
readOnly: true,
type: {
name: "String"
}
},
changeType: {
serializedName: "changeType",
readOnly: true,
type: {
name: "Enum",
allowedValues: ["Update", "Delete", "Create"]
}
},
changeAttributes: {
serializedName: "changeAttributes",
type: {
name: "Composite",
className: "ChangeAttributes"
}
},
changes: {
serializedName: "changes",
type: {
name: "Dictionary",
value: { type: { name: "Composite", className: "ChangeBase" } }
}
}
}
}
};
export const ChangeAttributes: coreClient.CompositeMapper = {
type: {
name: "Composite",
className: "ChangeAttributes",
modelProperties: {
correlationId: {
serializedName: "correlationId",
readOnly: true,
type: {
name: "String"
}
},
timestamp: {
serializedName: "timestamp",
readOnly: true,
type: {
name: "String"
}
},
changesCount: {
serializedName: "changesCount",
readOnly: true,
type: {
name: "Number"
}
},
previousResourceSnapshotId: {
serializedName: "previousResourceSnapshotId",
readOnly: true,
type: {
name: "String"
}
},
newResourceSnapshotId: {
serializedName: "newResourceSnapshotId",
readOnly: true,
type: {
name: "String"
}
}
}
}
};
export const ChangeBase: coreClient.CompositeMapper = {
type: {
name: "Composite",
className: "ChangeBase",
modelProperties: {
propertyChangeType: {
serializedName: "propertyChangeType",
readOnly: true,
type: {
name: "Enum",
allowedValues: ["Update", "Insert", "Remove"]
}
},
changeCategory: {
serializedName: "changeCategory",
readOnly: true,
type: {
name: "Enum",
allowedValues: ["User", "System"]
}
},
previousValue: {
serializedName: "previousValue",
readOnly: true,
type: {
name: "String"
}
},
newValue: {
serializedName: "newValue",
readOnly: true,
type: {
name: "String"
}
}
}
}
};
export const Resource: coreClient.CompositeMapper = {
type: {
name: "Composite",
className: "Resource",
modelProperties: {
id: {
serializedName: "id",
readOnly: true,
type: {
name: "String"
}
},
name: {
serializedName: "name",
readOnly: true,
type: {
name: "String"
}
},
type: {
serializedName: "type",
readOnly: true,
type: {
name: "String"
}
}
}
}
};
export const ErrorResponse: coreClient.CompositeMapper = {
type: {
name: "Composite",
className: "ErrorResponse",
modelProperties: {
error: {
serializedName: "error",
type: {
name: "Composite",
className: "ErrorDetail"
}
}
}
}
};
export const ErrorDetail: coreClient.CompositeMapper = {
type: {
name: "Composite",
className: "ErrorDetail",
modelProperties: {
code: {
serializedName: "code",
readOnly: true,
type: {
name: "String"
}
},
message: {
serializedName: "message",
readOnly: true,
type: {
name: "String"
}
},
target: {
serializedName: "target",
readOnly: true,
type: {
name: "String"
}
},
details: {
serializedName: "details",
readOnly: true,
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "ErrorDetail"
}
}
}
},
additionalInfo: {
serializedName: "additionalInfo",
readOnly: true,
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "ErrorAdditionalInfo"
}
}
}
}
}
}
};
export const ErrorAdditionalInfo: coreClient.CompositeMapper = {
type: {
name: "Composite",
className: "ErrorAdditionalInfo",
modelProperties: {
type: {
serializedName: "type",
readOnly: true,
type: {
name: "String"
}
},
info: {
serializedName: "info",
readOnly: true,
type: {
name: "Dictionary",
value: { type: { name: "any" } }
}
}
}
}
};
export const ChangeResourceResult: coreClient.CompositeMapper = {
type: {
name: "Composite",
className: "ChangeResourceResult",
modelProperties: {
...Resource.type.modelProperties,
properties: {
serializedName: "properties",
type: {
name: "Composite",
className: "ChangeProperties"
}
}
}
}
};

Просмотреть файл

@ -0,0 +1,152 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import {
OperationParameter,
OperationURLParameter,
OperationQueryParameter
} from "@azure/core-client";
export const accept: OperationParameter = {
parameterPath: "accept",
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Accept",
type: {
name: "String"
}
}
};
export const $host: OperationURLParameter = {
parameterPath: "$host",
mapper: {
serializedName: "$host",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
export const subscriptionId: OperationURLParameter = {
parameterPath: "subscriptionId",
mapper: {
serializedName: "subscriptionId",
required: true,
type: {
name: "String"
}
}
};
export const resourceGroupName: OperationURLParameter = {
parameterPath: "resourceGroupName",
mapper: {
serializedName: "resourceGroupName",
required: true,
type: {
name: "String"
}
}
};
export const resourceProviderNamespace: OperationURLParameter = {
parameterPath: "resourceProviderNamespace",
mapper: {
serializedName: "resourceProviderNamespace",
required: true,
type: {
name: "String"
}
}
};
export const resourceType: OperationURLParameter = {
parameterPath: "resourceType",
mapper: {
serializedName: "resourceType",
required: true,
type: {
name: "String"
}
}
};
export const resourceName: OperationURLParameter = {
parameterPath: "resourceName",
mapper: {
serializedName: "resourceName",
required: true,
type: {
name: "String"
}
}
};
export const apiVersion: OperationQueryParameter = {
parameterPath: "apiVersion",
mapper: {
defaultValue: "2022-05-01",
isConstant: true,
serializedName: "api-version",
type: {
name: "String"
}
}
};
export const top: OperationQueryParameter = {
parameterPath: ["options", "top"],
mapper: {
defaultValue: 100,
constraints: {
InclusiveMaximum: 100,
InclusiveMinimum: 1
},
serializedName: "$top",
type: {
name: "Number"
}
}
};
export const skipToken: OperationQueryParameter = {
parameterPath: ["options", "skipToken"],
mapper: {
serializedName: "$skipToken",
type: {
name: "String"
}
}
};
export const changeResourceId: OperationURLParameter = {
parameterPath: "changeResourceId",
mapper: {
serializedName: "changeResourceId",
required: true,
type: {
name: "String"
}
}
};
export const nextLink: OperationURLParameter = {
parameterPath: "nextLink",
mapper: {
serializedName: "nextLink",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};

Просмотреть файл

@ -0,0 +1,297 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { Changes } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { ChangesClient } from "../changesClient";
import {
ChangeResourceResult,
ChangesListNextOptionalParams,
ChangesListOptionalParams,
ChangesListResponse,
ChangesGetOptionalParams,
ChangesGetResponse,
ChangesListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing Changes operations. */
export class ChangesImpl implements Changes {
private readonly client: ChangesClient;
/**
* Initialize a new instance of the class Changes class.
* @param client Reference to the service client
*/
constructor(client: ChangesClient) {
this.client = client;
}
/**
* Obtains a list of change resources from the past 14 days for the target resource
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The name of the resource provider namespace.
* @param resourceType The name of the resource type.
* @param resourceName The name of the resource.
* @param options The options parameters.
*/
public list(
resourceGroupName: string,
resourceProviderNamespace: string,
resourceType: string,
resourceName: string,
options?: ChangesListOptionalParams
): PagedAsyncIterableIterator<ChangeResourceResult> {
const iter = this.listPagingAll(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
options
);
}
};
}
private async *listPagingPage(
resourceGroupName: string,
resourceProviderNamespace: string,
resourceType: string,
resourceName: string,
options?: ChangesListOptionalParams
): AsyncIterableIterator<ChangeResourceResult[]> {
let result = await this._list(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
options
);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listNext(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
continuationToken,
options
);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listPagingAll(
resourceGroupName: string,
resourceProviderNamespace: string,
resourceType: string,
resourceName: string,
options?: ChangesListOptionalParams
): AsyncIterableIterator<ChangeResourceResult> {
for await (const page of this.listPagingPage(
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
options
)) {
yield* page;
}
}
/**
* Obtains a list of change resources from the past 14 days for the target resource
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The name of the resource provider namespace.
* @param resourceType The name of the resource type.
* @param resourceName The name of the resource.
* @param options The options parameters.
*/
private _list(
resourceGroupName: string,
resourceProviderNamespace: string,
resourceType: string,
resourceName: string,
options?: ChangesListOptionalParams
): Promise<ChangesListResponse> {
return this.client.sendOperationRequest(
{
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
options
},
listOperationSpec
);
}
/**
* Obtains the specified change resource for the target resource
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The name of the resource provider namespace.
* @param resourceType The name of the resource type.
* @param resourceName The name of the resource.
* @param changeResourceId The ID of the change resource
* @param options The options parameters.
*/
get(
resourceGroupName: string,
resourceProviderNamespace: string,
resourceType: string,
resourceName: string,
changeResourceId: string,
options?: ChangesGetOptionalParams
): Promise<ChangesGetResponse> {
return this.client.sendOperationRequest(
{
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
changeResourceId,
options
},
getOperationSpec
);
}
/**
* ListNext
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The name of the resource provider namespace.
* @param resourceType The name of the resource type.
* @param resourceName The name of the resource.
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
resourceGroupName: string,
resourceProviderNamespace: string,
resourceType: string,
resourceName: string,
nextLink: string,
options?: ChangesListNextOptionalParams
): Promise<ChangesListNextResponse> {
return this.client.sendOperationRequest(
{
resourceGroupName,
resourceProviderNamespace,
resourceType,
resourceName,
nextLink,
options
},
listNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Resources/changes",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ChangeResourceListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [
Parameters.apiVersion,
Parameters.top,
Parameters.skipToken
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.resourceProviderNamespace,
Parameters.resourceType,
Parameters.resourceName
],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Resources/changes/{changeResourceId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ChangeResourceResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.resourceProviderNamespace,
Parameters.resourceType,
Parameters.resourceName,
Parameters.changeResourceId
],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ChangeResourceListResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [
Parameters.apiVersion,
Parameters.top,
Parameters.skipToken
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.resourceProviderNamespace,
Parameters.resourceType,
Parameters.resourceName,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};

Просмотреть файл

@ -0,0 +1,9 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
export * from "./changes";

Просмотреть файл

@ -0,0 +1,52 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import {
ChangeResourceResult,
ChangesListOptionalParams,
ChangesGetOptionalParams,
ChangesGetResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a Changes. */
export interface Changes {
/**
* Obtains a list of change resources from the past 14 days for the target resource
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The name of the resource provider namespace.
* @param resourceType The name of the resource type.
* @param resourceName The name of the resource.
* @param options The options parameters.
*/
list(
resourceGroupName: string,
resourceProviderNamespace: string,
resourceType: string,
resourceName: string,
options?: ChangesListOptionalParams
): PagedAsyncIterableIterator<ChangeResourceResult>;
/**
* Obtains the specified change resource for the target resource
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The name of the resource provider namespace.
* @param resourceType The name of the resource type.
* @param resourceName The name of the resource.
* @param changeResourceId The ID of the change resource
* @param options The options parameters.
*/
get(
resourceGroupName: string,
resourceProviderNamespace: string,
resourceType: string,
resourceName: string,
changeResourceId: string,
options?: ChangesGetOptionalParams
): Promise<ChangesGetResponse>;
}

Просмотреть файл

@ -0,0 +1,9 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
export * from "./changes";

Просмотреть файл

@ -0,0 +1,48 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import {
env,
record,
RecorderEnvironmentSetup,
Recorder
} from "@azure-tools/test-recorder";
import * as assert from "assert";
const recorderEnvSetup: RecorderEnvironmentSetup = {
replaceableVariables: {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
SUBSCRIPTION_ID: "azure_subscription_id"
},
customizationsOnRecordings: [
(recording: any): any =>
recording.replace(
/"access_token":"[^"]*"/g,
`"access_token":"access_token"`
)
],
queryParametersToSkip: []
};
describe("My test", () => {
let recorder: Recorder;
beforeEach(async function() {
recorder = record(this, recorderEnvSetup);
});
afterEach(async function() {
await recorder.stop();
});
it("sample test", async function() {
console.log("Hi, I'm a test!");
});
});

Просмотреть файл

@ -0,0 +1,33 @@
{
"compilerOptions": {
"module": "es6",
"moduleResolution": "node",
"strict": true,
"target": "es6",
"sourceMap": true,
"declarationMap": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"lib": [
"es6",
"dom"
],
"declaration": true,
"outDir": "./dist-esm",
"importHelpers": true,
"paths": {
"@azure/arm-changes": [
"./src/index"
]
}
},
"include": [
"./src/**/*.ts",
"./test/**/*.ts",
"samples-dev/**/*.ts"
],
"exclude": [
"node_modules"
]
}

38
sdk/changes/ci.mgmt.yml Normal file
Просмотреть файл

@ -0,0 +1,38 @@
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
branches:
include:
- main
- feature/*
- release/*
- hotfix/*
exclude:
- feature/v4
paths:
include:
- sdk/changes/arm-changes
- sdk/changes/ci.mgmt.yml
pr:
branches:
include:
- main
- feature/*
- release/*
- hotfix/*
exclude:
- feature/v4
paths:
include:
- sdk/changes/arm-changes
- sdk/changes/ci.mgmt.yml
extends:
template: /eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: changes
Artifacts:
- name: azure-arm-changes
safeName: azurearmchanges