From 1e6297dbe58fab4ba293ec173452298726ea7a0b Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 12 May 2023 14:17:33 +0800 Subject: [PATCH 1/2] resourcehealth release --- common/config/rush/pnpm-lock.yaml | 60 +- .../arm-resourcehealth/CHANGELOG.md | 119 +- .../arm-resourcehealth/_meta.json | 10 +- .../arm-resourcehealth/assets.json | 2 +- .../arm-resourcehealth/package.json | 10 +- .../review/arm-resourcehealth.api.md | 524 +++++++- ...availabilityStatusesGetByResourceSample.ts | 2 +- ...bilityStatusesListByResourceGroupSample.ts | 6 +- ...ilityStatusesListBySubscriptionIdSample.ts | 6 +- .../availabilityStatusesListSample.ts | 6 +- ...AvailabilityStatusesGetByResourceSample.ts | 9 +- .../childAvailabilityStatusesListSample.ts | 9 +- .../samples-dev/childResourcesListSample.ts | 6 +- .../samples-dev/emergingIssuesGetSample.ts | 5 +- .../samples-dev/emergingIssuesListSample.ts | 2 +- ...ailsBySubscriptionIdAndTrackingIdSample.ts | 39 + ...tchDetailsByTenantIdAndTrackingIdSample.ts | 40 + ...tGetBySubscriptionIdAndTrackingIdSample.ts | 49 + .../eventGetByTenantIdAndTrackingIdSample.ts | 50 + .../eventsListBySingleResourceSample.ts | 44 + .../eventsListBySubscriptionIdSample.ts | 50 + .../samples-dev/eventsListByTenantIdSample.ts | 49 + .../impactedResourcesGetByTenantIdSample.ts | 42 + .../samples-dev/impactedResourcesGetSample.ts | 41 + ...cesListBySubscriptionIdAndEventIdSample.ts | 50 + ...ResourcesListByTenantIdAndEventIdSample.ts | 51 + .../samples-dev/metadataGetEntitySample.ts | 38 + .../samples-dev/metadataListSample.ts | 40 + .../samples-dev/operationsListSample.ts | 37 + ...cesListBySubscriptionIdAndEventIdSample.ts | 42 + ...ResourcesListByTenantIdAndEventIdSample.ts | 43 + .../samples/v4/javascript/README.md | 98 ++ ...availabilityStatusesGetByResourceSample.js | 37 + ...bilityStatusesListByResourceGroupSample.js | 44 + ...ilityStatusesListBySubscriptionIdSample.js | 40 + .../availabilityStatusesListSample.js | 38 + ...AvailabilityStatusesGetByResourceSample.js | 40 + .../childAvailabilityStatusesListSample.js | 39 + .../v4/javascript/childResourcesListSample.js | 38 + .../v4/javascript/emergingIssuesGetSample.js | 35 + .../v4/javascript/emergingIssuesListSample.js | 37 + ...ailsBySubscriptionIdAndTrackingIdSample.js | 36 + ...tchDetailsByTenantIdAndTrackingIdSample.js | 35 + ...tGetBySubscriptionIdAndTrackingIdSample.js | 43 + .../eventGetByTenantIdAndTrackingIdSample.js | 41 + .../eventsListBySingleResourceSample.js | 39 + .../eventsListBySubscriptionIdSample.js | 42 + .../javascript/eventsListByTenantIdSample.js | 43 + .../impactedResourcesGetByTenantIdSample.js | 39 + .../javascript/impactedResourcesGetSample.js | 35 + ...cesListBySubscriptionIdAndEventIdSample.js | 44 + ...ResourcesListByTenantIdAndEventIdSample.js | 45 + .../v4/javascript/metadataGetEntitySample.js | 35 + .../v4/javascript/metadataListSample.js | 37 + .../v4/javascript/operationsListSample.js | 34 + .../samples/v4/javascript/package.json | 32 + .../samples/v4/javascript/sample.env | 4 + ...cesListBySubscriptionIdAndEventIdSample.js | 39 + ...ResourcesListByTenantIdAndEventIdSample.js | 40 + .../samples/v4/typescript/README.md | 111 ++ .../samples/v4/typescript/package.json | 41 + .../samples/v4/typescript/sample.env | 4 + ...availabilityStatusesGetByResourceSample.ts | 46 + ...bilityStatusesListByResourceGroupSample.ts | 51 + ...ilityStatusesListBySubscriptionIdSample.ts | 48 + .../src/availabilityStatusesListSample.ts | 41 + ...AvailabilityStatusesGetByResourceSample.ts | 49 + .../childAvailabilityStatusesListSample.ts | 42 + .../src/childResourcesListSample.ts | 41 + .../typescript/src/emergingIssuesGetSample.ts | 38 + .../src/emergingIssuesListSample.ts | 40 + ...ailsBySubscriptionIdAndTrackingIdSample.ts | 39 + ...tchDetailsByTenantIdAndTrackingIdSample.ts | 40 + ...tGetBySubscriptionIdAndTrackingIdSample.ts | 49 + .../eventGetByTenantIdAndTrackingIdSample.ts | 50 + .../src/eventsListBySingleResourceSample.ts | 44 + .../src/eventsListBySubscriptionIdSample.ts | 50 + .../src/eventsListByTenantIdSample.ts | 49 + .../impactedResourcesGetByTenantIdSample.ts | 42 + .../src/impactedResourcesGetSample.ts | 41 + ...cesListBySubscriptionIdAndEventIdSample.ts | 50 + ...ResourcesListByTenantIdAndEventIdSample.ts | 51 + .../typescript/src/metadataGetEntitySample.ts | 38 + .../v4/typescript/src/metadataListSample.ts | 40 + .../v4/typescript/src/operationsListSample.ts | 37 + ...cesListBySubscriptionIdAndEventIdSample.ts | 42 + ...ResourcesListByTenantIdAndEventIdSample.ts | 43 + .../samples/v4/typescript/tsconfig.json | 17 + .../src/microsoftResourceHealth.ts | 37 +- .../arm-resourcehealth/src/models/index.ts | 792 +++++++++++- .../arm-resourcehealth/src/models/mappers.ts | 1057 +++++++++++++++-- .../src/models/parameters.ts | 58 +- .../src/operations/availabilityStatuses.ts | 24 +- .../src/operations/emergingIssues.ts | 42 +- .../src/operations/eventOperations.ts | 184 +++ .../src/operations/eventsOperations.ts | 434 +++++++ .../src/operations/impactedResources.ts | 414 +++++++ .../src/operations/index.ts | 7 +- .../src/operations/metadata.ts | 182 +++ .../securityAdvisoryImpactedResources.ts | 342 ++++++ .../availabilityStatuses.ts | 11 +- .../operationsInterfaces/emergingIssues.ts | 3 + .../operationsInterfaces/eventOperations.ts | 60 + .../operationsInterfaces/eventsOperations.ts | 47 + .../operationsInterfaces/impactedResources.ts | 63 + .../src/operationsInterfaces/index.ts | 7 +- .../src/operationsInterfaces/metadata.ts | 36 + .../securityAdvisoryImpactedResources.ts | 37 + .../resourcehealth_operations_test.spec.ts | 65 + .../arm-resourcehealth/test/sampleTest.ts | 43 - 110 files changed, 7496 insertions(+), 313 deletions(-) create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/eventFetchDetailsByTenantIdAndTrackingIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/eventGetBySubscriptionIdAndTrackingIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/eventGetByTenantIdAndTrackingIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListBySingleResourceSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListBySubscriptionIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListByTenantIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesGetByTenantIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesGetSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesListBySubscriptionIdAndEventIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesListByTenantIdAndEventIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/metadataGetEntitySample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/metadataListSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/operationsListSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples-dev/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/README.md create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesGetByResourceSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListByResourceGroupSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListBySubscriptionIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesGetByResourceSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesListSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childResourcesListSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesGetSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesListSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsByTenantIdAndTrackingIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetBySubscriptionIdAndTrackingIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetByTenantIdAndTrackingIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySingleResourceSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySubscriptionIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListByTenantIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetByTenantIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListBySubscriptionIdAndEventIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListByTenantIdAndEventIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataGetEntitySample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataListSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/operationsListSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/package.json create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/sample.env create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.js create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/README.md create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/package.json create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/sample.env create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesGetByResourceSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListByResourceGroupSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesGetByResourceSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesListSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childResourcesListSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesGetSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesListSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsByTenantIdAndTrackingIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetBySubscriptionIdAndTrackingIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetByTenantIdAndTrackingIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySingleResourceSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySubscriptionIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListByTenantIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetByTenantIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListBySubscriptionIdAndEventIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListByTenantIdAndEventIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataGetEntitySample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataListSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/operationsListSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/tsconfig.json create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operations/eventOperations.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operations/eventsOperations.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operations/impactedResources.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operations/metadata.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operations/securityAdvisoryImpactedResources.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/eventOperations.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/eventsOperations.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/impactedResources.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/metadata.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/securityAdvisoryImpactedResources.ts create mode 100644 sdk/resourcehealth/arm-resourcehealth/test/resourcehealth_operations_test.spec.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index a0121f606644..12cafeedab33 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -2188,7 +2188,7 @@ packages: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.35 - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/chai-as-promised/7.1.5: @@ -2210,7 +2210,7 @@ packages: /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/cookie/0.4.1: @@ -2220,7 +2220,7 @@ packages: /@types/cors/2.8.13: resolution: {integrity: sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/debug/4.1.7: @@ -2232,7 +2232,7 @@ packages: /@types/decompress/4.2.4: resolution: {integrity: sha512-/C8kTMRTNiNuWGl5nEyKbPiMv6HA+0RbEXzFhFBEzASM6+oa4tJro9b8nj7eRlOFfuLdzUU+DS/GPDlvvzMOhA==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/eslint/8.4.10: @@ -2253,7 +2253,7 @@ packages: /@types/express-serve-static-core/4.17.34: resolution: {integrity: sha512-fvr49XlCGoUj2Pp730AItckfjat4WNb0lb3kfrLWffd+RLeoGAMsq7UOy04PAPtoL01uKwcp6u8nhzpgpDYr3w==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 '@types/send': 0.17.1 @@ -2271,13 +2271,13 @@ packages: /@types/fs-extra/8.1.2: resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/inquirer/8.2.6: @@ -2290,7 +2290,7 @@ packages: /@types/is-buffer/2.0.0: resolution: {integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/json-schema/7.0.11: @@ -2304,13 +2304,13 @@ packages: /@types/jsonwebtoken/9.0.2: resolution: {integrity: sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/jws/3.2.5: resolution: {integrity: sha512-xGTxZH34xOryaTN8CMsvhh9lfNqFuHiMoRvsLYWQdBJHqiECyfInXVl2eK8Jz2emxZWMIn5RBlmr3oDVPeWujw==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/linkify-it/3.0.2: @@ -2361,13 +2361,13 @@ packages: /@types/mysql/2.15.19: resolution: {integrity: sha512-wSRg2QZv14CWcZXkgdvHbbV2ACufNy5EgI8mBBxnJIptchv7DBy/h53VMa2jDhyo0C9MO4iowE6z9vF8Ja1DkQ==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/node-fetch/2.6.3: resolution: {integrity: sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 form-data: 3.0.1 dev: false @@ -2392,7 +2392,7 @@ packages: /@types/pg/8.6.1: resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 pg-protocol: 1.6.0 pg-types: 2.2.0 dev: false @@ -2420,7 +2420,7 @@ packages: /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/semaphore/1.1.1: @@ -2439,14 +2439,14 @@ packages: resolution: {integrity: sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==} dependencies: '@types/mime': 1.3.2 - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/serve-static/1.15.1: resolution: {integrity: sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==} dependencies: '@types/mime': 3.0.1 - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/sinon/10.0.14: @@ -2468,13 +2468,13 @@ packages: /@types/stoppable/1.1.1: resolution: {integrity: sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/through/0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/tough-cookie/4.0.2: @@ -2488,7 +2488,7 @@ packages: /@types/tunnel/0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/underscore/1.11.4: @@ -2506,19 +2506,19 @@ packages: /@types/ws/7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/ws/8.5.4: resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/xml2js/0.4.11: resolution: {integrity: sha512-JdigeAKmCyoJUiQljjr7tQG3if9NkqGUgwEUqBvV0N7LM4HyQk7UXCnusRa1lnvXAEYJ8mw8GtZWioagNztOwA==} dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false /@types/yargs-parser/21.0.0: @@ -2535,7 +2535,7 @@ packages: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 14.18.46 + '@types/node': 16.18.28 dev: false optional: true @@ -3540,7 +3540,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug/3.2.7: @@ -3822,7 +3822,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.13 - '@types/node': 14.18.46 + '@types/node': 16.18.28 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -4746,7 +4746,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.4 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: false @@ -7043,7 +7043,7 @@ packages: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 14.18.46 + '@types/node': 16.18.28 long: 5.2.3 dev: false @@ -13899,7 +13899,7 @@ packages: dev: false file:projects/arm-resourcehealth.tgz: - resolution: {integrity: sha512-6DL3J4bKJxnV+LjbGaFmOjhmXHuGfTTKEv3SAH8yVrp1ujaGxgJAyyYST5nqzw7ACCLYnR5KTzQhGvwrs4awZw==, tarball: file:projects/arm-resourcehealth.tgz} + resolution: {integrity: sha512-4cOfrbCPt3mcbBhMXKc46otMpTadYKZkV9XpP+X3s95j/oJuW7glLTmhtq5OqqQRVpz7wHCl3Yc5bTUEbP9k3A==, tarball: file:projects/arm-resourcehealth.tgz} name: '@rush-temp/arm-resourcehealth' version: 0.0.0 dependencies: @@ -13913,8 +13913,8 @@ packages: '@types/node': 14.18.46 chai: 4.3.7 cross-env: 7.0.3 - dotenv: 8.6.0 - mkdirp: 1.0.4 + dotenv: 16.0.3 + mkdirp: 2.1.6 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 diff --git a/sdk/resourcehealth/arm-resourcehealth/CHANGELOG.md b/sdk/resourcehealth/arm-resourcehealth/CHANGELOG.md index 814b9d872b67..836027e1016f 100644 --- a/sdk/resourcehealth/arm-resourcehealth/CHANGELOG.md +++ b/sdk/resourcehealth/arm-resourcehealth/CHANGELOG.md @@ -1,15 +1,118 @@ # Release History + +## 4.0.0 (2023-05-12) + +**Features** -## 3.2.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added operation group EventOperations + - Added operation group EventsOperations + - Added operation group ImpactedResources + - Added operation group Metadata + - Added operation group SecurityAdvisoryImpactedResources + - Added Interface AvailabilityStatusPropertiesRecentlyResolved + - Added Interface Event_2 + - Added Interface EventFetchDetailsBySubscriptionIdAndTrackingIdOptionalParams + - Added Interface EventFetchDetailsByTenantIdAndTrackingIdOptionalParams + - Added Interface EventGetBySubscriptionIdAndTrackingIdOptionalParams + - Added Interface EventGetByTenantIdAndTrackingIdOptionalParams + - Added Interface EventImpactedResource + - Added Interface EventImpactedResourceListResult + - Added Interface EventPropertiesAdditionalInformation + - Added Interface EventPropertiesArticle + - Added Interface EventPropertiesRecommendedActions + - Added Interface EventPropertiesRecommendedActionsItem + - Added Interface Events + - Added Interface EventsListBySingleResourceNextOptionalParams + - Added Interface EventsListBySingleResourceOptionalParams + - Added Interface EventsListBySubscriptionIdNextOptionalParams + - Added Interface EventsListBySubscriptionIdOptionalParams + - Added Interface EventsListByTenantIdNextOptionalParams + - Added Interface EventsListByTenantIdOptionalParams + - Added Interface Faq + - Added Interface Impact + - Added Interface ImpactedResourcesGetByTenantIdOptionalParams + - Added Interface ImpactedResourcesGetOptionalParams + - Added Interface ImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams + - Added Interface ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + - Added Interface ImpactedResourcesListByTenantIdAndEventIdNextOptionalParams + - Added Interface ImpactedResourcesListByTenantIdAndEventIdOptionalParams + - Added Interface ImpactedResourceStatus + - Added Interface ImpactedServiceRegion + - Added Interface KeyValueItem + - Added Interface Link + - Added Interface LinkDisplayText + - Added Interface MetadataEntity + - Added Interface MetadataEntityListResult + - Added Interface MetadataGetEntityOptionalParams + - Added Interface MetadataListNextOptionalParams + - Added Interface MetadataListOptionalParams + - Added Interface MetadataSupportedValueDetail + - Added Interface ProxyResource + - Added Interface SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams + - Added Interface SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + - Added Interface SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextOptionalParams + - Added Interface SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams + - Added Interface SystemData + - Added Interface Update + - Added Type Alias CreatedByType + - Added Type Alias EventFetchDetailsBySubscriptionIdAndTrackingIdResponse + - Added Type Alias EventFetchDetailsByTenantIdAndTrackingIdResponse + - Added Type Alias EventGetBySubscriptionIdAndTrackingIdResponse + - Added Type Alias EventGetByTenantIdAndTrackingIdResponse + - Added Type Alias EventLevelValues + - Added Type Alias EventsListBySingleResourceNextResponse + - Added Type Alias EventsListBySingleResourceResponse + - Added Type Alias EventsListBySubscriptionIdNextResponse + - Added Type Alias EventsListBySubscriptionIdResponse + - Added Type Alias EventsListByTenantIdNextResponse + - Added Type Alias EventsListByTenantIdResponse + - Added Type Alias EventSourceValues + - Added Type Alias EventStatusValues + - Added Type Alias EventTypeValues + - Added Type Alias ImpactedResourcesGetByTenantIdResponse + - Added Type Alias ImpactedResourcesGetResponse + - Added Type Alias ImpactedResourcesListBySubscriptionIdAndEventIdNextResponse + - Added Type Alias ImpactedResourcesListBySubscriptionIdAndEventIdResponse + - Added Type Alias ImpactedResourcesListByTenantIdAndEventIdNextResponse + - Added Type Alias ImpactedResourcesListByTenantIdAndEventIdResponse + - Added Type Alias IssueNameParameter + - Added Type Alias LevelValues + - Added Type Alias LinkTypeValues + - Added Type Alias MetadataGetEntityResponse + - Added Type Alias MetadataListNextResponse + - Added Type Alias MetadataListResponse + - Added Type Alias ReasonTypeValues + - Added Type Alias Scenario + - Added Type Alias SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextResponse + - Added Type Alias SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdResponse + - Added Type Alias SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextResponse + - Added Type Alias SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdResponse + - Interface AvailabilityStatusProperties has a new optional parameter articleId + - Interface AvailabilityStatusProperties has a new optional parameter category + - Interface AvailabilityStatusProperties has a new optional parameter context + - Interface AvailabilityStatusProperties has a new optional parameter recentlyResolved + - Interface AvailabilityStatusProperties has a new optional parameter title + - Interface RecommendedAction has a new optional parameter actionUrlComment + - Interface Resource has a new optional parameter systemData + - Added Enum KnownAvailabilityStateValues + - Added Enum KnownCreatedByType + - Added Enum KnownEventLevelValues + - Added Enum KnownEventSourceValues + - Added Enum KnownEventStatusValues + - Added Enum KnownEventTypeValues + - Added Enum KnownIssueNameParameter + - Added Enum KnownLevelValues + - Added Enum KnownLinkTypeValues + - Added Enum KnownReasonChronicityTypes + - Added Enum KnownReasonTypeValues + - Added Enum KnownScenario -### Other Changes +**Breaking Changes** + - Operation EmergingIssues.get has a new signature + - Interface AvailabilityStatusProperties no longer has parameter recentlyResolvedState + + ## 3.2.0 (2023-02-01) **Features** diff --git a/sdk/resourcehealth/arm-resourcehealth/_meta.json b/sdk/resourcehealth/arm-resourcehealth/_meta.json index f2f16b84fe38..0fcb29de6f68 100644 --- a/sdk/resourcehealth/arm-resourcehealth/_meta.json +++ b/sdk/resourcehealth/arm-resourcehealth/_meta.json @@ -1,8 +1,8 @@ { - "commit": "0cd7b3e83d5e7e21222dcc4bdde4565562da0cdf", - "readme": "specification\\resourcehealth\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\resourcehealth\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.7 --generate-sample=true", + "commit": "1c3433247689aa55d7ecdd213505dc28c035f2b9", + "readme": "specification/resourcehealth/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\resourcehealth\\resource-manager\\readme.md --use=@autorest/typescript@6.0.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.6.0", - "use": "@autorest/typescript@6.0.0-rc.7" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.2", + "use": "@autorest/typescript@6.0.1" } \ No newline at end of file diff --git a/sdk/resourcehealth/arm-resourcehealth/assets.json b/sdk/resourcehealth/arm-resourcehealth/assets.json index 245210fca1ca..72156c756684 100644 --- a/sdk/resourcehealth/arm-resourcehealth/assets.json +++ b/sdk/resourcehealth/arm-resourcehealth/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/resourcehealth/arm-resourcehealth", - "Tag": "js/resourcehealth/arm-resourcehealth_8d2e549e09" + "Tag": "js/resourcehealth/arm-resourcehealth_ddf0f3ceba" } diff --git a/sdk/resourcehealth/arm-resourcehealth/package.json b/sdk/resourcehealth/arm-resourcehealth/package.json index 38d4c1c5eb58..3cd460dd7be8 100644 --- a/sdk/resourcehealth/arm-resourcehealth/package.json +++ b/sdk/resourcehealth/arm-resourcehealth/package.json @@ -3,13 +3,13 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for MicrosoftResourceHealth.", - "version": "3.2.1", + "version": "4.0.0", "engines": { "node": ">=14.0.0" }, "dependencies": { "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -31,13 +31,13 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~5.0.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", - "dotenv": "^8.2.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -118,4 +118,4 @@ "disableDocsMs": true, "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-resourcehealth?view=azure-node-preview" } -} +} \ No newline at end of file diff --git a/sdk/resourcehealth/arm-resourcehealth/review/arm-resourcehealth.api.md b/sdk/resourcehealth/arm-resourcehealth/review/arm-resourcehealth.api.md index 5824d2b1288c..2fe1bc4e41d9 100644 --- a/sdk/resourcehealth/arm-resourcehealth/review/arm-resourcehealth.api.md +++ b/sdk/resourcehealth/arm-resourcehealth/review/arm-resourcehealth.api.md @@ -9,7 +9,7 @@ import * as coreClient from '@azure/core-client'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; // @public -export type AvailabilityStateValues = "Available" | "Unavailable" | "Unknown"; +export type AvailabilityStateValues = string; // @public export interface AvailabilityStatus { @@ -93,7 +93,10 @@ export interface AvailabilityStatusListResult { // @public export interface AvailabilityStatusProperties { + articleId?: string; availabilityState?: AvailabilityStateValues; + category?: string; + context?: string; detailedStatus?: string; healthEventCategory?: string; healthEventCause?: string; @@ -102,20 +105,21 @@ export interface AvailabilityStatusProperties { occuredTime?: Date; reasonChronicity?: ReasonChronicityTypes; reasonType?: string; - recentlyResolvedState?: AvailabilityStatusPropertiesRecentlyResolvedState; + recentlyResolved?: AvailabilityStatusPropertiesRecentlyResolved; recommendedActions?: RecommendedAction[]; reportedTime?: Date; resolutionETA?: Date; rootCauseAttributionTime?: Date; serviceImpactingEvents?: ServiceImpactingEvent[]; summary?: string; + title?: string; } // @public -export interface AvailabilityStatusPropertiesRecentlyResolvedState { +export interface AvailabilityStatusPropertiesRecentlyResolved { resolvedTime?: Date; - unavailabilitySummary?: string; - unavailableOccurredTime?: Date; + unavailableOccuredTime?: Date; + unavailableSummary?: string; } // @public @@ -170,6 +174,9 @@ export interface ChildResourcesListOptionalParams extends coreClient.OperationOp // @public export type ChildResourcesListResponse = AvailabilityStatusListResult; +// @public +export type CreatedByType = string; + // @public export interface EmergingIssueImpact { id?: string; @@ -185,7 +192,7 @@ export interface EmergingIssueListResult { // @public export interface EmergingIssues { - get(options?: EmergingIssuesGetOptionalParams): Promise; + get(issueName: IssueNameParameter, options?: EmergingIssuesGetOptionalParams): Promise; list(options?: EmergingIssuesListOptionalParams): PagedAsyncIterableIterator; } @@ -197,7 +204,7 @@ export interface EmergingIssuesGetOptionalParams extends coreClient.OperationOpt export type EmergingIssuesGetResponse = EmergingIssuesGetResult; // @public -export interface EmergingIssuesGetResult extends Resource { +export interface EmergingIssuesGetResult extends ProxyResource { refreshTimestamp?: Date; statusActiveEvents?: StatusActiveEvent[]; statusBanners?: StatusBanner[]; @@ -224,15 +231,373 @@ export interface ErrorResponse { readonly message?: string; } +// @public +interface Event_2 extends ProxyResource { + additionalInformation?: EventPropertiesAdditionalInformation; + article?: EventPropertiesArticle; + description?: string; + duration?: number; + enableChatWithUs?: boolean; + enableMicrosoftSupport?: boolean; + eventLevel?: EventLevelValues; + eventSource?: EventSourceValues; + eventType?: EventTypeValues; + externalIncidentId?: string; + faqs?: Faq[]; + header?: string; + hirStage?: string; + impact?: Impact[]; + impactMitigationTime?: Date; + impactStartTime?: Date; + impactType?: string; + isHIR?: boolean; + lastUpdateTime?: Date; + level?: LevelValues; + links?: Link[]; + platformInitiated?: boolean; + priority?: number; + reason?: string; + recommendedActions?: EventPropertiesRecommendedActions; + status?: EventStatusValues; + summary?: string; + title?: string; +} +export { Event_2 as Event } + +// @public +export interface EventFetchDetailsBySubscriptionIdAndTrackingIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EventFetchDetailsBySubscriptionIdAndTrackingIdResponse = Event_2; + +// @public +export interface EventFetchDetailsByTenantIdAndTrackingIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EventFetchDetailsByTenantIdAndTrackingIdResponse = Event_2; + +// @public +export interface EventGetBySubscriptionIdAndTrackingIdOptionalParams extends coreClient.OperationOptions { + filter?: string; + queryStartTime?: string; +} + +// @public +export type EventGetBySubscriptionIdAndTrackingIdResponse = Event_2; + +// @public +export interface EventGetByTenantIdAndTrackingIdOptionalParams extends coreClient.OperationOptions { + filter?: string; + queryStartTime?: string; +} + +// @public +export type EventGetByTenantIdAndTrackingIdResponse = Event_2; + +// @public +export interface EventImpactedResource extends ProxyResource { + info?: KeyValueItem[]; + readonly targetRegion?: string; + readonly targetResourceId?: string; + readonly targetResourceType?: string; +} + +// @public +export interface EventImpactedResourceListResult { + nextLink?: string; + value: EventImpactedResource[]; +} + +// @public +export type EventLevelValues = string; + +// @public +export interface EventOperations { + fetchDetailsBySubscriptionIdAndTrackingId(eventTrackingId: string, options?: EventFetchDetailsBySubscriptionIdAndTrackingIdOptionalParams): Promise; + fetchDetailsByTenantIdAndTrackingId(eventTrackingId: string, options?: EventFetchDetailsByTenantIdAndTrackingIdOptionalParams): Promise; + getBySubscriptionIdAndTrackingId(eventTrackingId: string, options?: EventGetBySubscriptionIdAndTrackingIdOptionalParams): Promise; + getByTenantIdAndTrackingId(eventTrackingId: string, options?: EventGetByTenantIdAndTrackingIdOptionalParams): Promise; +} + +// @public +export interface EventPropertiesAdditionalInformation { + message?: string; +} + +// @public +export interface EventPropertiesArticle { + articleContent?: string; + articleId?: string; + parameters?: Record; +} + +// @public +export interface EventPropertiesRecommendedActions { + actions?: EventPropertiesRecommendedActionsItem[]; + localeCode?: string; + message?: string; +} + +// @public +export interface EventPropertiesRecommendedActionsItem { + actionText?: string; + groupId?: number; +} + +// @public +export interface Events { + nextLink?: string; + value: Event_2[]; +} + +// @public +export interface EventsListBySingleResourceNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EventsListBySingleResourceNextResponse = Events; + +// @public +export interface EventsListBySingleResourceOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type EventsListBySingleResourceResponse = Events; + +// @public +export interface EventsListBySubscriptionIdNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EventsListBySubscriptionIdNextResponse = Events; + +// @public +export interface EventsListBySubscriptionIdOptionalParams extends coreClient.OperationOptions { + filter?: string; + queryStartTime?: string; +} + +// @public +export type EventsListBySubscriptionIdResponse = Events; + +// @public +export interface EventsListByTenantIdNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EventsListByTenantIdNextResponse = Events; + +// @public +export interface EventsListByTenantIdOptionalParams extends coreClient.OperationOptions { + filter?: string; + queryStartTime?: string; +} + +// @public +export type EventsListByTenantIdResponse = Events; + +// @public +export interface EventsOperations { + listBySingleResource(resourceUri: string, options?: EventsListBySingleResourceOptionalParams): PagedAsyncIterableIterator; + listBySubscriptionId(options?: EventsListBySubscriptionIdOptionalParams): PagedAsyncIterableIterator; + listByTenantId(options?: EventsListByTenantIdOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export type EventSourceValues = string; + +// @public +export type EventStatusValues = string; + +// @public +export type EventTypeValues = string; + +// @public +export interface Faq { + answer?: string; + localeCode?: string; + question?: string; +} + // @public export function getContinuationToken(page: unknown): string | undefined; +// @public +export interface Impact { + impactedRegions?: ImpactedServiceRegion[]; + impactedService?: string; +} + // @public export interface ImpactedRegion { id?: string; name?: string; } +// @public +export interface ImpactedResources { + get(eventTrackingId: string, impactedResourceName: string, options?: ImpactedResourcesGetOptionalParams): Promise; + getByTenantId(eventTrackingId: string, impactedResourceName: string, options?: ImpactedResourcesGetByTenantIdOptionalParams): Promise; + listBySubscriptionIdAndEventId(eventTrackingId: string, options?: ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams): PagedAsyncIterableIterator; + listByTenantIdAndEventId(eventTrackingId: string, options?: ImpactedResourcesListByTenantIdAndEventIdOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ImpactedResourcesGetByTenantIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ImpactedResourcesGetByTenantIdResponse = EventImpactedResource; + +// @public +export interface ImpactedResourcesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ImpactedResourcesGetResponse = EventImpactedResource; + +// @public +export interface ImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ImpactedResourcesListBySubscriptionIdAndEventIdNextResponse = EventImpactedResourceListResult; + +// @public +export interface ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type ImpactedResourcesListBySubscriptionIdAndEventIdResponse = EventImpactedResourceListResult; + +// @public +export interface ImpactedResourcesListByTenantIdAndEventIdNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ImpactedResourcesListByTenantIdAndEventIdNextResponse = EventImpactedResourceListResult; + +// @public +export interface ImpactedResourcesListByTenantIdAndEventIdOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type ImpactedResourcesListByTenantIdAndEventIdResponse = EventImpactedResourceListResult; + +// @public +export interface ImpactedResourceStatus extends ProxyResource { + availabilityState?: AvailabilityStateValues; + occurredTime?: Date; + reasonType?: ReasonTypeValues; + summary?: string; + title?: string; +} + +// @public +export interface ImpactedServiceRegion { + impactedRegion?: string; + impactedSubscriptions?: string[]; + impactedTenants?: string[]; + lastUpdateTime?: Date; + status?: EventStatusValues; + updates?: Update[]; +} + +// @public +export type IssueNameParameter = string; + +// @public +export interface KeyValueItem { + readonly key?: string; + readonly value?: string; +} + +// @public +export enum KnownAvailabilityStateValues { + Available = "Available", + Degraded = "Degraded", + Unavailable = "Unavailable", + Unknown = "Unknown" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownEventLevelValues { + Critical = "Critical", + Error = "Error", + Informational = "Informational", + Warning = "Warning" +} + +// @public +export enum KnownEventSourceValues { + ResourceHealth = "ResourceHealth", + ServiceHealth = "ServiceHealth" +} + +// @public +export enum KnownEventStatusValues { + Active = "Active", + Resolved = "Resolved" +} + +// @public +export enum KnownEventTypeValues { + EmergingIssues = "EmergingIssues", + HealthAdvisory = "HealthAdvisory", + PlannedMaintenance = "PlannedMaintenance", + RCA = "RCA", + SecurityAdvisory = "SecurityAdvisory", + ServiceIssue = "ServiceIssue" +} + +// @public +export enum KnownIssueNameParameter { + Default = "default" +} + +// @public +export enum KnownLevelValues { + Critical = "Critical", + Warning = "Warning" +} + +// @public +export enum KnownLinkTypeValues { + Button = "Button", + Hyperlink = "Hyperlink" +} + +// @public +export enum KnownReasonChronicityTypes { + Persistent = "Persistent", + Transient = "Transient" +} + +// @public +export enum KnownReasonTypeValues { + Planned = "Planned", + Unplanned = "Unplanned", + UserInitiated = "UserInitiated" +} + +// @public +export enum KnownScenario { + Alerts = "Alerts" +} + // @public export enum KnownSeverityValues { Error = "Error", @@ -247,6 +612,75 @@ export enum KnownStageValues { Resolve = "Resolve" } +// @public +export type LevelValues = string; + +// @public +export interface Link { + bladeName?: string; + displayText?: LinkDisplayText; + extensionName?: string; + parameters?: Record; + type?: LinkTypeValues; +} + +// @public +export interface LinkDisplayText { + localizedValue?: string; + value?: string; +} + +// @public +export type LinkTypeValues = string; + +// @public +export interface Metadata { + getEntity(name: string, options?: MetadataGetEntityOptionalParams): Promise; + list(options?: MetadataListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface MetadataEntity extends ProxyResource { + applicableScenarios?: Scenario[]; + dependsOn?: string[]; + displayName?: string; + supportedValues?: MetadataSupportedValueDetail[]; +} + +// @public +export interface MetadataEntityListResult { + nextLink?: string; + value?: MetadataEntity[]; +} + +// @public +export interface MetadataGetEntityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MetadataGetEntityResponse = MetadataEntity; + +// @public +export interface MetadataListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MetadataListNextResponse = MetadataEntityListResult; + +// @public +export interface MetadataListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MetadataListResponse = MetadataEntityListResult; + +// @public +export interface MetadataSupportedValueDetail { + displayName?: string; + id?: string; + resourceTypes?: string[]; +} + // @public (undocumented) export class MicrosoftResourceHealth extends coreClient.ServiceClient { // (undocumented) @@ -263,8 +697,18 @@ export class MicrosoftResourceHealth extends coreClient.ServiceClient { // (undocumented) emergingIssues: EmergingIssues; // (undocumented) + eventOperations: EventOperations; + // (undocumented) + eventsOperations: EventsOperations; + // (undocumented) + impactedResources: ImpactedResources; + // (undocumented) + metadata: Metadata; + // (undocumented) operations: Operations; // (undocumented) + securityAdvisoryImpactedResources: SecurityAdvisoryImpactedResources; + // (undocumented) subscriptionId: string; } @@ -307,12 +751,20 @@ export interface OperationsListOptionalParams extends coreClient.OperationOption export type OperationsListResponse = OperationListResult; // @public -export type ReasonChronicityTypes = "Transient" | "Persistent"; +export interface ProxyResource extends Resource { +} + +// @public +export type ReasonChronicityTypes = string; + +// @public +export type ReasonTypeValues = string; // @public export interface RecommendedAction { action?: string; actionUrl?: string; + actionUrlComment?: string; actionUrlText?: string; } @@ -320,9 +772,49 @@ export interface RecommendedAction { export interface Resource { readonly id?: string; readonly name?: string; + readonly systemData?: SystemData; readonly type?: string; } +// @public +export type Scenario = string; + +// @public +export interface SecurityAdvisoryImpactedResources { + listBySubscriptionIdAndEventId(eventTrackingId: string, options?: SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams): PagedAsyncIterableIterator; + listByTenantIdAndEventId(eventTrackingId: string, options?: SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextResponse = EventImpactedResourceListResult; + +// @public +export interface SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdResponse = EventImpactedResourceListResult; + +// @public +export interface SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextResponse = EventImpactedResourceListResult; + +// @public +export interface SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdResponse = EventImpactedResourceListResult; + // @public export interface ServiceImpactingEvent { correlationId?: string; @@ -373,6 +865,22 @@ export interface StatusBanner { title?: string; } +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface Update { + summary?: string; + updateDateTime?: Date; +} + // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesGetByResourceSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesGetByResourceSample.ts index 82ab7e87b230..9a6de7d115dc 100644 --- a/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesGetByResourceSample.ts +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesGetByResourceSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Gets current availability status for a single resource * * @summary Gets current availability status for a single resource - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatus_GetByResource.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json */ async function getCurrentHealthByResource() { const subscriptionId = diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListByResourceGroupSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListByResourceGroupSample.ts index 7b7cdddffc0a..288966705df0 100644 --- a/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListByResourceGroupSample.ts +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListByResourceGroupSample.ts @@ -18,10 +18,10 @@ import * as dotenv from "dotenv"; dotenv.config(); /** - * This sample demonstrates how to Lists the current availability status for all the resources in the resource group. Use the nextLink property in the response to get the next page of availability statuses. + * This sample demonstrates how to Lists the current availability status for all the resources in the resource group. * - * @summary Lists the current availability status for all the resources in the resource group. Use the nextLink property in the response to get the next page of availability statuses. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListByResourceGroup.json + * @summary Lists the current availability status for all the resources in the resource group. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json */ async function listByResourceGroup() { const subscriptionId = diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListBySubscriptionIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListBySubscriptionIdSample.ts index 9e81732f4761..c1204ae9a395 100644 --- a/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListBySubscriptionIdSample.ts +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListBySubscriptionIdSample.ts @@ -18,10 +18,10 @@ import * as dotenv from "dotenv"; dotenv.config(); /** - * This sample demonstrates how to Lists the current availability status for all the resources in the subscription. Use the nextLink property in the response to get the next page of availability statuses. + * This sample demonstrates how to Lists the current availability status for all the resources in the subscription. * - * @summary Lists the current availability status for all the resources in the subscription. Use the nextLink property in the response to get the next page of availability statuses. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListBySubscriptionId.json + * @summary Lists the current availability status for all the resources in the subscription. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json */ async function listHealthBySubscriptionId() { const subscriptionId = diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListSample.ts index f5dc16c8435a..ad9f65f07576 100644 --- a/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListSample.ts +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/availabilityStatusesListSample.ts @@ -15,10 +15,10 @@ import * as dotenv from "dotenv"; dotenv.config(); /** - * This sample demonstrates how to Lists all historical availability transitions and impacting events for a single resource. Use the nextLink property in the response to get the next page of availability status + * This sample demonstrates how to Lists all historical availability transitions and impacting events for a single resource. * - * @summary Lists all historical availability transitions and impacting events for a single resource. Use the nextLink property in the response to get the next page of availability status - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_List.json + * @summary Lists all historical availability transitions and impacting events for a single resource. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_List.json */ async function getHealthHistoryByResource() { const subscriptionId = diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/childAvailabilityStatusesGetByResourceSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/childAvailabilityStatusesGetByResourceSample.ts index 82d0c0c2b2cb..8035a19dab11 100644 --- a/sdk/resourcehealth/arm-resourcehealth/samples-dev/childAvailabilityStatusesGetByResourceSample.ts +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/childAvailabilityStatusesGetByResourceSample.ts @@ -21,13 +21,14 @@ dotenv.config(); * This sample demonstrates how to Gets current availability status for a single resource * * @summary Gets current availability status for a single resource - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatus_GetByResource.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json */ -async function getCurrentHealthByResource() { +async function getChildCurrentHealthByResource() { const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; + const resourceUri = + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4"; const expand = "recommendedactions"; const options: ChildAvailabilityStatusesGetByResourceOptionalParams = { expand @@ -42,7 +43,7 @@ async function getCurrentHealthByResource() { } async function main() { - getCurrentHealthByResource(); + getChildCurrentHealthByResource(); } main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/childAvailabilityStatusesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/childAvailabilityStatusesListSample.ts index b2030c6c267f..fd1848deeebc 100644 --- a/sdk/resourcehealth/arm-resourcehealth/samples-dev/childAvailabilityStatusesListSample.ts +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/childAvailabilityStatusesListSample.ts @@ -18,13 +18,14 @@ dotenv.config(); * This sample demonstrates how to Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status * * @summary Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatuses_List.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json */ -async function getHealthHistoryByResource() { +async function getChildHealthHistoryByResource() { const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; + const resourceUri = + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4"; const credential = new DefaultAzureCredential(); const client = new MicrosoftResourceHealth(credential, subscriptionId); const resArray = new Array(); @@ -35,7 +36,7 @@ async function getHealthHistoryByResource() { } async function main() { - getHealthHistoryByResource(); + getChildHealthHistoryByResource(); } main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/childResourcesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/childResourcesListSample.ts index 6298686db3bc..13d61813cefd 100644 --- a/sdk/resourcehealth/arm-resourcehealth/samples-dev/childResourcesListSample.ts +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/childResourcesListSample.ts @@ -18,9 +18,9 @@ dotenv.config(); * This sample demonstrates how to Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health * * @summary Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildResources_List.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json */ -async function getHealthHistoryByResource() { +async function getCurrentChildHealthByResource() { const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; @@ -35,7 +35,7 @@ async function getHealthHistoryByResource() { } async function main() { - getHealthHistoryByResource(); + getCurrentChildHealthByResource(); } main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/emergingIssuesGetSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/emergingIssuesGetSample.ts index 01e82e546b13..f0cf74e7709f 100644 --- a/sdk/resourcehealth/arm-resourcehealth/samples-dev/emergingIssuesGetSample.ts +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/emergingIssuesGetSample.ts @@ -18,15 +18,16 @@ dotenv.config(); * This sample demonstrates how to Gets Azure services' emerging issues. * * @summary Gets Azure services' emerging issues. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_Get.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json */ async function getEmergingIssues() { const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const issueName = "default"; const credential = new DefaultAzureCredential(); const client = new MicrosoftResourceHealth(credential, subscriptionId); - const result = await client.emergingIssues.get(); + const result = await client.emergingIssues.get(issueName); console.log(result); } diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/emergingIssuesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/emergingIssuesListSample.ts index 53492e9b3249..2f08ecfd9d1a 100644 --- a/sdk/resourcehealth/arm-resourcehealth/samples-dev/emergingIssuesListSample.ts +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/emergingIssuesListSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Lists Azure services' emerging issues. * * @summary Lists Azure services' emerging issues. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_List.json + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json */ async function getEmergingIssues() { const subscriptionId = diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts new file mode 100644 index 000000000000..cedf5af120da --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts @@ -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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * + * @summary Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json + */ +async function eventDetailsBySubscriptionIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "eventTrackingId"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.fetchDetailsBySubscriptionIdAndTrackingId( + eventTrackingId + ); + console.log(result); +} + +async function main() { + eventDetailsBySubscriptionIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventFetchDetailsByTenantIdAndTrackingIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventFetchDetailsByTenantIdAndTrackingIdSample.ts new file mode 100644 index 000000000000..e4919b6e45a3 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventFetchDetailsByTenantIdAndTrackingIdSample.ts @@ -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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * + * @summary Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json + */ +async function eventDetailsByTenantIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "eventTrackingId"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.fetchDetailsByTenantIdAndTrackingId( + eventTrackingId + ); + console.log(result); +} + +async function main() { + eventDetailsByTenantIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventGetBySubscriptionIdAndTrackingIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventGetBySubscriptionIdAndTrackingIdSample.ts new file mode 100644 index 000000000000..8cf525bf28e1 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventGetBySubscriptionIdAndTrackingIdSample.ts @@ -0,0 +1,49 @@ +/* + * 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 { + EventGetBySubscriptionIdAndTrackingIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Service health event in the subscription by event tracking id + * + * @summary Service health event in the subscription by event tracking id + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json + */ +async function securityAdvisoriesEventBySubscriptionIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const filter = "properties/status eq 'Active'"; + const queryStartTime = "7/10/2022"; + const eventTrackingId = "eventTrackingId"; + const options: EventGetBySubscriptionIdAndTrackingIdOptionalParams = { + filter, + queryStartTime + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.getBySubscriptionIdAndTrackingId( + eventTrackingId, + options + ); + console.log(result); +} + +async function main() { + securityAdvisoriesEventBySubscriptionIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventGetByTenantIdAndTrackingIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventGetByTenantIdAndTrackingIdSample.ts new file mode 100644 index 000000000000..9c4a716d5811 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventGetByTenantIdAndTrackingIdSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { + EventGetByTenantIdAndTrackingIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Service health event in the tenant by event tracking id + * + * @summary Service health event in the tenant by event tracking id + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json + */ +async function eventByTenantIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const filter = "properties/status eq 'Active'"; + const queryStartTime = "7/10/2022"; + const eventTrackingId = "eventTrackingId"; + const options: EventGetByTenantIdAndTrackingIdOptionalParams = { + filter, + queryStartTime + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.getByTenantIdAndTrackingId( + eventTrackingId, + options + ); + console.log(result); +} + +async function main() { + eventByTenantIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListBySingleResourceSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListBySingleResourceSample.ts new file mode 100644 index 000000000000..c9a08f17d13c --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListBySingleResourceSample.ts @@ -0,0 +1,44 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists current service health events for given resource. + * + * @summary Lists current service health events for given resource. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json + */ +async function listEventsBySingleResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceUri = + "subscriptions/4abcdefgh-ijkl-mnop-qrstuvwxyz/resourceGroups/rhctestenv/providers/Microsoft.Compute/virtualMachines/rhctestenvV1PI"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.eventsOperations.listBySingleResource( + resourceUri + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsBySingleResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListBySubscriptionIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListBySubscriptionIdSample.ts new file mode 100644 index 000000000000..28ef72dd8ef9 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListBySubscriptionIdSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { + EventsListBySubscriptionIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists service health events in the subscription. + * + * @summary Lists service health events in the subscription. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json + */ +async function listEventsBySubscriptionId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const filter = "service eq 'Virtual Machines' or region eq 'West US'"; + const queryStartTime = "7/24/2020"; + const options: EventsListBySubscriptionIdOptionalParams = { + filter, + queryStartTime + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.eventsOperations.listBySubscriptionId( + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListByTenantIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListByTenantIdSample.ts new file mode 100644 index 000000000000..6833ec9649ae --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/eventsListByTenantIdSample.ts @@ -0,0 +1,49 @@ +/* + * 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 { + EventsListByTenantIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists current service health events in the tenant. + * + * @summary Lists current service health events in the tenant. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json + */ +async function listEventsByTenantId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const filter = "service eq 'Virtual Machines' or region eq 'West US'"; + const queryStartTime = "7/24/2020"; + const options: EventsListByTenantIdOptionalParams = { + filter, + queryStartTime + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.eventsOperations.listByTenantId(options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsByTenantId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesGetByTenantIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesGetByTenantIdSample.ts new file mode 100644 index 000000000000..fbd589c8e92a --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesGetByTenantIdSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the specific impacted resource in the tenant by an event. + * + * @summary Gets the specific impacted resource in the tenant by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + */ +async function impactedResourcesGet() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "BC_1-FXZ"; + const impactedResourceName = "abc-123-ghj-456"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.impactedResources.getByTenantId( + eventTrackingId, + impactedResourceName + ); + console.log(result); +} + +async function main() { + impactedResourcesGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesGetSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesGetSample.ts new file mode 100644 index 000000000000..778d79451772 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesGetSample.ts @@ -0,0 +1,41 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the specific impacted resource in the subscription by an event. + * + * @summary Gets the specific impacted resource in the subscription by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json + */ +async function impactedResourcesGet() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "BC_1-FXZ"; + const impactedResourceName = "abc-123-ghj-456"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.impactedResources.get( + eventTrackingId, + impactedResourceName + ); + console.log(result); +} + +async function main() { + impactedResourcesGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesListBySubscriptionIdAndEventIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesListBySubscriptionIdAndEventIdSample.ts new file mode 100644 index 000000000000..f585b4d5c6e0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesListBySubscriptionIdAndEventIdSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { + ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists impacted resources in the subscription by an event. + * + * @summary Lists impacted resources in the subscription by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json + */ +async function listImpactedResourcesBySubscriptionId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "BC_1-FXZ"; + const filter = "targetRegion eq 'westus'"; + const options: ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams = { + filter + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.impactedResources.listBySubscriptionIdAndEventId( + eventTrackingId, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listImpactedResourcesBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesListByTenantIdAndEventIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesListByTenantIdAndEventIdSample.ts new file mode 100644 index 000000000000..2279172bac12 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/impactedResourcesListByTenantIdAndEventIdSample.ts @@ -0,0 +1,51 @@ +/* + * 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 { + ImpactedResourcesListByTenantIdAndEventIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists impacted resources in the tenant by an event. + * + * @summary Lists impacted resources in the tenant by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json + */ +async function listEventsByTenantId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "BC_1-FXZ"; + const filter = "targetRegion eq 'westus'"; + const options: ImpactedResourcesListByTenantIdAndEventIdOptionalParams = { + filter + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.impactedResources.listByTenantIdAndEventId( + eventTrackingId, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsByTenantId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/metadataGetEntitySample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/metadataGetEntitySample.ts new file mode 100644 index 000000000000..c0573dd1005e --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/metadataGetEntitySample.ts @@ -0,0 +1,38 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of metadata entities. + * + * @summary Gets the list of metadata entities. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + */ +async function getMetadata() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const name = "status"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.metadata.getEntity(name); + console.log(result); +} + +async function main() { + getMetadata(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/metadataListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/metadataListSample.ts new file mode 100644 index 000000000000..c49556f29013 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/metadataListSample.ts @@ -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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of metadata entities. + * + * @summary Gets the list of metadata entities. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json + */ +async function getMetadata() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.metadata.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getMetadata(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/operationsListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..2cfe89f643c0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/operationsListSample.ts @@ -0,0 +1,37 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists available operations for the resourcehealth resource provider + * + * @summary Lists available operations for the resourcehealth resource provider + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Operations_List.json + */ +async function getOperationsList() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.operations.list(); + console.log(result); +} + +async function main() { + getOperationsList(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts new file mode 100644 index 000000000000..f33bee0fde45 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists impacted resources in the subscription by an event (Security Advisory). + * + * @summary Lists impacted resources in the subscription by an event (Security Advisory). + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json + */ +async function listSecurityAdvisoryImpactedResourcesBySubscriptionId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "BC_1-FXZ"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.securityAdvisoryImpactedResources.listBySubscriptionIdAndEventId( + eventTrackingId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSecurityAdvisoryImpactedResourcesBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples-dev/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples-dev/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts new file mode 100644 index 000000000000..5100e4156d50 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples-dev/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts @@ -0,0 +1,43 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists impacted resources in the tenant by an event (Security Advisory). + * + * @summary Lists impacted resources in the tenant by an event (Security Advisory). + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json + */ +async function listSecurityAdvisoryImpactedResourcesByTenantId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "BC_1-FXZ"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.securityAdvisoryImpactedResources.listByTenantIdAndEventId( + eventTrackingId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSecurityAdvisoryImpactedResourcesByTenantId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/README.md b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/README.md new file mode 100644 index 000000000000..b1757a56da37 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/README.md @@ -0,0 +1,98 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [availabilityStatusesGetByResourceSample.js][availabilitystatusesgetbyresourcesample] | Gets current availability status for a single resource x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json | +| [availabilityStatusesListByResourceGroupSample.js][availabilitystatuseslistbyresourcegroupsample] | Lists the current availability status for all the resources in the resource group. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json | +| [availabilityStatusesListBySubscriptionIdSample.js][availabilitystatuseslistbysubscriptionidsample] | Lists the current availability status for all the resources in the subscription. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json | +| [availabilityStatusesListSample.js][availabilitystatuseslistsample] | Lists all historical availability transitions and impacting events for a single resource. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_List.json | +| [childAvailabilityStatusesGetByResourceSample.js][childavailabilitystatusesgetbyresourcesample] | Gets current availability status for a single resource x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json | +| [childAvailabilityStatusesListSample.js][childavailabilitystatuseslistsample] | Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json | +| [childResourcesListSample.js][childresourceslistsample] | Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json | +| [emergingIssuesGetSample.js][emergingissuesgetsample] | Gets Azure services' emerging issues. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json | +| [emergingIssuesListSample.js][emergingissueslistsample] | Lists Azure services' emerging issues. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json | +| [eventFetchDetailsBySubscriptionIdAndTrackingIdSample.js][eventfetchdetailsbysubscriptionidandtrackingidsample] | Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json | +| [eventFetchDetailsByTenantIdAndTrackingIdSample.js][eventfetchdetailsbytenantidandtrackingidsample] | Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json | +| [eventGetBySubscriptionIdAndTrackingIdSample.js][eventgetbysubscriptionidandtrackingidsample] | Service health event in the subscription by event tracking id x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json | +| [eventGetByTenantIdAndTrackingIdSample.js][eventgetbytenantidandtrackingidsample] | Service health event in the tenant by event tracking id x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json | +| [eventsListBySingleResourceSample.js][eventslistbysingleresourcesample] | Lists current service health events for given resource. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json | +| [eventsListBySubscriptionIdSample.js][eventslistbysubscriptionidsample] | Lists service health events in the subscription. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json | +| [eventsListByTenantIdSample.js][eventslistbytenantidsample] | Lists current service health events in the tenant. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json | +| [impactedResourcesGetByTenantIdSample.js][impactedresourcesgetbytenantidsample] | Gets the specific impacted resource in the tenant by an event. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json | +| [impactedResourcesGetSample.js][impactedresourcesgetsample] | Gets the specific impacted resource in the subscription by an event. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json | +| [impactedResourcesListBySubscriptionIdAndEventIdSample.js][impactedresourceslistbysubscriptionidandeventidsample] | Lists impacted resources in the subscription by an event. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json | +| [impactedResourcesListByTenantIdAndEventIdSample.js][impactedresourceslistbytenantidandeventidsample] | Lists impacted resources in the tenant by an event. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json | +| [metadataGetEntitySample.js][metadatagetentitysample] | Gets the list of metadata entities. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json | +| [metadataListSample.js][metadatalistsample] | Gets the list of metadata entities. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json | +| [operationsListSample.js][operationslistsample] | Lists available operations for the resourcehealth resource provider x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Operations_List.json | +| [securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.js][securityadvisoryimpactedresourceslistbysubscriptionidandeventidsample] | Lists impacted resources in the subscription by an event (Security Advisory). x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json | +| [securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.js][securityadvisoryimpactedresourceslistbytenantidandeventidsample] | Lists impacted resources in the tenant by an event (Security Advisory). x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +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 availabilityStatusesGetByResourceSample.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 RESOURCEHEALTH_SUBSCRIPTION_ID="" node availabilityStatusesGetByResourceSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[availabilitystatusesgetbyresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesGetByResourceSample.js +[availabilitystatuseslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListByResourceGroupSample.js +[availabilitystatuseslistbysubscriptionidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListBySubscriptionIdSample.js +[availabilitystatuseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListSample.js +[childavailabilitystatusesgetbyresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesGetByResourceSample.js +[childavailabilitystatuseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesListSample.js +[childresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childResourcesListSample.js +[emergingissuesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesGetSample.js +[emergingissueslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesListSample.js +[eventfetchdetailsbysubscriptionidandtrackingidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.js +[eventfetchdetailsbytenantidandtrackingidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsByTenantIdAndTrackingIdSample.js +[eventgetbysubscriptionidandtrackingidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetBySubscriptionIdAndTrackingIdSample.js +[eventgetbytenantidandtrackingidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetByTenantIdAndTrackingIdSample.js +[eventslistbysingleresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySingleResourceSample.js +[eventslistbysubscriptionidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySubscriptionIdSample.js +[eventslistbytenantidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListByTenantIdSample.js +[impactedresourcesgetbytenantidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetByTenantIdSample.js +[impactedresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetSample.js +[impactedresourceslistbysubscriptionidandeventidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListBySubscriptionIdAndEventIdSample.js +[impactedresourceslistbytenantidandeventidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListByTenantIdAndEventIdSample.js +[metadatagetentitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataGetEntitySample.js +[metadatalistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataListSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/operationsListSample.js +[securityadvisoryimpactedresourceslistbysubscriptionidandeventidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.js +[securityadvisoryimpactedresourceslistbytenantidandeventidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcehealth?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcehealth/arm-resourcehealth/README.md diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesGetByResourceSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesGetByResourceSample.js new file mode 100644 index 000000000000..e3a727ae0233 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesGetByResourceSample.js @@ -0,0 +1,37 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets current availability status for a single resource + * + * @summary Gets current availability status for a single resource + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json + */ +async function getCurrentHealthByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceUri = "resourceUri"; + const expand = "recommendedactions"; + const options = { expand }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.availabilityStatuses.getByResource(resourceUri, options); + console.log(result); +} + +async function main() { + getCurrentHealthByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListByResourceGroupSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListByResourceGroupSample.js new file mode 100644 index 000000000000..d5e1c15602b2 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListByResourceGroupSample.js @@ -0,0 +1,44 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists the current availability status for all the resources in the resource group. + * + * @summary Lists the current availability status for all the resources in the resource group. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json + */ +async function listByResourceGroup() { + const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const resourceGroupName = process.env["RESOURCEHEALTH_RESOURCE_GROUP"] || "resourceGroupName"; + const expand = "recommendedactions"; + const options = { + expand, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availabilityStatuses.listByResourceGroup( + resourceGroupName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListBySubscriptionIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListBySubscriptionIdSample.js new file mode 100644 index 000000000000..92d8a33f4fe9 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListBySubscriptionIdSample.js @@ -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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists the current availability status for all the resources in the subscription. + * + * @summary Lists the current availability status for all the resources in the subscription. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json + */ +async function listHealthBySubscriptionId() { + const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const expand = "recommendedactions"; + const options = { + expand, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availabilityStatuses.listBySubscriptionId(options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listHealthBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListSample.js new file mode 100644 index 000000000000..84c63053bea5 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/availabilityStatusesListSample.js @@ -0,0 +1,38 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all historical availability transitions and impacting events for a single resource. + * + * @summary Lists all historical availability transitions and impacting events for a single resource. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_List.json + */ +async function getHealthHistoryByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceUri = "resourceUri"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availabilityStatuses.list(resourceUri)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getHealthHistoryByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesGetByResourceSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesGetByResourceSample.js new file mode 100644 index 000000000000..77c96f22121f --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesGetByResourceSample.js @@ -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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets current availability status for a single resource + * + * @summary Gets current availability status for a single resource + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json + */ +async function getChildCurrentHealthByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceUri = + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4"; + const expand = "recommendedactions"; + const options = { + expand, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.childAvailabilityStatuses.getByResource(resourceUri, options); + console.log(result); +} + +async function main() { + getChildCurrentHealthByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesListSample.js new file mode 100644 index 000000000000..f5707da3ddb3 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childAvailabilityStatusesListSample.js @@ -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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status + * + * @summary Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json + */ +async function getChildHealthHistoryByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceUri = + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.childAvailabilityStatuses.list(resourceUri)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getChildHealthHistoryByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childResourcesListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childResourcesListSample.js new file mode 100644 index 000000000000..908e49274398 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/childResourcesListSample.js @@ -0,0 +1,38 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health + * + * @summary Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json + */ +async function getCurrentChildHealthByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceUri = "resourceUri"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.childResources.list(resourceUri)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getCurrentChildHealthByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesGetSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesGetSample.js new file mode 100644 index 000000000000..a66f42052c2b --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesGetSample.js @@ -0,0 +1,35 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets Azure services' emerging issues. + * + * @summary Gets Azure services' emerging issues. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + */ +async function getEmergingIssues() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const issueName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.emergingIssues.get(issueName); + console.log(result); +} + +async function main() { + getEmergingIssues(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesListSample.js new file mode 100644 index 000000000000..41d8a6836a70 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/emergingIssuesListSample.js @@ -0,0 +1,37 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists Azure services' emerging issues. + * + * @summary Lists Azure services' emerging issues. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json + */ +async function getEmergingIssues() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.emergingIssues.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getEmergingIssues(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.js new file mode 100644 index 000000000000..762d1f763fa0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.js @@ -0,0 +1,36 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * + * @summary Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json + */ +async function eventDetailsBySubscriptionIdAndTrackingId() { + const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "eventTrackingId"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.fetchDetailsBySubscriptionIdAndTrackingId( + eventTrackingId + ); + console.log(result); +} + +async function main() { + eventDetailsBySubscriptionIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsByTenantIdAndTrackingIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsByTenantIdAndTrackingIdSample.js new file mode 100644 index 000000000000..8c32fea051f0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventFetchDetailsByTenantIdAndTrackingIdSample.js @@ -0,0 +1,35 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * + * @summary Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json + */ +async function eventDetailsByTenantIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "eventTrackingId"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.fetchDetailsByTenantIdAndTrackingId(eventTrackingId); + console.log(result); +} + +async function main() { + eventDetailsByTenantIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetBySubscriptionIdAndTrackingIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetBySubscriptionIdAndTrackingIdSample.js new file mode 100644 index 000000000000..bf77daecc17a --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetBySubscriptionIdAndTrackingIdSample.js @@ -0,0 +1,43 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Service health event in the subscription by event tracking id + * + * @summary Service health event in the subscription by event tracking id + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json + */ +async function securityAdvisoriesEventBySubscriptionIdAndTrackingId() { + const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const filter = "properties/status eq 'Active'"; + const queryStartTime = "7/10/2022"; + const eventTrackingId = "eventTrackingId"; + const options = { + filter, + queryStartTime, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.getBySubscriptionIdAndTrackingId( + eventTrackingId, + options + ); + console.log(result); +} + +async function main() { + securityAdvisoriesEventBySubscriptionIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetByTenantIdAndTrackingIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetByTenantIdAndTrackingIdSample.js new file mode 100644 index 000000000000..c6ecb51ccccb --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventGetByTenantIdAndTrackingIdSample.js @@ -0,0 +1,41 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Service health event in the tenant by event tracking id + * + * @summary Service health event in the tenant by event tracking id + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json + */ +async function eventByTenantIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const filter = "properties/status eq 'Active'"; + const queryStartTime = "7/10/2022"; + const eventTrackingId = "eventTrackingId"; + const options = { + filter, + queryStartTime, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.getByTenantIdAndTrackingId(eventTrackingId, options); + console.log(result); +} + +async function main() { + eventByTenantIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySingleResourceSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySingleResourceSample.js new file mode 100644 index 000000000000..19aeba5cb147 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySingleResourceSample.js @@ -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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists current service health events for given resource. + * + * @summary Lists current service health events for given resource. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json + */ +async function listEventsBySingleResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceUri = + "subscriptions/4abcdefgh-ijkl-mnop-qrstuvwxyz/resourceGroups/rhctestenv/providers/Microsoft.Compute/virtualMachines/rhctestenvV1PI"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.eventsOperations.listBySingleResource(resourceUri)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsBySingleResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySubscriptionIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySubscriptionIdSample.js new file mode 100644 index 000000000000..f04b1250bcb1 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListBySubscriptionIdSample.js @@ -0,0 +1,42 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists service health events in the subscription. + * + * @summary Lists service health events in the subscription. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json + */ +async function listEventsBySubscriptionId() { + const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const filter = "service eq 'Virtual Machines' or region eq 'West US'"; + const queryStartTime = "7/24/2020"; + const options = { + filter, + queryStartTime, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.eventsOperations.listBySubscriptionId(options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListByTenantIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListByTenantIdSample.js new file mode 100644 index 000000000000..f7e27e718483 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/eventsListByTenantIdSample.js @@ -0,0 +1,43 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists current service health events in the tenant. + * + * @summary Lists current service health events in the tenant. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json + */ +async function listEventsByTenantId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const filter = "service eq 'Virtual Machines' or region eq 'West US'"; + const queryStartTime = "7/24/2020"; + const options = { + filter, + queryStartTime, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.eventsOperations.listByTenantId(options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsByTenantId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetByTenantIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetByTenantIdSample.js new file mode 100644 index 000000000000..42d602b8cd6e --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetByTenantIdSample.js @@ -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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the specific impacted resource in the tenant by an event. + * + * @summary Gets the specific impacted resource in the tenant by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + */ +async function impactedResourcesGet() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "BC_1-FXZ"; + const impactedResourceName = "abc-123-ghj-456"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.impactedResources.getByTenantId( + eventTrackingId, + impactedResourceName + ); + console.log(result); +} + +async function main() { + impactedResourcesGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetSample.js new file mode 100644 index 000000000000..bed1f7b3dbeb --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesGetSample.js @@ -0,0 +1,35 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the specific impacted resource in the subscription by an event. + * + * @summary Gets the specific impacted resource in the subscription by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json + */ +async function impactedResourcesGet() { + const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "BC_1-FXZ"; + const impactedResourceName = "abc-123-ghj-456"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.impactedResources.get(eventTrackingId, impactedResourceName); + console.log(result); +} + +async function main() { + impactedResourcesGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListBySubscriptionIdAndEventIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListBySubscriptionIdAndEventIdSample.js new file mode 100644 index 000000000000..123c648dd0e9 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListBySubscriptionIdAndEventIdSample.js @@ -0,0 +1,44 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists impacted resources in the subscription by an event. + * + * @summary Lists impacted resources in the subscription by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json + */ +async function listImpactedResourcesBySubscriptionId() { + const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "BC_1-FXZ"; + const filter = "targetRegion eq 'westus'"; + const options = { + filter, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.impactedResources.listBySubscriptionIdAndEventId( + eventTrackingId, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listImpactedResourcesBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListByTenantIdAndEventIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListByTenantIdAndEventIdSample.js new file mode 100644 index 000000000000..3cf4caf63913 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/impactedResourcesListByTenantIdAndEventIdSample.js @@ -0,0 +1,45 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists impacted resources in the tenant by an event. + * + * @summary Lists impacted resources in the tenant by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json + */ +async function listEventsByTenantId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "BC_1-FXZ"; + const filter = "targetRegion eq 'westus'"; + const options = { + filter, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.impactedResources.listByTenantIdAndEventId( + eventTrackingId, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsByTenantId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataGetEntitySample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataGetEntitySample.js new file mode 100644 index 000000000000..1962de0cf4b6 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataGetEntitySample.js @@ -0,0 +1,35 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the list of metadata entities. + * + * @summary Gets the list of metadata entities. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + */ +async function getMetadata() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const name = "status"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.metadata.getEntity(name); + console.log(result); +} + +async function main() { + getMetadata(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataListSample.js new file mode 100644 index 000000000000..77427004bae8 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/metadataListSample.js @@ -0,0 +1,37 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the list of metadata entities. + * + * @summary Gets the list of metadata entities. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json + */ +async function getMetadata() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.metadata.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getMetadata(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/operationsListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/operationsListSample.js new file mode 100644 index 000000000000..978dda376541 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/operationsListSample.js @@ -0,0 +1,34 @@ +/* + * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists available operations for the resourcehealth resource provider + * + * @summary Lists available operations for the resourcehealth resource provider + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Operations_List.json + */ +async function getOperationsList() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.operations.list(); + console.log(result); +} + +async function main() { + getOperationsList(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/package.json b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/package.json new file mode 100644 index 000000000000..35e6983b8217 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-resourcehealth-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/resourcehealth/arm-resourcehealth" + }, + "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/resourcehealth/arm-resourcehealth", + "dependencies": { + "@azure/arm-resourcehealth": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/sample.env b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.js new file mode 100644 index 000000000000..1339c45eea50 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.js @@ -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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists impacted resources in the subscription by an event (Security Advisory). + * + * @summary Lists impacted resources in the subscription by an event (Security Advisory). + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json + */ +async function listSecurityAdvisoryImpactedResourcesBySubscriptionId() { + const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "BC_1-FXZ"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.securityAdvisoryImpactedResources.listBySubscriptionIdAndEventId( + eventTrackingId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSecurityAdvisoryImpactedResourcesBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.js new file mode 100644 index 000000000000..06f94eac00b4 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/javascript/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.js @@ -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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists impacted resources in the tenant by an event (Security Advisory). + * + * @summary Lists impacted resources in the tenant by an event (Security Advisory). + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json + */ +async function listSecurityAdvisoryImpactedResourcesByTenantId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "BC_1-FXZ"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.securityAdvisoryImpactedResources.listByTenantIdAndEventId( + eventTrackingId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSecurityAdvisoryImpactedResourcesByTenantId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/README.md b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/README.md new file mode 100644 index 000000000000..80fef1b56a62 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/README.md @@ -0,0 +1,111 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [availabilityStatusesGetByResourceSample.ts][availabilitystatusesgetbyresourcesample] | Gets current availability status for a single resource x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json | +| [availabilityStatusesListByResourceGroupSample.ts][availabilitystatuseslistbyresourcegroupsample] | Lists the current availability status for all the resources in the resource group. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json | +| [availabilityStatusesListBySubscriptionIdSample.ts][availabilitystatuseslistbysubscriptionidsample] | Lists the current availability status for all the resources in the subscription. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json | +| [availabilityStatusesListSample.ts][availabilitystatuseslistsample] | Lists all historical availability transitions and impacting events for a single resource. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_List.json | +| [childAvailabilityStatusesGetByResourceSample.ts][childavailabilitystatusesgetbyresourcesample] | Gets current availability status for a single resource x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json | +| [childAvailabilityStatusesListSample.ts][childavailabilitystatuseslistsample] | Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json | +| [childResourcesListSample.ts][childresourceslistsample] | Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json | +| [emergingIssuesGetSample.ts][emergingissuesgetsample] | Gets Azure services' emerging issues. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json | +| [emergingIssuesListSample.ts][emergingissueslistsample] | Lists Azure services' emerging issues. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json | +| [eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts][eventfetchdetailsbysubscriptionidandtrackingidsample] | Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json | +| [eventFetchDetailsByTenantIdAndTrackingIdSample.ts][eventfetchdetailsbytenantidandtrackingidsample] | Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json | +| [eventGetBySubscriptionIdAndTrackingIdSample.ts][eventgetbysubscriptionidandtrackingidsample] | Service health event in the subscription by event tracking id x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json | +| [eventGetByTenantIdAndTrackingIdSample.ts][eventgetbytenantidandtrackingidsample] | Service health event in the tenant by event tracking id x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json | +| [eventsListBySingleResourceSample.ts][eventslistbysingleresourcesample] | Lists current service health events for given resource. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json | +| [eventsListBySubscriptionIdSample.ts][eventslistbysubscriptionidsample] | Lists service health events in the subscription. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json | +| [eventsListByTenantIdSample.ts][eventslistbytenantidsample] | Lists current service health events in the tenant. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json | +| [impactedResourcesGetByTenantIdSample.ts][impactedresourcesgetbytenantidsample] | Gets the specific impacted resource in the tenant by an event. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json | +| [impactedResourcesGetSample.ts][impactedresourcesgetsample] | Gets the specific impacted resource in the subscription by an event. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json | +| [impactedResourcesListBySubscriptionIdAndEventIdSample.ts][impactedresourceslistbysubscriptionidandeventidsample] | Lists impacted resources in the subscription by an event. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json | +| [impactedResourcesListByTenantIdAndEventIdSample.ts][impactedresourceslistbytenantidandeventidsample] | Lists impacted resources in the tenant by an event. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json | +| [metadataGetEntitySample.ts][metadatagetentitysample] | Gets the list of metadata entities. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json | +| [metadataListSample.ts][metadatalistsample] | Gets the list of metadata entities. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json | +| [operationsListSample.ts][operationslistsample] | Lists available operations for the resourcehealth resource provider x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Operations_List.json | +| [securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts][securityadvisoryimpactedresourceslistbysubscriptionidandeventidsample] | Lists impacted resources in the subscription by an event (Security Advisory). x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json | +| [securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts][securityadvisoryimpactedresourceslistbytenantidandeventidsample] | Lists impacted resources in the tenant by an event (Security Advisory). x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +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/availabilityStatusesGetByResourceSample.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 RESOURCEHEALTH_SUBSCRIPTION_ID="" node dist/availabilityStatusesGetByResourceSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[availabilitystatusesgetbyresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesGetByResourceSample.ts +[availabilitystatuseslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListByResourceGroupSample.ts +[availabilitystatuseslistbysubscriptionidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts +[availabilitystatuseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListSample.ts +[childavailabilitystatusesgetbyresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesGetByResourceSample.ts +[childavailabilitystatuseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesListSample.ts +[childresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childResourcesListSample.ts +[emergingissuesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesGetSample.ts +[emergingissueslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesListSample.ts +[eventfetchdetailsbysubscriptionidandtrackingidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts +[eventfetchdetailsbytenantidandtrackingidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsByTenantIdAndTrackingIdSample.ts +[eventgetbysubscriptionidandtrackingidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetBySubscriptionIdAndTrackingIdSample.ts +[eventgetbytenantidandtrackingidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetByTenantIdAndTrackingIdSample.ts +[eventslistbysingleresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySingleResourceSample.ts +[eventslistbysubscriptionidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySubscriptionIdSample.ts +[eventslistbytenantidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListByTenantIdSample.ts +[impactedresourcesgetbytenantidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetByTenantIdSample.ts +[impactedresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetSample.ts +[impactedresourceslistbysubscriptionidandeventidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListBySubscriptionIdAndEventIdSample.ts +[impactedresourceslistbytenantidandeventidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListByTenantIdAndEventIdSample.ts +[metadatagetentitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataGetEntitySample.ts +[metadatalistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataListSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/operationsListSample.ts +[securityadvisoryimpactedresourceslistbysubscriptionidandeventidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts +[securityadvisoryimpactedresourceslistbytenantidandeventidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcehealth?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcehealth/arm-resourcehealth/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/package.json b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/package.json new file mode 100644 index 000000000000..379737a53cb4 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-resourcehealth-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/resourcehealth/arm-resourcehealth" + }, + "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/resourcehealth/arm-resourcehealth", + "dependencies": { + "@azure/arm-resourcehealth": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~5.0.0", + "rimraf": "latest" + } +} diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/sample.env b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesGetByResourceSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesGetByResourceSample.ts new file mode 100644 index 000000000000..9a6de7d115dc --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesGetByResourceSample.ts @@ -0,0 +1,46 @@ +/* + * 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 { + AvailabilityStatusesGetByResourceOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets current availability status for a single resource + * + * @summary Gets current availability status for a single resource + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json + */ +async function getCurrentHealthByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceUri = "resourceUri"; + const expand = "recommendedactions"; + const options: AvailabilityStatusesGetByResourceOptionalParams = { expand }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.availabilityStatuses.getByResource( + resourceUri, + options + ); + console.log(result); +} + +async function main() { + getCurrentHealthByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListByResourceGroupSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListByResourceGroupSample.ts new file mode 100644 index 000000000000..288966705df0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListByResourceGroupSample.ts @@ -0,0 +1,51 @@ +/* + * 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 { + AvailabilityStatusesListByResourceGroupOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists the current availability status for all the resources in the resource group. + * + * @summary Lists the current availability status for all the resources in the resource group. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json + */ +async function listByResourceGroup() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const resourceGroupName = + process.env["RESOURCEHEALTH_RESOURCE_GROUP"] || "resourceGroupName"; + const expand = "recommendedactions"; + const options: AvailabilityStatusesListByResourceGroupOptionalParams = { + expand + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availabilityStatuses.listByResourceGroup( + resourceGroupName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts new file mode 100644 index 000000000000..c1204ae9a395 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + AvailabilityStatusesListBySubscriptionIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists the current availability status for all the resources in the subscription. + * + * @summary Lists the current availability status for all the resources in the subscription. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json + */ +async function listHealthBySubscriptionId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const expand = "recommendedactions"; + const options: AvailabilityStatusesListBySubscriptionIdOptionalParams = { + expand + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availabilityStatuses.listBySubscriptionId( + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listHealthBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListSample.ts new file mode 100644 index 000000000000..ad9f65f07576 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/availabilityStatusesListSample.ts @@ -0,0 +1,41 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all historical availability transitions and impacting events for a single resource. + * + * @summary Lists all historical availability transitions and impacting events for a single resource. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_List.json + */ +async function getHealthHistoryByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceUri = "resourceUri"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availabilityStatuses.list(resourceUri)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getHealthHistoryByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesGetByResourceSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesGetByResourceSample.ts new file mode 100644 index 000000000000..8035a19dab11 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesGetByResourceSample.ts @@ -0,0 +1,49 @@ +/* + * 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 { + ChildAvailabilityStatusesGetByResourceOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets current availability status for a single resource + * + * @summary Gets current availability status for a single resource + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json + */ +async function getChildCurrentHealthByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceUri = + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4"; + const expand = "recommendedactions"; + const options: ChildAvailabilityStatusesGetByResourceOptionalParams = { + expand + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.childAvailabilityStatuses.getByResource( + resourceUri, + options + ); + console.log(result); +} + +async function main() { + getChildCurrentHealthByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesListSample.ts new file mode 100644 index 000000000000..fd1848deeebc --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childAvailabilityStatusesListSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status + * + * @summary Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json + */ +async function getChildHealthHistoryByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceUri = + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.childAvailabilityStatuses.list(resourceUri)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getChildHealthHistoryByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childResourcesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childResourcesListSample.ts new file mode 100644 index 000000000000..13d61813cefd --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/childResourcesListSample.ts @@ -0,0 +1,41 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health + * + * @summary Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json + */ +async function getCurrentChildHealthByResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceUri = "resourceUri"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.childResources.list(resourceUri)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getCurrentChildHealthByResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesGetSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesGetSample.ts new file mode 100644 index 000000000000..f0cf74e7709f --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesGetSample.ts @@ -0,0 +1,38 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets Azure services' emerging issues. + * + * @summary Gets Azure services' emerging issues. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + */ +async function getEmergingIssues() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const issueName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.emergingIssues.get(issueName); + console.log(result); +} + +async function main() { + getEmergingIssues(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesListSample.ts new file mode 100644 index 000000000000..2f08ecfd9d1a --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/emergingIssuesListSample.ts @@ -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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists Azure services' emerging issues. + * + * @summary Lists Azure services' emerging issues. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json + */ +async function getEmergingIssues() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.emergingIssues.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getEmergingIssues(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts new file mode 100644 index 000000000000..cedf5af120da --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsBySubscriptionIdAndTrackingIdSample.ts @@ -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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * + * @summary Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json + */ +async function eventDetailsBySubscriptionIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "eventTrackingId"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.fetchDetailsBySubscriptionIdAndTrackingId( + eventTrackingId + ); + console.log(result); +} + +async function main() { + eventDetailsBySubscriptionIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsByTenantIdAndTrackingIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsByTenantIdAndTrackingIdSample.ts new file mode 100644 index 000000000000..e4919b6e45a3 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventFetchDetailsByTenantIdAndTrackingIdSample.ts @@ -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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * + * @summary Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json + */ +async function eventDetailsByTenantIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "eventTrackingId"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.fetchDetailsByTenantIdAndTrackingId( + eventTrackingId + ); + console.log(result); +} + +async function main() { + eventDetailsByTenantIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetBySubscriptionIdAndTrackingIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetBySubscriptionIdAndTrackingIdSample.ts new file mode 100644 index 000000000000..8cf525bf28e1 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetBySubscriptionIdAndTrackingIdSample.ts @@ -0,0 +1,49 @@ +/* + * 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 { + EventGetBySubscriptionIdAndTrackingIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Service health event in the subscription by event tracking id + * + * @summary Service health event in the subscription by event tracking id + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json + */ +async function securityAdvisoriesEventBySubscriptionIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const filter = "properties/status eq 'Active'"; + const queryStartTime = "7/10/2022"; + const eventTrackingId = "eventTrackingId"; + const options: EventGetBySubscriptionIdAndTrackingIdOptionalParams = { + filter, + queryStartTime + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.getBySubscriptionIdAndTrackingId( + eventTrackingId, + options + ); + console.log(result); +} + +async function main() { + securityAdvisoriesEventBySubscriptionIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetByTenantIdAndTrackingIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetByTenantIdAndTrackingIdSample.ts new file mode 100644 index 000000000000..9c4a716d5811 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventGetByTenantIdAndTrackingIdSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { + EventGetByTenantIdAndTrackingIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Service health event in the tenant by event tracking id + * + * @summary Service health event in the tenant by event tracking id + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json + */ +async function eventByTenantIdAndTrackingId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const filter = "properties/status eq 'Active'"; + const queryStartTime = "7/10/2022"; + const eventTrackingId = "eventTrackingId"; + const options: EventGetByTenantIdAndTrackingIdOptionalParams = { + filter, + queryStartTime + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.eventOperations.getByTenantIdAndTrackingId( + eventTrackingId, + options + ); + console.log(result); +} + +async function main() { + eventByTenantIdAndTrackingId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySingleResourceSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySingleResourceSample.ts new file mode 100644 index 000000000000..c9a08f17d13c --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySingleResourceSample.ts @@ -0,0 +1,44 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists current service health events for given resource. + * + * @summary Lists current service health events for given resource. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json + */ +async function listEventsBySingleResource() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceUri = + "subscriptions/4abcdefgh-ijkl-mnop-qrstuvwxyz/resourceGroups/rhctestenv/providers/Microsoft.Compute/virtualMachines/rhctestenvV1PI"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.eventsOperations.listBySingleResource( + resourceUri + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsBySingleResource(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySubscriptionIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySubscriptionIdSample.ts new file mode 100644 index 000000000000..28ef72dd8ef9 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListBySubscriptionIdSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { + EventsListBySubscriptionIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists service health events in the subscription. + * + * @summary Lists service health events in the subscription. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json + */ +async function listEventsBySubscriptionId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const filter = "service eq 'Virtual Machines' or region eq 'West US'"; + const queryStartTime = "7/24/2020"; + const options: EventsListBySubscriptionIdOptionalParams = { + filter, + queryStartTime + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.eventsOperations.listBySubscriptionId( + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListByTenantIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListByTenantIdSample.ts new file mode 100644 index 000000000000..6833ec9649ae --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/eventsListByTenantIdSample.ts @@ -0,0 +1,49 @@ +/* + * 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 { + EventsListByTenantIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists current service health events in the tenant. + * + * @summary Lists current service health events in the tenant. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json + */ +async function listEventsByTenantId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const filter = "service eq 'Virtual Machines' or region eq 'West US'"; + const queryStartTime = "7/24/2020"; + const options: EventsListByTenantIdOptionalParams = { + filter, + queryStartTime + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.eventsOperations.listByTenantId(options)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsByTenantId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetByTenantIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetByTenantIdSample.ts new file mode 100644 index 000000000000..fbd589c8e92a --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetByTenantIdSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the specific impacted resource in the tenant by an event. + * + * @summary Gets the specific impacted resource in the tenant by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + */ +async function impactedResourcesGet() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "BC_1-FXZ"; + const impactedResourceName = "abc-123-ghj-456"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.impactedResources.getByTenantId( + eventTrackingId, + impactedResourceName + ); + console.log(result); +} + +async function main() { + impactedResourcesGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetSample.ts new file mode 100644 index 000000000000..778d79451772 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesGetSample.ts @@ -0,0 +1,41 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the specific impacted resource in the subscription by an event. + * + * @summary Gets the specific impacted resource in the subscription by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json + */ +async function impactedResourcesGet() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "BC_1-FXZ"; + const impactedResourceName = "abc-123-ghj-456"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.impactedResources.get( + eventTrackingId, + impactedResourceName + ); + console.log(result); +} + +async function main() { + impactedResourcesGet(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListBySubscriptionIdAndEventIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListBySubscriptionIdAndEventIdSample.ts new file mode 100644 index 000000000000..f585b4d5c6e0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListBySubscriptionIdAndEventIdSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { + ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists impacted resources in the subscription by an event. + * + * @summary Lists impacted resources in the subscription by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json + */ +async function listImpactedResourcesBySubscriptionId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "BC_1-FXZ"; + const filter = "targetRegion eq 'westus'"; + const options: ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams = { + filter + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.impactedResources.listBySubscriptionIdAndEventId( + eventTrackingId, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listImpactedResourcesBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListByTenantIdAndEventIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListByTenantIdAndEventIdSample.ts new file mode 100644 index 000000000000..2279172bac12 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/impactedResourcesListByTenantIdAndEventIdSample.ts @@ -0,0 +1,51 @@ +/* + * 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 { + ImpactedResourcesListByTenantIdAndEventIdOptionalParams, + MicrosoftResourceHealth +} from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists impacted resources in the tenant by an event. + * + * @summary Lists impacted resources in the tenant by an event. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json + */ +async function listEventsByTenantId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "BC_1-FXZ"; + const filter = "targetRegion eq 'westus'"; + const options: ImpactedResourcesListByTenantIdAndEventIdOptionalParams = { + filter + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.impactedResources.listByTenantIdAndEventId( + eventTrackingId, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEventsByTenantId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataGetEntitySample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataGetEntitySample.ts new file mode 100644 index 000000000000..c0573dd1005e --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataGetEntitySample.ts @@ -0,0 +1,38 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of metadata entities. + * + * @summary Gets the list of metadata entities. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + */ +async function getMetadata() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const name = "status"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.metadata.getEntity(name); + console.log(result); +} + +async function main() { + getMetadata(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataListSample.ts new file mode 100644 index 000000000000..c49556f29013 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/metadataListSample.ts @@ -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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of metadata entities. + * + * @summary Gets the list of metadata entities. + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json + */ +async function getMetadata() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.metadata.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getMetadata(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/operationsListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..2cfe89f643c0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/operationsListSample.ts @@ -0,0 +1,37 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists available operations for the resourcehealth resource provider + * + * @summary Lists available operations for the resourcehealth resource provider + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Operations_List.json + */ +async function getOperationsList() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const result = await client.operations.list(); + console.log(result); +} + +async function main() { + getOperationsList(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts new file mode 100644 index 000000000000..f33bee0fde45 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSample.ts @@ -0,0 +1,42 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists impacted resources in the subscription by an event (Security Advisory). + * + * @summary Lists impacted resources in the subscription by an event (Security Advisory). + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json + */ +async function listSecurityAdvisoryImpactedResourcesBySubscriptionId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; + const eventTrackingId = "BC_1-FXZ"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.securityAdvisoryImpactedResources.listBySubscriptionIdAndEventId( + eventTrackingId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSecurityAdvisoryImpactedResourcesBySubscriptionId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts new file mode 100644 index 000000000000..5100e4156d50 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/src/securityAdvisoryImpactedResourcesListByTenantIdAndEventIdSample.ts @@ -0,0 +1,43 @@ +/* + * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists impacted resources in the tenant by an event (Security Advisory). + * + * @summary Lists impacted resources in the tenant by an event (Security Advisory). + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json + */ +async function listSecurityAdvisoryImpactedResourcesByTenantId() { + const subscriptionId = + process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const eventTrackingId = "BC_1-FXZ"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftResourceHealth(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.securityAdvisoryImpactedResources.listByTenantIdAndEventId( + eventTrackingId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSecurityAdvisoryImpactedResourcesByTenantId(); +} + +main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/tsconfig.json b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/samples/v4/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealth.ts b/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealth.ts index 4f595976f7ee..a7f0a940309d 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealth.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealth.ts @@ -16,16 +16,26 @@ import { import * as coreAuth from "@azure/core-auth"; import { AvailabilityStatusesImpl, + OperationsImpl, + MetadataImpl, + ImpactedResourcesImpl, + SecurityAdvisoryImpactedResourcesImpl, + EventsOperationsImpl, + EventOperationsImpl, ChildAvailabilityStatusesImpl, ChildResourcesImpl, - OperationsImpl, EmergingIssuesImpl } from "./operations"; import { AvailabilityStatuses, + Operations, + Metadata, + ImpactedResources, + SecurityAdvisoryImpactedResources, + EventsOperations, + EventOperations, ChildAvailabilityStatuses, ChildResources, - Operations, EmergingIssues } from "./operationsInterfaces"; import { MicrosoftResourceHealthOptionalParams } from "./models"; @@ -38,8 +48,7 @@ export class MicrosoftResourceHealth extends coreClient.ServiceClient { /** * Initializes a new instance of the MicrosoftResourceHealth class. * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure subscription. - * The subscription ID forms part of the URI for every service call. + * @param subscriptionId The ID of the target subscription. * @param options The parameter options */ constructor( @@ -63,7 +72,7 @@ export class MicrosoftResourceHealth extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-resourcehealth/3.2.1`; + const packageDetails = `azsdk-js-arm-resourcehealth/4.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -116,11 +125,18 @@ export class MicrosoftResourceHealth extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2017-07-01"; + this.apiVersion = options.apiVersion || "2022-10-01"; this.availabilityStatuses = new AvailabilityStatusesImpl(this); + this.operations = new OperationsImpl(this); + this.metadata = new MetadataImpl(this); + this.impactedResources = new ImpactedResourcesImpl(this); + this.securityAdvisoryImpactedResources = new SecurityAdvisoryImpactedResourcesImpl( + this + ); + this.eventsOperations = new EventsOperationsImpl(this); + this.eventOperations = new EventOperationsImpl(this); this.childAvailabilityStatuses = new ChildAvailabilityStatusesImpl(this); this.childResources = new ChildResourcesImpl(this); - this.operations = new OperationsImpl(this); this.emergingIssues = new EmergingIssuesImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); } @@ -154,8 +170,13 @@ export class MicrosoftResourceHealth extends coreClient.ServiceClient { } availabilityStatuses: AvailabilityStatuses; + operations: Operations; + metadata: Metadata; + impactedResources: ImpactedResources; + securityAdvisoryImpactedResources: SecurityAdvisoryImpactedResources; + eventsOperations: EventsOperations; + eventOperations: EventOperations; childAvailabilityStatuses: ChildAvailabilityStatuses; childResources: ChildResources; - operations: Operations; emergingIssues: EmergingIssues; } diff --git a/sdk/resourcehealth/arm-resourcehealth/src/models/index.ts b/sdk/resourcehealth/arm-resourcehealth/src/models/index.ts index a7723b880144..92b42f4b0a75 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/models/index.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/models/index.ts @@ -34,12 +34,20 @@ export interface AvailabilityStatus { export interface AvailabilityStatusProperties { /** Availability status of the resource. When it is null, this availabilityStatus object represents an availability impacting event */ availabilityState?: AvailabilityStateValues; + /** Title description of the availability status. */ + title?: string; /** Summary description of the availability status. */ summary?: string; /** Details of the availability status. */ detailedStatus?: string; /** When the resource's availabilityState is Unavailable, it describes where the health impacting event was originated. Examples are planned, unplanned, user initiated or an outage etc. */ reasonType?: string; + /** When an event is created, it can either be triggered by a customer or the platform of the resource and this field will illustrate that. This field is connected to the category field in this object. */ + context?: string; + /** When a context field is set to Platform, this field will reflect if the event was planned or unplanned. If the context field does not have a value of Platform, then this field will be ignored. */ + category?: string; + /** The Article Id */ + articleId?: string; /** When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting event was received. */ rootCauseAttributionTime?: Date; /** In case of an availability impacting event, it describes when the health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. */ @@ -59,7 +67,7 @@ export interface AvailabilityStatusProperties { /** Timestamp for when the health was last checked. */ reportedTime?: Date; /** An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned */ - recentlyResolvedState?: AvailabilityStatusPropertiesRecentlyResolvedState; + recentlyResolved?: AvailabilityStatusPropertiesRecentlyResolved; /** Lists actions the user can take based on the current availabilityState of the resource. */ recommendedActions?: RecommendedAction[]; /** Lists the service impacting events that may be affecting the health of the resource. */ @@ -67,13 +75,13 @@ export interface AvailabilityStatusProperties { } /** An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned */ -export interface AvailabilityStatusPropertiesRecentlyResolvedState { +export interface AvailabilityStatusPropertiesRecentlyResolved { /** Timestamp for when the availabilityState changed to Unavailable */ - unavailableOccurredTime?: Date; + unavailableOccuredTime?: Date; /** Timestamp when the availabilityState changes to Available. */ resolvedTime?: Date; /** Brief description of cause of the resource becoming unavailable. */ - unavailabilitySummary?: string; + unavailableSummary?: string; } /** Lists actions the user can take based on the current availabilityState of the resource. */ @@ -82,7 +90,9 @@ export interface RecommendedAction { action?: string; /** Link to the action */ actionUrl?: string; - /** Substring of action, it describes which text should host the action url. */ + /** the comment for the Action */ + actionUrlComment?: string; + /** Substring of action, it describes which text should host the action URL. */ actionUrlText?: string; } @@ -139,11 +149,11 @@ export interface ErrorResponse { /** Lists the operations response. */ export interface OperationListResult { - /** List of operations available in the resourcehealth resource provider. */ + /** List of operations available in the Microsoft.ResourceHealth resource provider. */ value: Operation[]; } -/** Operation available in the resourcehealth resource provider. */ +/** Operation available in the Microsoft.ResourceHealth resource provider. */ export interface Operation { /** Name of the operation. */ name?: string; @@ -163,6 +173,200 @@ export interface OperationDisplay { description?: string; } +/** The list of metadata entities */ +export interface MetadataEntityListResult { + /** The list of metadata entities. */ + value?: MetadataEntity[]; + /** The link used to get the next page of metadata. */ + nextLink?: string; +} + +/** The metadata supported value detail. */ +export interface MetadataSupportedValueDetail { + /** The id. */ + id?: string; + /** The display name. */ + displayName?: string; + /** The list of associated resource types. */ + resourceTypes?: 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; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** The List of eventImpactedResources operation response. */ +export interface EventImpactedResourceListResult { + /** The list of eventImpactedResources. */ + value: EventImpactedResource[]; + /** The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of impacted resource. */ + nextLink?: string; +} + +/** Key value tuple. */ +export interface KeyValueItem { + /** + * Key of tuple. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly key?: string; + /** + * Value of tuple. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: string; +} + +/** The List events operation response. */ +export interface Events { + /** The list of event. */ + value: Event[]; + /** The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of events. */ + nextLink?: string; +} + +/** Article of event. */ +export interface EventPropertiesArticle { + /** Article content of event. */ + articleContent?: string; + /** Article Id */ + articleId?: string; + /** It provides a map of parameter name and value */ + parameters?: Record; +} + +/** Useful links for service health event. */ +export interface Link { + /** Type of link. */ + type?: LinkTypeValues; + /** Display text of link. */ + displayText?: LinkDisplayText; + /** It provides the name of portal extension to produce link for given service health event. */ + extensionName?: string; + /** It provides the name of portal extension blade to produce link for given service health event. */ + bladeName?: string; + /** It provides a map of parameter name and value for portal extension blade to produce lik for given service health event. */ + parameters?: Record; +} + +/** Display text of link. */ +export interface LinkDisplayText { + /** Display text of link. */ + value?: string; + /** Localized display text of link. */ + localizedValue?: string; +} + +/** Azure service impacted by the service health event. */ +export interface Impact { + /** Impacted service name. */ + impactedService?: string; + /** List regions impacted by the service health event. */ + impactedRegions?: ImpactedServiceRegion[]; +} + +/** Azure region impacted by the service health event. */ +export interface ImpactedServiceRegion { + /** Impacted region name. */ + impactedRegion?: string; + /** Current status of event in the region. */ + status?: EventStatusValues; + /** List subscription impacted by the service health event. */ + impactedSubscriptions?: string[]; + /** List tenant impacted by the service health event. */ + impactedTenants?: string[]; + /** It provides the Timestamp for when the last update for the service health event. */ + lastUpdateTime?: Date; + /** List of updates for given service health event. */ + updates?: Update[]; +} + +/** Update for service health event. */ +export interface Update { + /** Summary text for the given update for the service health event. */ + summary?: string; + /** It provides the Timestamp for the given update for the service health event. */ + updateDateTime?: Date; +} + +/** Recommended actions of event. */ +export interface EventPropertiesRecommendedActions { + /** Recommended action title for the service health event. */ + message?: string; + /** Recommended actions for the service health event. */ + actions?: EventPropertiesRecommendedActionsItem[]; + /** Recommended action locale for the service health event. */ + localeCode?: string; +} + +/** Recommended action for the service health event. */ +export interface EventPropertiesRecommendedActionsItem { + /** Recommended action group Id for the service health event. */ + groupId?: number; + /** Recommended action text */ + actionText?: string; +} + +/** Frequently asked question for the service health event */ +export interface Faq { + /** FAQ question for the service health event. */ + question?: string; + /** FAQ answer for the service health event. */ + answer?: string; + /** FAQ locale for the service health event. */ + localeCode?: string; +} + +/** Additional information */ +export interface EventPropertiesAdditionalInformation { + /** Additional information Message */ + message?: string; +} + +/** The list of emerging issues. */ +export interface EmergingIssueListResult { + /** The list of emerging issues. */ + value?: EmergingIssuesGetResult[]; + /** The link used to get the next page of emerging issues. */ + nextLink?: string; +} + /** Banner type of emerging issue. */ export interface StatusBanner { /** The banner title. */ @@ -217,35 +421,104 @@ export interface ImpactedRegion { name?: string; } -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +/** The metadata entity contract. */ +export interface MetadataEntity extends ProxyResource { + /** The display name. */ + displayName?: string; + /** The list of keys on which this entity depends on. */ + dependsOn?: string[]; + /** The list of scenarios applicable to this metadata entity. */ + applicableScenarios?: Scenario[]; + /** The list of supported values. */ + supportedValues?: MetadataSupportedValueDetail[]; +} + +/** Impacted resource for an event. */ +export interface EventImpactedResource extends ProxyResource { /** - * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * Resource type within Microsoft cloud. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly id?: string; + readonly targetResourceType?: string; /** - * The name of the resource + * Identity for resource within Microsoft cloud. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; + readonly targetResourceId?: string; /** - * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * Impacted resource region name. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly type?: string; + readonly targetRegion?: string; + /** Additional information. */ + info?: KeyValueItem[]; } -/** The list of emerging issues. */ -export interface EmergingIssueListResult { - /** The list of emerging issues. */ - value?: EmergingIssuesGetResult[]; - /** The link used to get the next page of emerging issues. */ - nextLink?: string; +/** Service health event */ +export interface Event extends ProxyResource { + /** Type of event. */ + eventType?: EventTypeValues; + /** Source of event. */ + eventSource?: EventSourceValues; + /** Current status of event. */ + status?: EventStatusValues; + /** Title text of event. */ + title?: string; + /** Summary text of event. */ + summary?: string; + /** Header text of event. */ + header?: string; + /** Level of insight. */ + level?: LevelValues; + /** Level of event. */ + eventLevel?: EventLevelValues; + /** The id of the Incident */ + externalIncidentId?: string; + /** The reason for the Incident */ + reason?: string; + /** Article of event. */ + article?: EventPropertiesArticle; + /** Useful links of event. */ + links?: Link[]; + /** It provides the Timestamp for when the health impacting event started. */ + impactStartTime?: Date; + /** It provides the Timestamp for when the health impacting event resolved. */ + impactMitigationTime?: Date; + /** List services impacted by the service health event. */ + impact?: Impact[]; + /** Recommended actions of event. */ + recommendedActions?: EventPropertiesRecommendedActions; + /** Frequently asked questions for the service health event. */ + faqs?: Faq[]; + /** It provides information if the event is High incident rate event or not. */ + isHIR?: boolean; + /** Tells if we want to enable or disable Microsoft Support for this event. */ + enableMicrosoftSupport?: boolean; + /** Contains the communication message for the event, that could include summary, root cause and other details. */ + description?: string; + /** Is true if the event is platform initiated. */ + platformInitiated?: boolean; + /** Tells if we want to enable or disable Microsoft Support for this event. */ + enableChatWithUs?: boolean; + /** Priority level of the event. Has value from 0 to 23. 0 is the highest priority. Service issue events have higher priority followed by planned maintenance and health advisory. Critical events have higher priority followed by error, warning and informational. Furthermore, active events have higher priority than resolved. */ + priority?: number; + /** It provides the Timestamp for when the health impacting event was last updated. */ + lastUpdateTime?: Date; + /** Stage for HIR Document */ + hirStage?: string; + /** Additional information */ + additionalInformation?: EventPropertiesAdditionalInformation; + /** duration in seconds */ + duration?: number; + /** The type of the impact */ + impactType?: string; } /** The Get EmergingIssues operation response. */ -export interface EmergingIssuesGetResult extends Resource { +export interface EmergingIssuesGetResult extends ProxyResource { /** Timestamp for when last time refreshed for ongoing emerging issue. */ refreshTimestamp?: Date; /** The list of emerging issues of banner type. */ @@ -254,6 +527,227 @@ export interface EmergingIssuesGetResult extends Resource { statusActiveEvents?: StatusActiveEvent[]; } +/** impactedResource with health status */ +export interface ImpactedResourceStatus extends ProxyResource { + /** Impacted resource status of the resource. */ + availabilityState?: AvailabilityStateValues; + /** Title description of the impacted resource status. */ + title?: string; + /** Summary description of the impacted resource status. */ + summary?: string; + /** When the resource's availabilityState is Unavailable, it describes where the health impacting event was originated. */ + reasonType?: ReasonTypeValues; + /** Timestamp for when last change in health status occurred. */ + occurredTime?: Date; +} + +/** Known values of {@link AvailabilityStateValues} that the service accepts. */ +export enum KnownAvailabilityStateValues { + /** Available */ + Available = "Available", + /** Unavailable */ + Unavailable = "Unavailable", + /** Degraded */ + Degraded = "Degraded", + /** Unknown */ + Unknown = "Unknown" +} + +/** + * Defines values for AvailabilityStateValues. \ + * {@link KnownAvailabilityStateValues} can be used interchangeably with AvailabilityStateValues, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Available** \ + * **Unavailable** \ + * **Degraded** \ + * **Unknown** + */ +export type AvailabilityStateValues = string; + +/** Known values of {@link ReasonChronicityTypes} that the service accepts. */ +export enum KnownReasonChronicityTypes { + /** Transient */ + Transient = "Transient", + /** Persistent */ + Persistent = "Persistent" +} + +/** + * Defines values for ReasonChronicityTypes. \ + * {@link KnownReasonChronicityTypes} can be used interchangeably with ReasonChronicityTypes, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Transient** \ + * **Persistent** + */ +export type ReasonChronicityTypes = string; + +/** Known values of {@link Scenario} that the service accepts. */ +export enum KnownScenario { + /** Alerts */ + Alerts = "Alerts" +} + +/** + * Defines values for Scenario. \ + * {@link KnownScenario} can be used interchangeably with Scenario, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Alerts** + */ +export type Scenario = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link EventTypeValues} that the service accepts. */ +export enum KnownEventTypeValues { + /** ServiceIssue */ + ServiceIssue = "ServiceIssue", + /** PlannedMaintenance */ + PlannedMaintenance = "PlannedMaintenance", + /** HealthAdvisory */ + HealthAdvisory = "HealthAdvisory", + /** RCA */ + RCA = "RCA", + /** EmergingIssues */ + EmergingIssues = "EmergingIssues", + /** SecurityAdvisory */ + SecurityAdvisory = "SecurityAdvisory" +} + +/** + * Defines values for EventTypeValues. \ + * {@link KnownEventTypeValues} can be used interchangeably with EventTypeValues, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ServiceIssue** \ + * **PlannedMaintenance** \ + * **HealthAdvisory** \ + * **RCA** \ + * **EmergingIssues** \ + * **SecurityAdvisory** + */ +export type EventTypeValues = string; + +/** Known values of {@link EventSourceValues} that the service accepts. */ +export enum KnownEventSourceValues { + /** ResourceHealth */ + ResourceHealth = "ResourceHealth", + /** ServiceHealth */ + ServiceHealth = "ServiceHealth" +} + +/** + * Defines values for EventSourceValues. \ + * {@link KnownEventSourceValues} can be used interchangeably with EventSourceValues, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ResourceHealth** \ + * **ServiceHealth** + */ +export type EventSourceValues = string; + +/** Known values of {@link EventStatusValues} that the service accepts. */ +export enum KnownEventStatusValues { + /** Active */ + Active = "Active", + /** Resolved */ + Resolved = "Resolved" +} + +/** + * Defines values for EventStatusValues. \ + * {@link KnownEventStatusValues} can be used interchangeably with EventStatusValues, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active** \ + * **Resolved** + */ +export type EventStatusValues = string; + +/** Known values of {@link LevelValues} that the service accepts. */ +export enum KnownLevelValues { + /** Critical */ + Critical = "Critical", + /** Warning */ + Warning = "Warning" +} + +/** + * Defines values for LevelValues. \ + * {@link KnownLevelValues} can be used interchangeably with LevelValues, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Critical** \ + * **Warning** + */ +export type LevelValues = string; + +/** Known values of {@link EventLevelValues} that the service accepts. */ +export enum KnownEventLevelValues { + /** Critical */ + Critical = "Critical", + /** Error */ + Error = "Error", + /** Warning */ + Warning = "Warning", + /** Informational */ + Informational = "Informational" +} + +/** + * Defines values for EventLevelValues. \ + * {@link KnownEventLevelValues} can be used interchangeably with EventLevelValues, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Critical** \ + * **Error** \ + * **Warning** \ + * **Informational** + */ +export type EventLevelValues = string; + +/** Known values of {@link LinkTypeValues} that the service accepts. */ +export enum KnownLinkTypeValues { + /** Button */ + Button = "Button", + /** Hyperlink */ + Hyperlink = "Hyperlink" +} + +/** + * Defines values for LinkTypeValues. \ + * {@link KnownLinkTypeValues} can be used interchangeably with LinkTypeValues, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Button** \ + * **Hyperlink** + */ +export type LinkTypeValues = string; + /** Known values of {@link SeverityValues} that the service accepts. */ export enum KnownSeverityValues { /** Information */ @@ -295,10 +789,42 @@ export enum KnownStageValues { * **Archived** */ export type StageValues = string; -/** Defines values for AvailabilityStateValues. */ -export type AvailabilityStateValues = "Available" | "Unavailable" | "Unknown"; -/** Defines values for ReasonChronicityTypes. */ -export type ReasonChronicityTypes = "Transient" | "Persistent"; + +/** Known values of {@link IssueNameParameter} that the service accepts. */ +export enum KnownIssueNameParameter { + /** Default */ + Default = "default" +} + +/** + * Defines values for IssueNameParameter. \ + * {@link KnownIssueNameParameter} can be used interchangeably with IssueNameParameter, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **default** + */ +export type IssueNameParameter = string; + +/** Known values of {@link ReasonTypeValues} that the service accepts. */ +export enum KnownReasonTypeValues { + /** Unplanned */ + Unplanned = "Unplanned", + /** Planned */ + Planned = "Planned", + /** UserInitiated */ + UserInitiated = "UserInitiated" +} + +/** + * Defines values for ReasonTypeValues. \ + * {@link KnownReasonTypeValues} can be used interchangeably with ReasonTypeValues, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unplanned** \ + * **Planned** \ + * **UserInitiated** + */ +export type ReasonTypeValues = string; /** Optional parameters. */ export interface AvailabilityStatusesListBySubscriptionIdOptionalParams @@ -369,6 +895,209 @@ export interface AvailabilityStatusesListNextOptionalParams /** Contains response data for the listNext operation. */ export type AvailabilityStatusesListNextResponse = AvailabilityStatusListResult; +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface MetadataListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type MetadataListResponse = MetadataEntityListResult; + +/** Optional parameters. */ +export interface MetadataGetEntityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getEntity operation. */ +export type MetadataGetEntityResponse = MetadataEntity; + +/** Optional parameters. */ +export interface MetadataListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type MetadataListNextResponse = MetadataEntityListResult; + +/** Optional parameters. */ +export interface ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */ + filter?: string; +} + +/** Contains response data for the listBySubscriptionIdAndEventId operation. */ +export type ImpactedResourcesListBySubscriptionIdAndEventIdResponse = EventImpactedResourceListResult; + +/** Optional parameters. */ +export interface ImpactedResourcesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ImpactedResourcesGetResponse = EventImpactedResource; + +/** Optional parameters. */ +export interface ImpactedResourcesListByTenantIdAndEventIdOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */ + filter?: string; +} + +/** Contains response data for the listByTenantIdAndEventId operation. */ +export type ImpactedResourcesListByTenantIdAndEventIdResponse = EventImpactedResourceListResult; + +/** Optional parameters. */ +export interface ImpactedResourcesGetByTenantIdOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getByTenantId operation. */ +export type ImpactedResourcesGetByTenantIdResponse = EventImpactedResource; + +/** Optional parameters. */ +export interface ImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionIdAndEventIdNext operation. */ +export type ImpactedResourcesListBySubscriptionIdAndEventIdNextResponse = EventImpactedResourceListResult; + +/** Optional parameters. */ +export interface ImpactedResourcesListByTenantIdAndEventIdNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByTenantIdAndEventIdNext operation. */ +export type ImpactedResourcesListByTenantIdAndEventIdNextResponse = EventImpactedResourceListResult; + +/** Optional parameters. */ +export interface SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */ + filter?: string; +} + +/** Contains response data for the listBySubscriptionIdAndEventId operation. */ +export type SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdResponse = EventImpactedResourceListResult; + +/** Optional parameters. */ +export interface SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */ + filter?: string; +} + +/** Contains response data for the listByTenantIdAndEventId operation. */ +export type SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdResponse = EventImpactedResourceListResult; + +/** Optional parameters. */ +export interface SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionIdAndEventIdNext operation. */ +export type SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextResponse = EventImpactedResourceListResult; + +/** Optional parameters. */ +export interface SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByTenantIdAndEventIdNext operation. */ +export type SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextResponse = EventImpactedResourceListResult; + +/** Optional parameters. */ +export interface EventsListBySubscriptionIdOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */ + filter?: string; + /** Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020 */ + queryStartTime?: string; +} + +/** Contains response data for the listBySubscriptionId operation. */ +export type EventsListBySubscriptionIdResponse = Events; + +/** Optional parameters. */ +export interface EventsListByTenantIdOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */ + filter?: string; + /** Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020 */ + queryStartTime?: string; +} + +/** Contains response data for the listByTenantId operation. */ +export type EventsListByTenantIdResponse = Events; + +/** Optional parameters. */ +export interface EventsListBySingleResourceOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */ + filter?: string; +} + +/** Contains response data for the listBySingleResource operation. */ +export type EventsListBySingleResourceResponse = Events; + +/** Optional parameters. */ +export interface EventsListBySubscriptionIdNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionIdNext operation. */ +export type EventsListBySubscriptionIdNextResponse = Events; + +/** Optional parameters. */ +export interface EventsListByTenantIdNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByTenantIdNext operation. */ +export type EventsListByTenantIdNextResponse = Events; + +/** Optional parameters. */ +export interface EventsListBySingleResourceNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySingleResourceNext operation. */ +export type EventsListBySingleResourceNextResponse = Events; + +/** Optional parameters. */ +export interface EventGetBySubscriptionIdAndTrackingIdOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */ + filter?: string; + /** Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020 */ + queryStartTime?: string; +} + +/** Contains response data for the getBySubscriptionIdAndTrackingId operation. */ +export type EventGetBySubscriptionIdAndTrackingIdResponse = Event; + +/** Optional parameters. */ +export interface EventFetchDetailsBySubscriptionIdAndTrackingIdOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the fetchDetailsBySubscriptionIdAndTrackingId operation. */ +export type EventFetchDetailsBySubscriptionIdAndTrackingIdResponse = Event; + +/** Optional parameters. */ +export interface EventGetByTenantIdAndTrackingIdOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */ + filter?: string; + /** Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020 */ + queryStartTime?: string; +} + +/** Contains response data for the getByTenantIdAndTrackingId operation. */ +export type EventGetByTenantIdAndTrackingIdResponse = Event; + +/** Optional parameters. */ +export interface EventFetchDetailsByTenantIdAndTrackingIdOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the fetchDetailsByTenantIdAndTrackingId operation. */ +export type EventFetchDetailsByTenantIdAndTrackingIdResponse = Event; + /** Optional parameters. */ export interface ChildAvailabilityStatusesGetByResourceOptionalParams extends coreClient.OperationOptions { @@ -420,11 +1149,11 @@ export interface ChildResourcesListNextOptionalParams export type ChildResourcesListNextResponse = AvailabilityStatusListResult; /** Optional parameters. */ -export interface OperationsListOptionalParams +export interface EmergingIssuesListOptionalParams extends coreClient.OperationOptions {} /** Contains response data for the list operation. */ -export type OperationsListResponse = OperationListResult; +export type EmergingIssuesListResponse = EmergingIssueListResult; /** Optional parameters. */ export interface EmergingIssuesGetOptionalParams @@ -433,13 +1162,6 @@ export interface EmergingIssuesGetOptionalParams /** Contains response data for the get operation. */ export type EmergingIssuesGetResponse = EmergingIssuesGetResult; -/** Optional parameters. */ -export interface EmergingIssuesListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type EmergingIssuesListResponse = EmergingIssueListResult; - /** Optional parameters. */ export interface EmergingIssuesListNextOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/resourcehealth/arm-resourcehealth/src/models/mappers.ts b/sdk/resourcehealth/arm-resourcehealth/src/models/mappers.ts index 6ae4eaf92675..6ee8e9eb11d0 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/models/mappers.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/models/mappers.ts @@ -84,8 +84,13 @@ export const AvailabilityStatusProperties: coreClient.CompositeMapper = { availabilityState: { serializedName: "availabilityState", type: { - name: "Enum", - allowedValues: ["Available", "Unavailable", "Unknown"] + name: "String" + } + }, + title: { + serializedName: "title", + type: { + name: "String" } }, summary: { @@ -106,6 +111,24 @@ export const AvailabilityStatusProperties: coreClient.CompositeMapper = { name: "String" } }, + context: { + serializedName: "context", + type: { + name: "String" + } + }, + category: { + serializedName: "category", + type: { + name: "String" + } + }, + articleId: { + serializedName: "articleId", + type: { + name: "String" + } + }, rootCauseAttributionTime: { serializedName: "rootCauseAttributionTime", type: { @@ -151,8 +174,7 @@ export const AvailabilityStatusProperties: coreClient.CompositeMapper = { reasonChronicity: { serializedName: "reasonChronicity", type: { - name: "Enum", - allowedValues: ["Transient", "Persistent"] + name: "String" } }, reportedTime: { @@ -161,11 +183,11 @@ export const AvailabilityStatusProperties: coreClient.CompositeMapper = { name: "DateTime" } }, - recentlyResolvedState: { - serializedName: "recentlyResolvedState", + recentlyResolved: { + serializedName: "recentlyResolved", type: { name: "Composite", - className: "AvailabilityStatusPropertiesRecentlyResolvedState" + className: "AvailabilityStatusPropertiesRecentlyResolved" } }, recommendedActions: { @@ -196,13 +218,13 @@ export const AvailabilityStatusProperties: coreClient.CompositeMapper = { } }; -export const AvailabilityStatusPropertiesRecentlyResolvedState: coreClient.CompositeMapper = { +export const AvailabilityStatusPropertiesRecentlyResolved: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AvailabilityStatusPropertiesRecentlyResolvedState", + className: "AvailabilityStatusPropertiesRecentlyResolved", modelProperties: { - unavailableOccurredTime: { - serializedName: "unavailableOccurredTime", + unavailableOccuredTime: { + serializedName: "unavailableOccuredTime", type: { name: "DateTime" } @@ -213,8 +235,8 @@ export const AvailabilityStatusPropertiesRecentlyResolvedState: coreClient.Compo name: "DateTime" } }, - unavailabilitySummary: { - serializedName: "unavailabilitySummary", + unavailableSummary: { + serializedName: "unavailableSummary", type: { name: "String" } @@ -240,6 +262,12 @@ export const RecommendedAction: coreClient.CompositeMapper = { name: "String" } }, + actionUrlComment: { + serializedName: "_ActionUrl\\.Comment", + type: { + name: "String" + } + }, actionUrlText: { serializedName: "actionUrlText", type: { @@ -446,257 +474,396 @@ export const OperationDisplay: coreClient.CompositeMapper = { } }; -export const StatusBanner: coreClient.CompositeMapper = { +export const MetadataEntityListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "StatusBanner", + className: "MetadataEntityListResult", modelProperties: { - title: { - serializedName: "title", + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataEntity" + } + } } }, - message: { - serializedName: "message", + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const MetadataSupportedValueDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetadataSupportedValueDetail", + modelProperties: { + id: { + serializedName: "id", type: { name: "String" } }, - cloud: { - serializedName: "cloud", + displayName: { + serializedName: "displayName", type: { name: "String" } }, - lastModifiedTime: { - serializedName: "lastModifiedTime", + resourceTypes: { + serializedName: "resourceTypes", type: { - name: "DateTime" + name: "Sequence", + element: { + type: { + name: "String" + } + } } } } } }; -export const StatusActiveEvent: coreClient.CompositeMapper = { +export const Resource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "StatusActiveEvent", + className: "Resource", modelProperties: { - title: { - serializedName: "title", + id: { + serializedName: "id", + readOnly: true, type: { name: "String" } }, - description: { - serializedName: "description", + name: { + serializedName: "name", + readOnly: true, type: { name: "String" } }, - trackingId: { - serializedName: "trackingId", + type: { + serializedName: "type", + readOnly: true, type: { name: "String" } }, - startTime: { - serializedName: "startTime", + systemData: { + serializedName: "systemData", type: { - name: "DateTime" + name: "Composite", + className: "SystemData" } - }, - cloud: { - serializedName: "cloud", + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", type: { name: "String" } }, - severity: { - serializedName: "severity", + createdByType: { + serializedName: "createdByType", type: { name: "String" } }, - stage: { - serializedName: "stage", + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", type: { name: "String" } }, - published: { - serializedName: "published", + lastModifiedByType: { + serializedName: "lastModifiedByType", type: { - name: "Boolean" + name: "String" } }, - lastModifiedTime: { - serializedName: "lastModifiedTime", + lastModifiedAt: { + serializedName: "lastModifiedAt", type: { name: "DateTime" } - }, - impacts: { - serializedName: "impacts", + } + } + } +}; + +export const EventImpactedResourceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EventImpactedResourceListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, type: { name: "Sequence", element: { type: { name: "Composite", - className: "EmergingIssueImpact" + className: "EventImpactedResource" } } } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } } } } }; -export const EmergingIssueImpact: coreClient.CompositeMapper = { +export const KeyValueItem: coreClient.CompositeMapper = { type: { name: "Composite", - className: "EmergingIssueImpact", + className: "KeyValueItem", modelProperties: { - id: { - serializedName: "id", + key: { + serializedName: "key", + readOnly: true, type: { name: "String" } }, - name: { - serializedName: "name", + value: { + serializedName: "value", + readOnly: true, type: { name: "String" } - }, - regions: { - serializedName: "regions", + } + } + } +}; + +export const Events: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Events", + modelProperties: { + value: { + serializedName: "value", + required: true, type: { name: "Sequence", element: { type: { name: "Composite", - className: "ImpactedRegion" + className: "Event" } } } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } } } } }; -export const ImpactedRegion: coreClient.CompositeMapper = { +export const EventPropertiesArticle: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ImpactedRegion", + className: "EventPropertiesArticle", modelProperties: { - id: { - serializedName: "id", + articleContent: { + serializedName: "articleContent", type: { name: "String" } }, - name: { - serializedName: "name", + articleId: { + serializedName: "articleId", type: { name: "String" } + }, + parameters: { + serializedName: "parameters", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } } } } }; -export const Resource: coreClient.CompositeMapper = { +export const Link: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Resource", + className: "Link", modelProperties: { - id: { - serializedName: "id", - readOnly: true, + type: { + serializedName: "type", type: { name: "String" } }, - name: { - serializedName: "name", - readOnly: true, + displayText: { + serializedName: "displayText", + type: { + name: "Composite", + className: "LinkDisplayText" + } + }, + extensionName: { + serializedName: "extensionName", type: { name: "String" } }, - type: { - serializedName: "type", - readOnly: true, + bladeName: { + serializedName: "bladeName", type: { name: "String" } + }, + parameters: { + serializedName: "parameters", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } } } } }; -export const EmergingIssueListResult: coreClient.CompositeMapper = { +export const LinkDisplayText: coreClient.CompositeMapper = { type: { name: "Composite", - className: "EmergingIssueListResult", + className: "LinkDisplayText", modelProperties: { value: { serializedName: "value", + type: { + name: "String" + } + }, + localizedValue: { + serializedName: "localizedValue", + type: { + name: "String" + } + } + } + } +}; + +export const Impact: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Impact", + modelProperties: { + impactedService: { + serializedName: "impactedService", + type: { + name: "String" + } + }, + impactedRegions: { + serializedName: "impactedRegions", type: { name: "Sequence", element: { type: { name: "Composite", - className: "EmergingIssuesGetResult" + className: "ImpactedServiceRegion" } } } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } } } } }; -export const EmergingIssuesGetResult: coreClient.CompositeMapper = { +export const ImpactedServiceRegion: coreClient.CompositeMapper = { type: { name: "Composite", - className: "EmergingIssuesGetResult", + className: "ImpactedServiceRegion", modelProperties: { - ...Resource.type.modelProperties, - refreshTimestamp: { - serializedName: "properties.refreshTimestamp", + impactedRegion: { + serializedName: "impactedRegion", type: { - name: "DateTime" + name: "String" } }, - statusBanners: { - serializedName: "properties.statusBanners", + status: { + serializedName: "status", + type: { + name: "String" + } + }, + impactedSubscriptions: { + serializedName: "impactedSubscriptions", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "StatusBanner" + name: "String" } } } }, - statusActiveEvents: { - serializedName: "properties.statusActiveEvents", + impactedTenants: { + serializedName: "impactedTenants", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + lastUpdateTime: { + serializedName: "lastUpdateTime", + type: { + name: "DateTime" + } + }, + updates: { + serializedName: "updates", type: { name: "Sequence", element: { type: { name: "Composite", - className: "StatusActiveEvent" + className: "Update" } } } @@ -704,3 +871,691 @@ export const EmergingIssuesGetResult: coreClient.CompositeMapper = { } } }; + +export const Update: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Update", + modelProperties: { + summary: { + serializedName: "summary", + type: { + name: "String" + } + }, + updateDateTime: { + serializedName: "updateDateTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const EventPropertiesRecommendedActions: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EventPropertiesRecommendedActions", + modelProperties: { + message: { + serializedName: "message", + type: { + name: "String" + } + }, + actions: { + serializedName: "actions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EventPropertiesRecommendedActionsItem" + } + } + } + }, + localeCode: { + serializedName: "localeCode", + type: { + name: "String" + } + } + } + } +}; + +export const EventPropertiesRecommendedActionsItem: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EventPropertiesRecommendedActionsItem", + modelProperties: { + groupId: { + serializedName: "groupId", + type: { + name: "Number" + } + }, + actionText: { + serializedName: "actionText", + type: { + name: "String" + } + } + } + } +}; + +export const Faq: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Faq", + modelProperties: { + question: { + serializedName: "question", + type: { + name: "String" + } + }, + answer: { + serializedName: "answer", + type: { + name: "String" + } + }, + localeCode: { + serializedName: "localeCode", + type: { + name: "String" + } + } + } + } +}; + +export const EventPropertiesAdditionalInformation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EventPropertiesAdditionalInformation", + modelProperties: { + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const EmergingIssueListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EmergingIssueListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EmergingIssuesGetResult" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const StatusBanner: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StatusBanner", + modelProperties: { + title: { + serializedName: "title", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + cloud: { + serializedName: "cloud", + type: { + name: "String" + } + }, + lastModifiedTime: { + serializedName: "lastModifiedTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const StatusActiveEvent: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StatusActiveEvent", + modelProperties: { + title: { + serializedName: "title", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + trackingId: { + serializedName: "trackingId", + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "DateTime" + } + }, + cloud: { + serializedName: "cloud", + type: { + name: "String" + } + }, + severity: { + serializedName: "severity", + type: { + name: "String" + } + }, + stage: { + serializedName: "stage", + type: { + name: "String" + } + }, + published: { + serializedName: "published", + type: { + name: "Boolean" + } + }, + lastModifiedTime: { + serializedName: "lastModifiedTime", + type: { + name: "DateTime" + } + }, + impacts: { + serializedName: "impacts", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EmergingIssueImpact" + } + } + } + } + } + } +}; + +export const EmergingIssueImpact: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EmergingIssueImpact", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + regions: { + serializedName: "regions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ImpactedRegion" + } + } + } + } + } + } +}; + +export const ImpactedRegion: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImpactedRegion", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const MetadataEntity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetadataEntity", + modelProperties: { + ...ProxyResource.type.modelProperties, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + dependsOn: { + serializedName: "properties.dependsOn", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + applicableScenarios: { + serializedName: "properties.applicableScenarios", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + supportedValues: { + serializedName: "properties.supportedValues", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataSupportedValueDetail" + } + } + } + } + } + } +}; + +export const EventImpactedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EventImpactedResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + targetResourceType: { + serializedName: "properties.targetResourceType", + readOnly: true, + type: { + name: "String" + } + }, + targetResourceId: { + serializedName: "properties.targetResourceId", + readOnly: true, + type: { + name: "String" + } + }, + targetRegion: { + serializedName: "properties.targetRegion", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "properties.info", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "KeyValueItem" + } + } + } + } + } + } +}; + +export const Event: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Event", + modelProperties: { + ...ProxyResource.type.modelProperties, + eventType: { + serializedName: "properties.eventType", + type: { + name: "String" + } + }, + eventSource: { + serializedName: "properties.eventSource", + type: { + name: "String" + } + }, + status: { + serializedName: "properties.status", + type: { + name: "String" + } + }, + title: { + serializedName: "properties.title", + type: { + name: "String" + } + }, + summary: { + serializedName: "properties.summary", + type: { + name: "String" + } + }, + header: { + serializedName: "properties.header", + type: { + name: "String" + } + }, + level: { + serializedName: "properties.level", + type: { + name: "String" + } + }, + eventLevel: { + serializedName: "properties.eventLevel", + type: { + name: "String" + } + }, + externalIncidentId: { + serializedName: "properties.externalIncidentId", + type: { + name: "String" + } + }, + reason: { + serializedName: "properties.reason", + type: { + name: "String" + } + }, + article: { + serializedName: "properties.article", + type: { + name: "Composite", + className: "EventPropertiesArticle" + } + }, + links: { + serializedName: "properties.links", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Link" + } + } + } + }, + impactStartTime: { + serializedName: "properties.impactStartTime", + type: { + name: "DateTime" + } + }, + impactMitigationTime: { + serializedName: "properties.impactMitigationTime", + type: { + name: "DateTime" + } + }, + impact: { + serializedName: "properties.impact", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Impact" + } + } + } + }, + recommendedActions: { + serializedName: "properties.recommendedActions", + type: { + name: "Composite", + className: "EventPropertiesRecommendedActions" + } + }, + faqs: { + serializedName: "properties.faqs", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Faq" + } + } + } + }, + isHIR: { + serializedName: "properties.isHIR", + type: { + name: "Boolean" + } + }, + enableMicrosoftSupport: { + serializedName: "properties.enableMicrosoftSupport", + type: { + name: "Boolean" + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + platformInitiated: { + serializedName: "properties.platformInitiated", + type: { + name: "Boolean" + } + }, + enableChatWithUs: { + serializedName: "properties.enableChatWithUs", + type: { + name: "Boolean" + } + }, + priority: { + serializedName: "properties.priority", + type: { + name: "Number" + } + }, + lastUpdateTime: { + serializedName: "properties.lastUpdateTime", + type: { + name: "DateTime" + } + }, + hirStage: { + serializedName: "properties.hirStage", + type: { + name: "String" + } + }, + additionalInformation: { + serializedName: "properties.additionalInformation", + type: { + name: "Composite", + className: "EventPropertiesAdditionalInformation" + } + }, + duration: { + serializedName: "properties.duration", + type: { + name: "Number" + } + }, + impactType: { + serializedName: "properties.impactType", + type: { + name: "String" + } + } + } + } +}; + +export const EmergingIssuesGetResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EmergingIssuesGetResult", + modelProperties: { + ...ProxyResource.type.modelProperties, + refreshTimestamp: { + serializedName: "properties.refreshTimestamp", + type: { + name: "DateTime" + } + }, + statusBanners: { + serializedName: "properties.statusBanners", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StatusBanner" + } + } + } + }, + statusActiveEvents: { + serializedName: "properties.statusActiveEvents", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StatusActiveEvent" + } + } + } + } + } + } +}; + +export const ImpactedResourceStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImpactedResourceStatus", + modelProperties: { + ...ProxyResource.type.modelProperties, + availabilityState: { + serializedName: "properties.availabilityState", + type: { + name: "String" + } + }, + title: { + serializedName: "properties.title", + type: { + name: "String" + } + }, + summary: { + serializedName: "properties.summary", + type: { + name: "String" + } + }, + reasonType: { + serializedName: "properties.reasonType", + type: { + name: "String" + } + }, + occurredTime: { + serializedName: "properties.occurredTime", + type: { + name: "DateTime" + } + } + } + } +}; diff --git a/sdk/resourcehealth/arm-resourcehealth/src/models/parameters.ts b/sdk/resourcehealth/arm-resourcehealth/src/models/parameters.ts index 6dc6222dc643..d9cf79fdfa88 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/models/parameters.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/models/parameters.ts @@ -39,7 +39,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2017-07-01", + defaultValue: "2022-10-01", isConstant: true, serializedName: "api-version", type: { @@ -61,6 +61,9 @@ export const filter: OperationQueryParameter = { export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { + constraints: { + MinLength: 1 + }, serializedName: "subscriptionId", required: true, type: { @@ -82,6 +85,10 @@ export const expand: OperationQueryParameter = { export const resourceGroupName: OperationURLParameter = { parameterPath: "resourceGroupName", mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, serializedName: "resourceGroupName", required: true, type: { @@ -114,12 +121,57 @@ export const nextLink: OperationURLParameter = { skipEncoding: true }; +export const name: OperationURLParameter = { + parameterPath: "name", + mapper: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } +}; + +export const eventTrackingId: OperationURLParameter = { + parameterPath: "eventTrackingId", + mapper: { + serializedName: "eventTrackingId", + required: true, + type: { + name: "String" + } + } +}; + +export const impactedResourceName: OperationURLParameter = { + parameterPath: "impactedResourceName", + mapper: { + constraints: { + Pattern: new RegExp("^[^*#&+:<>%?]+$") + }, + serializedName: "impactedResourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const queryStartTime: OperationQueryParameter = { + parameterPath: ["options", "queryStartTime"], + mapper: { + serializedName: "queryStartTime", + type: { + name: "String" + } + } +}; + export const issueName: OperationURLParameter = { parameterPath: "issueName", mapper: { - defaultValue: "default", - isConstant: true, serializedName: "issueName", + required: true, type: { name: "String" } diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operations/availabilityStatuses.ts b/sdk/resourcehealth/arm-resourcehealth/src/operations/availabilityStatuses.ts index 16652b988b87..07ef720b0a72 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/operations/availabilityStatuses.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/operations/availabilityStatuses.ts @@ -45,8 +45,7 @@ export class AvailabilityStatusesImpl implements AvailabilityStatuses { } /** - * Lists the current availability status for all the resources in the subscription. Use the nextLink - * property in the response to get the next page of availability statuses. + * Lists the current availability status for all the resources in the subscription. * @param options The options parameters. */ public listBySubscriptionId( @@ -100,9 +99,8 @@ export class AvailabilityStatusesImpl implements AvailabilityStatuses { } /** - * Lists the current availability status for all the resources in the resource group. Use the nextLink - * property in the response to get the next page of availability statuses. - * @param resourceGroupName The name of the resource group. + * Lists the current availability status for all the resources in the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ public listByResourceGroup( @@ -170,8 +168,7 @@ export class AvailabilityStatusesImpl implements AvailabilityStatuses { } /** - * Lists all historical availability transitions and impacting events for a single resource. Use the - * nextLink property in the response to get the next page of availability status + * Lists all historical availability transitions and impacting events for a single resource. * @param resourceUri The fully qualified ID of the resource, including the resource name and resource * type. Currently the API support not nested and one nesting level resource types : * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} @@ -233,8 +230,7 @@ export class AvailabilityStatusesImpl implements AvailabilityStatuses { } /** - * Lists the current availability status for all the resources in the subscription. Use the nextLink - * property in the response to get the next page of availability statuses. + * Lists the current availability status for all the resources in the subscription. * @param options The options parameters. */ private _listBySubscriptionId( @@ -247,9 +243,8 @@ export class AvailabilityStatusesImpl implements AvailabilityStatuses { } /** - * Lists the current availability status for all the resources in the resource group. Use the nextLink - * property in the response to get the next page of availability statuses. - * @param resourceGroupName The name of the resource group. + * Lists the current availability status for all the resources in the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ private _listByResourceGroup( @@ -282,8 +277,7 @@ export class AvailabilityStatusesImpl implements AvailabilityStatuses { } /** - * Lists all historical availability transitions and impacting events for a single resource. Use the - * nextLink property in the response to get the next page of availability status + * Lists all historical availability transitions and impacting events for a single resource. * @param resourceUri The fully qualified ID of the resource, including the resource name and resource * type. Currently the API support not nested and one nesting level resource types : * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} @@ -318,7 +312,7 @@ export class AvailabilityStatusesImpl implements AvailabilityStatuses { /** * ListByResourceGroupNext - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. * @param options The options parameters. */ diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operations/emergingIssues.ts b/sdk/resourcehealth/arm-resourcehealth/src/operations/emergingIssues.ts index 0b4ea36ab1c6..2351cbc26e41 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/operations/emergingIssues.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/operations/emergingIssues.ts @@ -18,6 +18,7 @@ import { EmergingIssuesListNextOptionalParams, EmergingIssuesListOptionalParams, EmergingIssuesListResponse, + IssueNameParameter, EmergingIssuesGetOptionalParams, EmergingIssuesGetResponse, EmergingIssuesListNextResponse @@ -90,16 +91,6 @@ export class EmergingIssuesImpl implements EmergingIssues { } } - /** - * Gets Azure services' emerging issues. - * @param options The options parameters. - */ - get( - options?: EmergingIssuesGetOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, getOperationSpec); - } - /** * Lists Azure services' emerging issues. * @param options The options parameters. @@ -110,6 +101,21 @@ export class EmergingIssuesImpl implements EmergingIssues { return this.client.sendOperationRequest({ options }, listOperationSpec); } + /** + * Gets Azure services' emerging issues. + * @param issueName The name of the emerging issue. + * @param options The options parameters. + */ + get( + issueName: IssueNameParameter, + options?: EmergingIssuesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { issueName, options }, + getOperationSpec + ); + } + /** * ListNext * @param nextLink The nextLink from the previous successful call to the List method. @@ -128,35 +134,35 @@ export class EmergingIssuesImpl implements EmergingIssues { // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const getOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}", +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceHealth/emergingIssues", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.EmergingIssuesGetResult + bodyMapper: Mappers.EmergingIssueListResult }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.issueName], + urlParameters: [Parameters.$host], headerParameters: [Parameters.accept], serializer }; -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.ResourceHealth/emergingIssues", +const getOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.EmergingIssueListResult + bodyMapper: Mappers.EmergingIssuesGetResult }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], + urlParameters: [Parameters.$host, Parameters.issueName], headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operations/eventOperations.ts b/sdk/resourcehealth/arm-resourcehealth/src/operations/eventOperations.ts new file mode 100644 index 000000000000..0b7c8c7dabfb --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operations/eventOperations.ts @@ -0,0 +1,184 @@ +/* + * 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 { EventOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftResourceHealth } from "../microsoftResourceHealth"; +import { + EventGetBySubscriptionIdAndTrackingIdOptionalParams, + EventGetBySubscriptionIdAndTrackingIdResponse, + EventFetchDetailsBySubscriptionIdAndTrackingIdOptionalParams, + EventFetchDetailsBySubscriptionIdAndTrackingIdResponse, + EventGetByTenantIdAndTrackingIdOptionalParams, + EventGetByTenantIdAndTrackingIdResponse, + EventFetchDetailsByTenantIdAndTrackingIdOptionalParams, + EventFetchDetailsByTenantIdAndTrackingIdResponse +} from "../models"; + +/** Class containing EventOperations operations. */ +export class EventOperationsImpl implements EventOperations { + private readonly client: MicrosoftResourceHealth; + + /** + * Initialize a new instance of the class EventOperations class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftResourceHealth) { + this.client = client; + } + + /** + * Service health event in the subscription by event tracking id + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + getBySubscriptionIdAndTrackingId( + eventTrackingId: string, + options?: EventGetBySubscriptionIdAndTrackingIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, options }, + getBySubscriptionIdAndTrackingIdOperationSpec + ); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch + * sensitive properties for Security Advisory events + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + fetchDetailsBySubscriptionIdAndTrackingId( + eventTrackingId: string, + options?: EventFetchDetailsBySubscriptionIdAndTrackingIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, options }, + fetchDetailsBySubscriptionIdAndTrackingIdOperationSpec + ); + } + + /** + * Service health event in the tenant by event tracking id + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + getByTenantIdAndTrackingId( + eventTrackingId: string, + options?: EventGetByTenantIdAndTrackingIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, options }, + getByTenantIdAndTrackingIdOperationSpec + ); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + fetchDetailsByTenantIdAndTrackingId( + eventTrackingId: string, + options?: EventFetchDetailsByTenantIdAndTrackingIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, options }, + fetchDetailsByTenantIdAndTrackingIdOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getBySubscriptionIdAndTrackingIdOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Event + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.queryStartTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.eventTrackingId + ], + headerParameters: [Parameters.accept], + serializer +}; +const fetchDetailsBySubscriptionIdAndTrackingIdOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.Event + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.eventTrackingId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getByTenantIdAndTrackingIdOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Event + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.queryStartTime + ], + urlParameters: [Parameters.$host, Parameters.eventTrackingId], + headerParameters: [Parameters.accept], + serializer +}; +const fetchDetailsByTenantIdAndTrackingIdOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.Event + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.eventTrackingId], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operations/eventsOperations.ts b/sdk/resourcehealth/arm-resourcehealth/src/operations/eventsOperations.ts new file mode 100644 index 000000000000..d35faaf456de --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operations/eventsOperations.ts @@ -0,0 +1,434 @@ +/* + * 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, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { EventsOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftResourceHealth } from "../microsoftResourceHealth"; +import { + Event, + EventsListBySubscriptionIdNextOptionalParams, + EventsListBySubscriptionIdOptionalParams, + EventsListBySubscriptionIdResponse, + EventsListByTenantIdNextOptionalParams, + EventsListByTenantIdOptionalParams, + EventsListByTenantIdResponse, + EventsListBySingleResourceNextOptionalParams, + EventsListBySingleResourceOptionalParams, + EventsListBySingleResourceResponse, + EventsListBySubscriptionIdNextResponse, + EventsListByTenantIdNextResponse, + EventsListBySingleResourceNextResponse +} from "../models"; + +/// +/** Class containing EventsOperations operations. */ +export class EventsOperationsImpl implements EventsOperations { + private readonly client: MicrosoftResourceHealth; + + /** + * Initialize a new instance of the class EventsOperations class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftResourceHealth) { + this.client = client; + } + + /** + * Lists service health events in the subscription. + * @param options The options parameters. + */ + public listBySubscriptionId( + options?: EventsListBySubscriptionIdOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionIdPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionIdPagingPage(options, settings); + } + }; + } + + private async *listBySubscriptionIdPagingPage( + options?: EventsListBySubscriptionIdOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: EventsListBySubscriptionIdResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscriptionId(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionIdNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionIdPagingAll( + options?: EventsListBySubscriptionIdOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionIdPagingPage(options)) { + yield* page; + } + } + + /** + * Lists current service health events in the tenant. + * @param options The options parameters. + */ + public listByTenantId( + options?: EventsListByTenantIdOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByTenantIdPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByTenantIdPagingPage(options, settings); + } + }; + } + + private async *listByTenantIdPagingPage( + options?: EventsListByTenantIdOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: EventsListByTenantIdResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByTenantId(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByTenantIdNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByTenantIdPagingAll( + options?: EventsListByTenantIdOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByTenantIdPagingPage(options)) { + yield* page; + } + } + + /** + * Lists current service health events for given resource. + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource + * type. Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName} + * @param options The options parameters. + */ + public listBySingleResource( + resourceUri: string, + options?: EventsListBySingleResourceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySingleResourcePagingAll(resourceUri, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySingleResourcePagingPage( + resourceUri, + options, + settings + ); + } + }; + } + + private async *listBySingleResourcePagingPage( + resourceUri: string, + options?: EventsListBySingleResourceOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: EventsListBySingleResourceResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySingleResource(resourceUri, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySingleResourceNext( + resourceUri, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySingleResourcePagingAll( + resourceUri: string, + options?: EventsListBySingleResourceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySingleResourcePagingPage( + resourceUri, + options + )) { + yield* page; + } + } + + /** + * Lists service health events in the subscription. + * @param options The options parameters. + */ + private _listBySubscriptionId( + options?: EventsListBySubscriptionIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionIdOperationSpec + ); + } + + /** + * Lists current service health events in the tenant. + * @param options The options parameters. + */ + private _listByTenantId( + options?: EventsListByTenantIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listByTenantIdOperationSpec + ); + } + + /** + * Lists current service health events for given resource. + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource + * type. Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName} + * @param options The options parameters. + */ + private _listBySingleResource( + resourceUri: string, + options?: EventsListBySingleResourceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceUri, options }, + listBySingleResourceOperationSpec + ); + } + + /** + * ListBySubscriptionIdNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscriptionId method. + * @param options The options parameters. + */ + private _listBySubscriptionIdNext( + nextLink: string, + options?: EventsListBySubscriptionIdNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionIdNextOperationSpec + ); + } + + /** + * ListByTenantIdNext + * @param nextLink The nextLink from the previous successful call to the ListByTenantId method. + * @param options The options parameters. + */ + private _listByTenantIdNext( + nextLink: string, + options?: EventsListByTenantIdNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listByTenantIdNextOperationSpec + ); + } + + /** + * ListBySingleResourceNext + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource + * type. Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName} + * @param nextLink The nextLink from the previous successful call to the ListBySingleResource method. + * @param options The options parameters. + */ + private _listBySingleResourceNext( + resourceUri: string, + nextLink: string, + options?: EventsListBySingleResourceNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceUri, nextLink, options }, + listBySingleResourceNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionIdOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Events + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.queryStartTime + ], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByTenantIdOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceHealth/events", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Events + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.queryStartTime + ], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listBySingleResourceOperationSpec: coreClient.OperationSpec = { + path: "/{resourceUri}/providers/Microsoft.ResourceHealth/events", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Events + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.resourceUri], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionIdNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Events + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByTenantIdNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Events + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; +const listBySingleResourceNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Events + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.resourceUri, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operations/impactedResources.ts b/sdk/resourcehealth/arm-resourcehealth/src/operations/impactedResources.ts new file mode 100644 index 000000000000..e5d315ed36fe --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operations/impactedResources.ts @@ -0,0 +1,414 @@ +/* + * 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, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { ImpactedResources } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftResourceHealth } from "../microsoftResourceHealth"; +import { + EventImpactedResource, + ImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams, + ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams, + ImpactedResourcesListBySubscriptionIdAndEventIdResponse, + ImpactedResourcesListByTenantIdAndEventIdNextOptionalParams, + ImpactedResourcesListByTenantIdAndEventIdOptionalParams, + ImpactedResourcesListByTenantIdAndEventIdResponse, + ImpactedResourcesGetOptionalParams, + ImpactedResourcesGetResponse, + ImpactedResourcesGetByTenantIdOptionalParams, + ImpactedResourcesGetByTenantIdResponse, + ImpactedResourcesListBySubscriptionIdAndEventIdNextResponse, + ImpactedResourcesListByTenantIdAndEventIdNextResponse +} from "../models"; + +/// +/** Class containing ImpactedResources operations. */ +export class ImpactedResourcesImpl implements ImpactedResources { + private readonly client: MicrosoftResourceHealth; + + /** + * Initialize a new instance of the class ImpactedResources class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftResourceHealth) { + this.client = client; + } + + /** + * Lists impacted resources in the subscription by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + public listBySubscriptionIdAndEventId( + eventTrackingId: string, + options?: ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionIdAndEventIdPagingAll( + eventTrackingId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionIdAndEventIdPagingPage( + eventTrackingId, + options, + settings + ); + } + }; + } + + private async *listBySubscriptionIdAndEventIdPagingPage( + eventTrackingId: string, + options?: ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ImpactedResourcesListBySubscriptionIdAndEventIdResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscriptionIdAndEventId( + eventTrackingId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionIdAndEventIdNext( + eventTrackingId, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionIdAndEventIdPagingAll( + eventTrackingId: string, + options?: ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionIdAndEventIdPagingPage( + eventTrackingId, + options + )) { + yield* page; + } + } + + /** + * Lists impacted resources in the tenant by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + public listByTenantIdAndEventId( + eventTrackingId: string, + options?: ImpactedResourcesListByTenantIdAndEventIdOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByTenantIdAndEventIdPagingAll( + eventTrackingId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByTenantIdAndEventIdPagingPage( + eventTrackingId, + options, + settings + ); + } + }; + } + + private async *listByTenantIdAndEventIdPagingPage( + eventTrackingId: string, + options?: ImpactedResourcesListByTenantIdAndEventIdOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ImpactedResourcesListByTenantIdAndEventIdResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByTenantIdAndEventId(eventTrackingId, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByTenantIdAndEventIdNext( + eventTrackingId, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByTenantIdAndEventIdPagingAll( + eventTrackingId: string, + options?: ImpactedResourcesListByTenantIdAndEventIdOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByTenantIdAndEventIdPagingPage( + eventTrackingId, + options + )) { + yield* page; + } + } + + /** + * Lists impacted resources in the subscription by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + private _listBySubscriptionIdAndEventId( + eventTrackingId: string, + options?: ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, options }, + listBySubscriptionIdAndEventIdOperationSpec + ); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param options The options parameters. + */ + get( + eventTrackingId: string, + impactedResourceName: string, + options?: ImpactedResourcesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, impactedResourceName, options }, + getOperationSpec + ); + } + + /** + * Lists impacted resources in the tenant by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + private _listByTenantIdAndEventId( + eventTrackingId: string, + options?: ImpactedResourcesListByTenantIdAndEventIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, options }, + listByTenantIdAndEventIdOperationSpec + ); + } + + /** + * Gets the specific impacted resource in the tenant by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param options The options parameters. + */ + getByTenantId( + eventTrackingId: string, + impactedResourceName: string, + options?: ImpactedResourcesGetByTenantIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, impactedResourceName, options }, + getByTenantIdOperationSpec + ); + } + + /** + * ListBySubscriptionIdAndEventIdNext + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param nextLink The nextLink from the previous successful call to the ListBySubscriptionIdAndEventId + * method. + * @param options The options parameters. + */ + private _listBySubscriptionIdAndEventIdNext( + eventTrackingId: string, + nextLink: string, + options?: ImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, nextLink, options }, + listBySubscriptionIdAndEventIdNextOperationSpec + ); + } + + /** + * ListByTenantIdAndEventIdNext + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param nextLink The nextLink from the previous successful call to the ListByTenantIdAndEventId + * method. + * @param options The options parameters. + */ + private _listByTenantIdAndEventIdNext( + eventTrackingId: string, + nextLink: string, + options?: ImpactedResourcesListByTenantIdAndEventIdNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { eventTrackingId, nextLink, options }, + listByTenantIdAndEventIdNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionIdAndEventIdOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.eventTrackingId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.eventTrackingId, + Parameters.impactedResourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByTenantIdAndEventIdOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.eventTrackingId], + headerParameters: [Parameters.accept], + serializer +}; +const getByTenantIdOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.eventTrackingId, + Parameters.impactedResourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionIdAndEventIdNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.eventTrackingId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByTenantIdAndEventIdNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.eventTrackingId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operations/index.ts b/sdk/resourcehealth/arm-resourcehealth/src/operations/index.ts index 7a0013d72250..74d27a90b066 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/operations/index.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/operations/index.ts @@ -7,7 +7,12 @@ */ export * from "./availabilityStatuses"; +export * from "./operations"; +export * from "./metadata"; +export * from "./impactedResources"; +export * from "./securityAdvisoryImpactedResources"; +export * from "./eventsOperations"; +export * from "./eventOperations"; export * from "./childAvailabilityStatuses"; export * from "./childResources"; -export * from "./operations"; export * from "./emergingIssues"; diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operations/metadata.ts b/sdk/resourcehealth/arm-resourcehealth/src/operations/metadata.ts new file mode 100644 index 000000000000..7559a1505dd8 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operations/metadata.ts @@ -0,0 +1,182 @@ +/* + * 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, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Metadata } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftResourceHealth } from "../microsoftResourceHealth"; +import { + MetadataEntity, + MetadataListNextOptionalParams, + MetadataListOptionalParams, + MetadataListResponse, + MetadataGetEntityOptionalParams, + MetadataGetEntityResponse, + MetadataListNextResponse +} from "../models"; + +/// +/** Class containing Metadata operations. */ +export class MetadataImpl implements Metadata { + private readonly client: MicrosoftResourceHealth; + + /** + * Initialize a new instance of the class Metadata class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftResourceHealth) { + this.client = client; + } + + /** + * Gets the list of metadata entities. + * @param options The options parameters. + */ + public list( + options?: MetadataListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: MetadataListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: MetadataListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: MetadataListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Gets the list of metadata entities. + * @param options The options parameters. + */ + private _list( + options?: MetadataListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * Gets the list of metadata entities. + * @param name Name of metadata entity. + * @param options The options parameters. + */ + getEntity( + name: string, + options?: MetadataGetEntityOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { name, options }, + getEntityOperationSpec + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: MetadataListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceHealth/metadata", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetadataEntityListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const getEntityOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceHealth/metadata/{name}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetadataEntity + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.name], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetadataEntityListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operations/securityAdvisoryImpactedResources.ts b/sdk/resourcehealth/arm-resourcehealth/src/operations/securityAdvisoryImpactedResources.ts new file mode 100644 index 000000000000..0adff453cb7b --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operations/securityAdvisoryImpactedResources.ts @@ -0,0 +1,342 @@ +/* + * 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, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { SecurityAdvisoryImpactedResources } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftResourceHealth } from "../microsoftResourceHealth"; +import { + EventImpactedResource, + SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams, + SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams, + SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdResponse, + SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextOptionalParams, + SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams, + SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdResponse, + SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextResponse, + SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextResponse +} from "../models"; + +/// +/** Class containing SecurityAdvisoryImpactedResources operations. */ +export class SecurityAdvisoryImpactedResourcesImpl + implements SecurityAdvisoryImpactedResources { + private readonly client: MicrosoftResourceHealth; + + /** + * Initialize a new instance of the class SecurityAdvisoryImpactedResources class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftResourceHealth) { + this.client = client; + } + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + public listBySubscriptionIdAndEventId( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionIdAndEventIdPagingAll( + eventTrackingId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionIdAndEventIdPagingPage( + eventTrackingId, + options, + settings + ); + } + }; + } + + private async *listBySubscriptionIdAndEventIdPagingPage( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscriptionIdAndEventId( + eventTrackingId, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionIdAndEventIdNext( + eventTrackingId, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionIdAndEventIdPagingAll( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionIdAndEventIdPagingPage( + eventTrackingId, + options + )) { + yield* page; + } + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + public listByTenantIdAndEventId( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByTenantIdAndEventIdPagingAll( + eventTrackingId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByTenantIdAndEventIdPagingPage( + eventTrackingId, + options, + settings + ); + } + }; + } + + private async *listByTenantIdAndEventIdPagingPage( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByTenantIdAndEventId(eventTrackingId, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByTenantIdAndEventIdNext( + eventTrackingId, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByTenantIdAndEventIdPagingAll( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByTenantIdAndEventIdPagingPage( + eventTrackingId, + options + )) { + yield* page; + } + } + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + private _listBySubscriptionIdAndEventId( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + ): Promise< + SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdResponse + > { + return this.client.sendOperationRequest( + { eventTrackingId, options }, + listBySubscriptionIdAndEventIdOperationSpec + ); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + private _listByTenantIdAndEventId( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams + ): Promise< + SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdResponse + > { + return this.client.sendOperationRequest( + { eventTrackingId, options }, + listByTenantIdAndEventIdOperationSpec + ); + } + + /** + * ListBySubscriptionIdAndEventIdNext + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param nextLink The nextLink from the previous successful call to the ListBySubscriptionIdAndEventId + * method. + * @param options The options parameters. + */ + private _listBySubscriptionIdAndEventIdNext( + eventTrackingId: string, + nextLink: string, + options?: SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextOptionalParams + ): Promise< + SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdNextResponse + > { + return this.client.sendOperationRequest( + { eventTrackingId, nextLink, options }, + listBySubscriptionIdAndEventIdNextOperationSpec + ); + } + + /** + * ListByTenantIdAndEventIdNext + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param nextLink The nextLink from the previous successful call to the ListByTenantIdAndEventId + * method. + * @param options The options parameters. + */ + private _listByTenantIdAndEventIdNext( + eventTrackingId: string, + nextLink: string, + options?: SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextOptionalParams + ): Promise< + SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdNextResponse + > { + return this.client.sendOperationRequest( + { eventTrackingId, nextLink, options }, + listByTenantIdAndEventIdNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionIdAndEventIdOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.eventTrackingId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByTenantIdAndEventIdOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.eventTrackingId], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionIdAndEventIdNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.eventTrackingId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByTenantIdAndEventIdNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EventImpactedResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.eventTrackingId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/availabilityStatuses.ts b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/availabilityStatuses.ts index 5000227ffff5..9943021e4c70 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/availabilityStatuses.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/availabilityStatuses.ts @@ -20,17 +20,15 @@ import { /** Interface representing a AvailabilityStatuses. */ export interface AvailabilityStatuses { /** - * Lists the current availability status for all the resources in the subscription. Use the nextLink - * property in the response to get the next page of availability statuses. + * Lists the current availability status for all the resources in the subscription. * @param options The options parameters. */ listBySubscriptionId( options?: AvailabilityStatusesListBySubscriptionIdOptionalParams ): PagedAsyncIterableIterator; /** - * Lists the current availability status for all the resources in the resource group. Use the nextLink - * property in the response to get the next page of availability statuses. - * @param resourceGroupName The name of the resource group. + * Lists the current availability status for all the resources in the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ listByResourceGroup( @@ -38,8 +36,7 @@ export interface AvailabilityStatuses { options?: AvailabilityStatusesListByResourceGroupOptionalParams ): PagedAsyncIterableIterator; /** - * Lists all historical availability transitions and impacting events for a single resource. Use the - * nextLink property in the response to get the next page of availability status + * Lists all historical availability transitions and impacting events for a single resource. * @param resourceUri The fully qualified ID of the resource, including the resource name and resource * type. Currently the API support not nested and one nesting level resource types : * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/emergingIssues.ts b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/emergingIssues.ts index b059382f09f3..79da920413f5 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/emergingIssues.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/emergingIssues.ts @@ -10,6 +10,7 @@ import { PagedAsyncIterableIterator } from "@azure/core-paging"; import { EmergingIssuesGetResult, EmergingIssuesListOptionalParams, + IssueNameParameter, EmergingIssuesGetOptionalParams, EmergingIssuesGetResponse } from "../models"; @@ -26,9 +27,11 @@ export interface EmergingIssues { ): PagedAsyncIterableIterator; /** * Gets Azure services' emerging issues. + * @param issueName The name of the emerging issue. * @param options The options parameters. */ get( + issueName: IssueNameParameter, options?: EmergingIssuesGetOptionalParams ): Promise; } diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/eventOperations.ts b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/eventOperations.ts new file mode 100644 index 000000000000..383d79750c18 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/eventOperations.ts @@ -0,0 +1,60 @@ +/* + * 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 { + EventGetBySubscriptionIdAndTrackingIdOptionalParams, + EventGetBySubscriptionIdAndTrackingIdResponse, + EventFetchDetailsBySubscriptionIdAndTrackingIdOptionalParams, + EventFetchDetailsBySubscriptionIdAndTrackingIdResponse, + EventGetByTenantIdAndTrackingIdOptionalParams, + EventGetByTenantIdAndTrackingIdResponse, + EventFetchDetailsByTenantIdAndTrackingIdOptionalParams, + EventFetchDetailsByTenantIdAndTrackingIdResponse +} from "../models"; + +/** Interface representing a EventOperations. */ +export interface EventOperations { + /** + * Service health event in the subscription by event tracking id + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + getBySubscriptionIdAndTrackingId( + eventTrackingId: string, + options?: EventGetBySubscriptionIdAndTrackingIdOptionalParams + ): Promise; + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch + * sensitive properties for Security Advisory events + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + fetchDetailsBySubscriptionIdAndTrackingId( + eventTrackingId: string, + options?: EventFetchDetailsBySubscriptionIdAndTrackingIdOptionalParams + ): Promise; + /** + * Service health event in the tenant by event tracking id + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + getByTenantIdAndTrackingId( + eventTrackingId: string, + options?: EventGetByTenantIdAndTrackingIdOptionalParams + ): Promise; + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + fetchDetailsByTenantIdAndTrackingId( + eventTrackingId: string, + options?: EventFetchDetailsByTenantIdAndTrackingIdOptionalParams + ): Promise; +} diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/eventsOperations.ts b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/eventsOperations.ts new file mode 100644 index 000000000000..e1cb1b67c184 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/eventsOperations.ts @@ -0,0 +1,47 @@ +/* + * 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 { + Event, + EventsListBySubscriptionIdOptionalParams, + EventsListByTenantIdOptionalParams, + EventsListBySingleResourceOptionalParams +} from "../models"; + +/// +/** Interface representing a EventsOperations. */ +export interface EventsOperations { + /** + * Lists service health events in the subscription. + * @param options The options parameters. + */ + listBySubscriptionId( + options?: EventsListBySubscriptionIdOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists current service health events in the tenant. + * @param options The options parameters. + */ + listByTenantId( + options?: EventsListByTenantIdOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists current service health events for given resource. + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource + * type. Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName} + * @param options The options parameters. + */ + listBySingleResource( + resourceUri: string, + options?: EventsListBySingleResourceOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/impactedResources.ts b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/impactedResources.ts new file mode 100644 index 000000000000..1735d218d06e --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/impactedResources.ts @@ -0,0 +1,63 @@ +/* + * 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 { + EventImpactedResource, + ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams, + ImpactedResourcesListByTenantIdAndEventIdOptionalParams, + ImpactedResourcesGetOptionalParams, + ImpactedResourcesGetResponse, + ImpactedResourcesGetByTenantIdOptionalParams, + ImpactedResourcesGetByTenantIdResponse +} from "../models"; + +/// +/** Interface representing a ImpactedResources. */ +export interface ImpactedResources { + /** + * Lists impacted resources in the subscription by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + listBySubscriptionIdAndEventId( + eventTrackingId: string, + options?: ImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists impacted resources in the tenant by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + listByTenantIdAndEventId( + eventTrackingId: string, + options?: ImpactedResourcesListByTenantIdAndEventIdOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets the specific impacted resource in the subscription by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param options The options parameters. + */ + get( + eventTrackingId: string, + impactedResourceName: string, + options?: ImpactedResourcesGetOptionalParams + ): Promise; + /** + * Gets the specific impacted resource in the tenant by an event. + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param options The options parameters. + */ + getByTenantId( + eventTrackingId: string, + impactedResourceName: string, + options?: ImpactedResourcesGetByTenantIdOptionalParams + ): Promise; +} diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/index.ts b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/index.ts index 7a0013d72250..74d27a90b066 100644 --- a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/index.ts +++ b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/index.ts @@ -7,7 +7,12 @@ */ export * from "./availabilityStatuses"; +export * from "./operations"; +export * from "./metadata"; +export * from "./impactedResources"; +export * from "./securityAdvisoryImpactedResources"; +export * from "./eventsOperations"; +export * from "./eventOperations"; export * from "./childAvailabilityStatuses"; export * from "./childResources"; -export * from "./operations"; export * from "./emergingIssues"; diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/metadata.ts b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/metadata.ts new file mode 100644 index 000000000000..b580859daba4 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/metadata.ts @@ -0,0 +1,36 @@ +/* + * 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 { + MetadataEntity, + MetadataListOptionalParams, + MetadataGetEntityOptionalParams, + MetadataGetEntityResponse +} from "../models"; + +/// +/** Interface representing a Metadata. */ +export interface Metadata { + /** + * Gets the list of metadata entities. + * @param options The options parameters. + */ + list( + options?: MetadataListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets the list of metadata entities. + * @param name Name of metadata entity. + * @param options The options parameters. + */ + getEntity( + name: string, + options?: MetadataGetEntityOptionalParams + ): Promise; +} diff --git a/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/securityAdvisoryImpactedResources.ts b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/securityAdvisoryImpactedResources.ts new file mode 100644 index 000000000000..49978c0abe84 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/src/operationsInterfaces/securityAdvisoryImpactedResources.ts @@ -0,0 +1,37 @@ +/* + * 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 { + EventImpactedResource, + SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams, + SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams +} from "../models"; + +/// +/** Interface representing a SecurityAdvisoryImpactedResources. */ +export interface SecurityAdvisoryImpactedResources { + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + listBySubscriptionIdAndEventId( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param options The options parameters. + */ + listByTenantIdAndEventId( + eventTrackingId: string, + options?: SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/resourcehealth/arm-resourcehealth/test/resourcehealth_operations_test.spec.ts b/sdk/resourcehealth/arm-resourcehealth/test/resourcehealth_operations_test.spec.ts new file mode 100644 index 000000000000..4f1b897e8cd0 --- /dev/null +++ b/sdk/resourcehealth/arm-resourcehealth/test/resourcehealth_operations_test.spec.ts @@ -0,0 +1,65 @@ +/* + * 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, + Recorder, + RecorderStartOptions, + delay, + isPlaybackMode, +} from "@azure-tools/test-recorder"; +import { createTestCredential } from "@azure-tools/test-credential"; +import { assert } from "chai"; +import { Context } from "mocha"; +import { MicrosoftResourceHealth } from "../src/microsoftResourceHealth"; + +const replaceableVariables: Record = { + 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" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("ResourceHealth test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: MicrosoftResourceHealth; + let location: string; + let resourceGroup: string; + let resourcename: string; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + subscriptionId = env.SUBSCRIPTION_ID || ''; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new MicrosoftResourceHealth(credential, subscriptionId, recorder.configureClientOptions({})); + location = "eastus"; + resourceGroup = "myjstest"; + resourcename = "resourcetest"; + + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("operations list test", async function () { + const res = await client.operations.list(); + console.log(res); + }); +}) diff --git a/sdk/resourcehealth/arm-resourcehealth/test/sampleTest.ts b/sdk/resourcehealth/arm-resourcehealth/test/sampleTest.ts deleted file mode 100644 index 25aeb3ebcc36..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/test/sampleTest.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 { - Recorder, - RecorderStartOptions, - env -} from "@azure-tools/test-recorder"; -import { assert } from "chai"; -import { Context } from "mocha"; - -const replaceableVariables: Record = { - 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" -}; - -const recorderOptions: RecorderStartOptions = { - envSetupForPlayback: replaceableVariables -}; - -describe("My test", () => { - let recorder: Recorder; - - beforeEach(async function(this: Context) { - recorder = new Recorder(this.currentTest); - await recorder.start(recorderOptions); - }); - - afterEach(async function() { - await recorder.stop(); - }); - - it("sample test", async function() { - console.log("Hi, I'm a test!"); - }); -}); From 4f1283dff0c2b3123cc26bd4ae19f3684f9d7b17 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 22 May 2023 16:54:28 +0800 Subject: [PATCH 2/2] update files --- .../samples/v3/javascript/README.md | 66 ---------------- ...availabilityStatusesGetByResourceSample.js | 37 --------- ...bilityStatusesListByResourceGroupSample.js | 44 ----------- ...ilityStatusesListBySubscriptionIdSample.js | 40 ---------- .../availabilityStatusesListSample.js | 38 --------- ...AvailabilityStatusesGetByResourceSample.js | 39 --------- .../childAvailabilityStatusesListSample.js | 38 --------- .../v3/javascript/childResourcesListSample.js | 38 --------- .../v3/javascript/emergingIssuesGetSample.js | 34 -------- .../v3/javascript/emergingIssuesListSample.js | 37 --------- .../samples/v3/javascript/package.json | 32 -------- .../samples/v3/javascript/sample.env | 4 - .../samples/v3/typescript/README.md | 79 ------------------- .../samples/v3/typescript/package.json | 41 ---------- .../samples/v3/typescript/sample.env | 4 - ...availabilityStatusesGetByResourceSample.ts | 46 ----------- ...bilityStatusesListByResourceGroupSample.ts | 51 ------------ ...ilityStatusesListBySubscriptionIdSample.ts | 48 ----------- .../src/availabilityStatusesListSample.ts | 41 ---------- ...AvailabilityStatusesGetByResourceSample.ts | 48 ----------- .../childAvailabilityStatusesListSample.ts | 41 ---------- .../src/childResourcesListSample.ts | 41 ---------- .../typescript/src/emergingIssuesGetSample.ts | 37 --------- .../src/emergingIssuesListSample.ts | 40 ---------- .../samples/v3/typescript/tsconfig.json | 17 ---- 25 files changed, 981 deletions(-) delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/README.md delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesGetByResourceSample.js delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListByResourceGroupSample.js delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListBySubscriptionIdSample.js delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListSample.js delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesGetByResourceSample.js delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesListSample.js delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childResourcesListSample.js delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesGetSample.js delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesListSample.js delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/package.json delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/sample.env delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/README.md delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/package.json delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/sample.env delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesGetByResourceSample.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListByResourceGroupSample.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListSample.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesGetByResourceSample.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesListSample.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childResourcesListSample.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesGetSample.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesListSample.ts delete mode 100644 sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/tsconfig.json diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/README.md b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/README.md deleted file mode 100644 index eddfb8a00b93..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [availabilityStatusesGetByResourceSample.js][availabilitystatusesgetbyresourcesample] | Gets current availability status for a single resource x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatus_GetByResource.json | -| [availabilityStatusesListByResourceGroupSample.js][availabilitystatuseslistbyresourcegroupsample] | Lists the current availability status for all the resources in the resource group. Use the nextLink property in the response to get the next page of availability statuses. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListByResourceGroup.json | -| [availabilityStatusesListBySubscriptionIdSample.js][availabilitystatuseslistbysubscriptionidsample] | Lists the current availability status for all the resources in the subscription. Use the nextLink property in the response to get the next page of availability statuses. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListBySubscriptionId.json | -| [availabilityStatusesListSample.js][availabilitystatuseslistsample] | Lists all historical availability transitions and impacting events for a single resource. Use the nextLink property in the response to get the next page of availability status x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_List.json | -| [childAvailabilityStatusesGetByResourceSample.js][childavailabilitystatusesgetbyresourcesample] | Gets current availability status for a single resource x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatus_GetByResource.json | -| [childAvailabilityStatusesListSample.js][childavailabilitystatuseslistsample] | Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatuses_List.json | -| [childResourcesListSample.js][childresourceslistsample] | Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildResources_List.json | -| [emergingIssuesGetSample.js][emergingissuesgetsample] | Gets Azure services' emerging issues. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_Get.json | -| [emergingIssuesListSample.js][emergingissueslistsample] | Lists Azure services' emerging issues. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_List.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -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 availabilityStatusesGetByResourceSample.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 RESOURCEHEALTH_SUBSCRIPTION_ID="" node availabilityStatusesGetByResourceSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[availabilitystatusesgetbyresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesGetByResourceSample.js -[availabilitystatuseslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListByResourceGroupSample.js -[availabilitystatuseslistbysubscriptionidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListBySubscriptionIdSample.js -[availabilitystatuseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListSample.js -[childavailabilitystatusesgetbyresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesGetByResourceSample.js -[childavailabilitystatuseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesListSample.js -[childresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childResourcesListSample.js -[emergingissuesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesGetSample.js -[emergingissueslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesListSample.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcehealth?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcehealth/arm-resourcehealth/README.md diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesGetByResourceSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesGetByResourceSample.js deleted file mode 100644 index 7a7b6af9f547..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesGetByResourceSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets current availability status for a single resource - * - * @summary Gets current availability status for a single resource - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatus_GetByResource.json - */ -async function getCurrentHealthByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const expand = "recommendedactions"; - const options = { expand }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const result = await client.availabilityStatuses.getByResource(resourceUri, options); - console.log(result); -} - -async function main() { - getCurrentHealthByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListByResourceGroupSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListByResourceGroupSample.js deleted file mode 100644 index b24c6c8ae114..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListByResourceGroupSample.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists the current availability status for all the resources in the resource group. Use the nextLink property in the response to get the next page of availability statuses. - * - * @summary Lists the current availability status for all the resources in the resource group. Use the nextLink property in the response to get the next page of availability statuses. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListByResourceGroup.json - */ -async function listByResourceGroup() { - const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; - const resourceGroupName = process.env["RESOURCEHEALTH_RESOURCE_GROUP"] || "resourceGroupName"; - const expand = "recommendedactions"; - const options = { - expand, - }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.availabilityStatuses.listByResourceGroup( - resourceGroupName, - options - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListBySubscriptionIdSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListBySubscriptionIdSample.js deleted file mode 100644 index 9a5915fdba0d..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListBySubscriptionIdSample.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists the current availability status for all the resources in the subscription. Use the nextLink property in the response to get the next page of availability statuses. - * - * @summary Lists the current availability status for all the resources in the subscription. Use the nextLink property in the response to get the next page of availability statuses. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListBySubscriptionId.json - */ -async function listHealthBySubscriptionId() { - const subscriptionId = process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; - const expand = "recommendedactions"; - const options = { - expand, - }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.availabilityStatuses.listBySubscriptionId(options)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listHealthBySubscriptionId(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListSample.js deleted file mode 100644 index 4ba25faa81b3..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/availabilityStatusesListSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists all historical availability transitions and impacting events for a single resource. Use the nextLink property in the response to get the next page of availability status - * - * @summary Lists all historical availability transitions and impacting events for a single resource. Use the nextLink property in the response to get the next page of availability status - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_List.json - */ -async function getHealthHistoryByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.availabilityStatuses.list(resourceUri)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - getHealthHistoryByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesGetByResourceSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesGetByResourceSample.js deleted file mode 100644 index d4667e03b369..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesGetByResourceSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets current availability status for a single resource - * - * @summary Gets current availability status for a single resource - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatus_GetByResource.json - */ -async function getCurrentHealthByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const expand = "recommendedactions"; - const options = { - expand, - }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const result = await client.childAvailabilityStatuses.getByResource(resourceUri, options); - console.log(result); -} - -async function main() { - getCurrentHealthByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesListSample.js deleted file mode 100644 index facdfcc81e64..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childAvailabilityStatusesListSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status - * - * @summary Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatuses_List.json - */ -async function getHealthHistoryByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.childAvailabilityStatuses.list(resourceUri)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - getHealthHistoryByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childResourcesListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childResourcesListSample.js deleted file mode 100644 index 2526dccb9185..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/childResourcesListSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health - * - * @summary Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildResources_List.json - */ -async function getHealthHistoryByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.childResources.list(resourceUri)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - getHealthHistoryByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesGetSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesGetSample.js deleted file mode 100644 index 00bb81228d50..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesGetSample.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets Azure services' emerging issues. - * - * @summary Gets Azure services' emerging issues. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_Get.json - */ -async function getEmergingIssues() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const result = await client.emergingIssues.get(); - console.log(result); -} - -async function main() { - getEmergingIssues(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesListSample.js b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesListSample.js deleted file mode 100644 index 530744f282d9..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/emergingIssuesListSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists Azure services' emerging issues. - * - * @summary Lists Azure services' emerging issues. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_List.json - */ -async function getEmergingIssues() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.emergingIssues.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - getEmergingIssues(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/package.json b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/package.json deleted file mode 100644 index 35e6983b8217..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@azure-samples/arm-resourcehealth-js", - "private": true, - "version": "1.0.0", - "description": " client library samples for JavaScript", - "engines": { - "node": ">=14.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/resourcehealth/arm-resourcehealth" - }, - "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/resourcehealth/arm-resourcehealth", - "dependencies": { - "@azure/arm-resourcehealth": "latest", - "dotenv": "latest", - "@azure/identity": "^2.0.1" - } -} diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/sample.env b/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/README.md b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/README.md deleted file mode 100644 index d5f7125330f0..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [availabilityStatusesGetByResourceSample.ts][availabilitystatusesgetbyresourcesample] | Gets current availability status for a single resource x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatus_GetByResource.json | -| [availabilityStatusesListByResourceGroupSample.ts][availabilitystatuseslistbyresourcegroupsample] | Lists the current availability status for all the resources in the resource group. Use the nextLink property in the response to get the next page of availability statuses. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListByResourceGroup.json | -| [availabilityStatusesListBySubscriptionIdSample.ts][availabilitystatuseslistbysubscriptionidsample] | Lists the current availability status for all the resources in the subscription. Use the nextLink property in the response to get the next page of availability statuses. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListBySubscriptionId.json | -| [availabilityStatusesListSample.ts][availabilitystatuseslistsample] | Lists all historical availability transitions and impacting events for a single resource. Use the nextLink property in the response to get the next page of availability status x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_List.json | -| [childAvailabilityStatusesGetByResourceSample.ts][childavailabilitystatusesgetbyresourcesample] | Gets current availability status for a single resource x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatus_GetByResource.json | -| [childAvailabilityStatusesListSample.ts][childavailabilitystatuseslistsample] | Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatuses_List.json | -| [childResourcesListSample.ts][childresourceslistsample] | Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildResources_List.json | -| [emergingIssuesGetSample.ts][emergingissuesgetsample] | Gets Azure services' emerging issues. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_Get.json | -| [emergingIssuesListSample.ts][emergingissueslistsample] | Lists Azure services' emerging issues. x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_List.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -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/availabilityStatusesGetByResourceSample.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 RESOURCEHEALTH_SUBSCRIPTION_ID="" node dist/availabilityStatusesGetByResourceSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[availabilitystatusesgetbyresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesGetByResourceSample.ts -[availabilitystatuseslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListByResourceGroupSample.ts -[availabilitystatuseslistbysubscriptionidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts -[availabilitystatuseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListSample.ts -[childavailabilitystatusesgetbyresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesGetByResourceSample.ts -[childavailabilitystatuseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesListSample.ts -[childresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childResourcesListSample.ts -[emergingissuesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesGetSample.ts -[emergingissueslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesListSample.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcehealth?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcehealth/arm-resourcehealth/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/package.json b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/package.json deleted file mode 100644 index 379737a53cb4..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@azure-samples/arm-resourcehealth-ts", - "private": true, - "version": "1.0.0", - "description": " client library samples for TypeScript", - "engines": { - "node": ">=14.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/resourcehealth/arm-resourcehealth" - }, - "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/resourcehealth/arm-resourcehealth", - "dependencies": { - "@azure/arm-resourcehealth": "latest", - "dotenv": "latest", - "@azure/identity": "^2.0.1" - }, - "devDependencies": { - "@types/node": "^14.0.0", - "typescript": "~5.0.0", - "rimraf": "latest" - } -} diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/sample.env b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesGetByResourceSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesGetByResourceSample.ts deleted file mode 100644 index 82ab7e87b230..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesGetByResourceSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 { - AvailabilityStatusesGetByResourceOptionalParams, - MicrosoftResourceHealth -} from "@azure/arm-resourcehealth"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Gets current availability status for a single resource - * - * @summary Gets current availability status for a single resource - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatus_GetByResource.json - */ -async function getCurrentHealthByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const expand = "recommendedactions"; - const options: AvailabilityStatusesGetByResourceOptionalParams = { expand }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const result = await client.availabilityStatuses.getByResource( - resourceUri, - options - ); - console.log(result); -} - -async function main() { - getCurrentHealthByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListByResourceGroupSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListByResourceGroupSample.ts deleted file mode 100644 index 7b7cdddffc0a..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListByResourceGroupSample.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 { - AvailabilityStatusesListByResourceGroupOptionalParams, - MicrosoftResourceHealth -} from "@azure/arm-resourcehealth"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists the current availability status for all the resources in the resource group. Use the nextLink property in the response to get the next page of availability statuses. - * - * @summary Lists the current availability status for all the resources in the resource group. Use the nextLink property in the response to get the next page of availability statuses. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListByResourceGroup.json - */ -async function listByResourceGroup() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; - const resourceGroupName = - process.env["RESOURCEHEALTH_RESOURCE_GROUP"] || "resourceGroupName"; - const expand = "recommendedactions"; - const options: AvailabilityStatusesListByResourceGroupOptionalParams = { - expand - }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.availabilityStatuses.listByResourceGroup( - resourceGroupName, - options - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts deleted file mode 100644 index 9e81732f4761..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListBySubscriptionIdSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 { - AvailabilityStatusesListBySubscriptionIdOptionalParams, - MicrosoftResourceHealth -} from "@azure/arm-resourcehealth"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists the current availability status for all the resources in the subscription. Use the nextLink property in the response to get the next page of availability statuses. - * - * @summary Lists the current availability status for all the resources in the subscription. Use the nextLink property in the response to get the next page of availability statuses. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_ListBySubscriptionId.json - */ -async function listHealthBySubscriptionId() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || "subscriptionId"; - const expand = "recommendedactions"; - const options: AvailabilityStatusesListBySubscriptionIdOptionalParams = { - expand - }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.availabilityStatuses.listBySubscriptionId( - options - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listHealthBySubscriptionId(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListSample.ts deleted file mode 100644 index f5dc16c8435a..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/availabilityStatusesListSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists all historical availability transitions and impacting events for a single resource. Use the nextLink property in the response to get the next page of availability status - * - * @summary Lists all historical availability transitions and impacting events for a single resource. Use the nextLink property in the response to get the next page of availability status - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/AvailabilityStatuses_List.json - */ -async function getHealthHistoryByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.availabilityStatuses.list(resourceUri)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - getHealthHistoryByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesGetByResourceSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesGetByResourceSample.ts deleted file mode 100644 index 82d0c0c2b2cb..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesGetByResourceSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 { - ChildAvailabilityStatusesGetByResourceOptionalParams, - MicrosoftResourceHealth -} from "@azure/arm-resourcehealth"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Gets current availability status for a single resource - * - * @summary Gets current availability status for a single resource - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatus_GetByResource.json - */ -async function getCurrentHealthByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const expand = "recommendedactions"; - const options: ChildAvailabilityStatusesGetByResourceOptionalParams = { - expand - }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const result = await client.childAvailabilityStatuses.getByResource( - resourceUri, - options - ); - console.log(result); -} - -async function main() { - getCurrentHealthByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesListSample.ts deleted file mode 100644 index b2030c6c267f..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childAvailabilityStatusesListSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status - * - * @summary Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildAvailabilityStatuses_List.json - */ -async function getHealthHistoryByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.childAvailabilityStatuses.list(resourceUri)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - getHealthHistoryByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childResourcesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childResourcesListSample.ts deleted file mode 100644 index 6298686db3bc..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/childResourcesListSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health - * - * @summary Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/ChildResources_List.json - */ -async function getHealthHistoryByResource() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceUri = "resourceUri"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.childResources.list(resourceUri)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - getHealthHistoryByResource(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesGetSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesGetSample.ts deleted file mode 100644 index 01e82e546b13..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesGetSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Gets Azure services' emerging issues. - * - * @summary Gets Azure services' emerging issues. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_Get.json - */ -async function getEmergingIssues() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const result = await client.emergingIssues.get(); - console.log(result); -} - -async function main() { - getEmergingIssues(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesListSample.ts b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesListSample.ts deleted file mode 100644 index 53492e9b3249..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/src/emergingIssuesListSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { MicrosoftResourceHealth } from "@azure/arm-resourcehealth"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists Azure services' emerging issues. - * - * @summary Lists Azure services' emerging issues. - * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2017-07-01/examples/EmergingIssues_List.json - */ -async function getEmergingIssues() { - const subscriptionId = - process.env["RESOURCEHEALTH_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftResourceHealth(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.emergingIssues.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - getEmergingIssues(); -} - -main().catch(console.error); diff --git a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/tsconfig.json b/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/tsconfig.json deleted file mode 100644 index e26ce2a6d8f7..000000000000 --- a/sdk/resourcehealth/arm-resourcehealth/samples/v3/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**.ts" - ] -}