diff --git a/sdk/elastic/arm-elastic/CHANGELOG.md b/sdk/elastic/arm-elastic/CHANGELOG.md index 6962fd547969..75810ca72010 100644 --- a/sdk/elastic/arm-elastic/CHANGELOG.md +++ b/sdk/elastic/arm-elastic/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 2.0.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 2.0.0 (2025-11-25) ### Features Added diff --git a/sdk/elastic/arm-elastic/package.json b/sdk/elastic/arm-elastic/package.json index 42b0a94f6561..aff86ce62ed6 100644 --- a/sdk/elastic/arm-elastic/package.json +++ b/sdk/elastic/arm-elastic/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for MicrosoftElastic.", - "version": "2.0.0", + "version": "2.0.1", "engines": { "node": ">=20.0.0" }, diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/README.md b/sdk/elastic/arm-elastic/samples/v2/javascript/README.md new file mode 100644 index 000000000000..74c0883e7d34 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/README.md @@ -0,0 +1,134 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [allTrafficFiltersListSample.js][alltrafficfilterslistsample] | List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AllTrafficFilters_list.json | +| [associateTrafficFilterAssociateSample.js][associatetrafficfilterassociatesample] | Associate a traffic filter with your Elastic monitor resource to control and manage network traffic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociateTrafficFilter_Update.json | +| [billingInfoGetSample.js][billinginfogetsample] | Retrieve marketplace and organization billing information mapped to the given Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/BillingInfo_Get.json | +| [connectedPartnerResourcesListSample.js][connectedpartnerresourceslistsample] | List all active deployments associated with the marketplace subscription linked to the given Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ConnectedPartnerResources_List.json | +| [createAndAssociateIPFilterCreateSample.js][createandassociateipfiltercreatesample] | Create and associate an IP filter with your Elastic monitor resource to control and manage network traffic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/IPTrafficFilter_Create.json | +| [createAndAssociatePlFilterCreateSample.js][createandassociateplfiltercreatesample] | Create and associate a PL filter with your Elastic monitor resource to control and manage network traffic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/PrivateLinkTrafficFilters_Create.json | +| [deploymentInfoListSample.js][deploymentinfolistsample] | Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DeploymentInfo_List.json | +| [detachAndDeleteTrafficFilterDeleteSample.js][detachanddeletetrafficfilterdeletesample] | Detach and delete an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachAndDeleteTrafficFilter_Delete.json | +| [detachTrafficFilterUpdateSample.js][detachtrafficfilterupdatesample] | Detach an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachTrafficFilters_Update.json | +| [elasticVersionsListSample.js][elasticversionslistsample] | Retrieve a list of all available Elastic versions for a specified region, helping you choose the best version for your deployment. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ElasticVersions_List.json | +| [externalUserCreateOrUpdateSample.js][externalusercreateorupdatesample] | Create or update external user configurations for your Elastic monitor resource, enabling access and management by external users. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ExternalUserInfo.json | +| [listAssociatedTrafficFiltersListSample.js][listassociatedtrafficfilterslistsample] | List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociatedFiltersForDeployment_list.json | +| [monitorUpgradeSample.js][monitorupgradesample] | Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitor_Upgrade.json | +| [monitoredResourcesListSample.js][monitoredresourceslistsample] | List all resources currently being monitored by the Elastic monitor resource, helping you manage observability. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredResources_List.json | +| [monitoredSubscriptionsCreateorUpdateSample.js][monitoredsubscriptionscreateorupdatesample] | Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and monitoring. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_CreateorUpdate.json | +| [monitoredSubscriptionsDeleteSample.js][monitoredsubscriptionsdeletesample] | Delete subscriptions being monitored by the Elastic monitor resource, removing their observability and monitoring capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Delete.json | +| [monitoredSubscriptionsGetSample.js][monitoredsubscriptionsgetsample] | Get detailed information about all subscriptions currently being monitored by the Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Get.json | +| [monitoredSubscriptionsListSample.js][monitoredsubscriptionslistsample] | List all subscriptions currently being monitored by the Elastic monitor resource, helping you manage observability. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_List.json | +| [monitoredSubscriptionsUpdateSample.js][monitoredsubscriptionsupdatesample] | Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Update.json | +| [monitorsCreateSample.js][monitorscreatesample] | Create a new Elastic monitor resource in your Azure subscription, enabling observability and monitoring of your Azure resources through Elastic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Create.json | +| [monitorsDeleteSample.js][monitorsdeletesample] | Delete an existing Elastic monitor resource from your Azure subscription, removing its observability and monitoring capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Delete.json | +| [monitorsGetSample.js][monitorsgetsample] | Get detailed properties of a specific Elastic monitor resource, helping you manage observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Get.json | +| [monitorsListByResourceGroupSample.js][monitorslistbyresourcegroupsample] | List all Elastic monitor resources within a specified resource group of the subscription, helping you audit and manage your monitoring setup. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_ListByResourceGroup.json | +| [monitorsListSample.js][monitorslistsample] | List all Elastic monitor resources within a specified subscription, helping you audit and manage your monitoring setup. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_List.json | +| [monitorsUpdateSample.js][monitorsupdatesample] | Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Update.json | +| [openAiCreateOrUpdateSample.js][openaicreateorupdatesample] | Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling advanced AI-driven observability and monitoring. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_CreateOrUpdate.json | +| [openAiDeleteSample.js][openaideletesample] | Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven observability and monitoring capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Delete.json | +| [openAiGetSample.js][openaigetsample] | Get detailed information about OpenAI integration rules for a given Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Get.json | +| [openAiGetStatusSample.js][openaigetstatussample] | Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_GetStatus.json | +| [openAiListSample.js][openailistsample] | List all OpenAI integration rules for a given Elastic monitor resource, helping you manage AI-driven observability and monitoring. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_List.json | +| [operationsListSample.js][operationslistsample] | List all operations provided by Microsoft.Elastic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Operations_List.json | +| [organizationsGetApiKeySample.js][organizationsgetapikeysample] | Fetch the User API Key from the internal database, if it was generated and stored during the creation of the Elasticsearch Organization. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetApiKey.json | +| [organizationsGetElasticToAzureSubscriptionMappingSample.js][organizationsgetelastictoazuresubscriptionmappingsample] | Retrieve mapping details between the Elastic Organization and Azure Subscription for the logged-in user. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetElasticToAzureSubscriptionMapping.json | +| [organizationsResubscribeSample.js][organizationsresubscribesample] | Resubscribe the Elasticsearch Organization. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_Resubscribe.json | +| [tagRulesCreateOrUpdateSample.js][tagrulescreateorupdatesample] | Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained control over observability based on resource tags. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_CreateOrUpdate.json | +| [tagRulesDeleteSample.js][tagrulesdeletesample] | Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over observability based on resource tags. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Delete.json | +| [tagRulesGetSample.js][tagrulesgetsample] | Get detailed information about a tag rule set for a given Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Get.json | +| [tagRulesListSample.js][tagruleslistsample] | List all tag rules for a given Elastic monitor resource, helping you manage fine-grained control over observability based on resource tags. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_List.json | +| [trafficFiltersDeleteSample.js][trafficfiltersdeletesample] | Delete an existing traffic filter associated with your Elastic monitor resource, removing its network traffic control capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TrafficFilters_Delete.json | +| [upgradableVersionsDetailsSample.js][upgradableversionsdetailssample] | List all upgradable versions for your Elastic monitor resource, helping you plan and execute upgrades. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/UpgradableVersions_Details.json | +| [vmCollectionUpdateSample.js][vmcollectionupdatesample] | Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMCollection_Update.json | +| [vmHostListSample.js][vmhostlistsample] | List all VM resources currently being monitored by the Elastic monitor resource, helping you manage observability. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMHost_List.json | +| [vmIngestionDetailsSample.js][vmingestiondetailssample] | List detailed information about VM ingestion that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMIngestion_Details.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 allTrafficFiltersListSample.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 +cross-env ELASTIC_SUBSCRIPTION_ID="" ELASTIC_RESOURCE_GROUP="" node allTrafficFiltersListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[alltrafficfilterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/allTrafficFiltersListSample.js +[associatetrafficfilterassociatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/associateTrafficFilterAssociateSample.js +[billinginfogetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/billingInfoGetSample.js +[connectedpartnerresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/connectedPartnerResourcesListSample.js +[createandassociateipfiltercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/createAndAssociateIPFilterCreateSample.js +[createandassociateplfiltercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/createAndAssociatePlFilterCreateSample.js +[deploymentinfolistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/deploymentInfoListSample.js +[detachanddeletetrafficfilterdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/detachAndDeleteTrafficFilterDeleteSample.js +[detachtrafficfilterupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/detachTrafficFilterUpdateSample.js +[elasticversionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/elasticVersionsListSample.js +[externalusercreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/externalUserCreateOrUpdateSample.js +[listassociatedtrafficfilterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/listAssociatedTrafficFiltersListSample.js +[monitorupgradesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitorUpgradeSample.js +[monitoredresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredResourcesListSample.js +[monitoredsubscriptionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsCreateorUpdateSample.js +[monitoredsubscriptionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsDeleteSample.js +[monitoredsubscriptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsGetSample.js +[monitoredsubscriptionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsListSample.js +[monitoredsubscriptionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsUpdateSample.js +[monitorscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsCreateSample.js +[monitorsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsDeleteSample.js +[monitorsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsGetSample.js +[monitorslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsListByResourceGroupSample.js +[monitorslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsListSample.js +[monitorsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsUpdateSample.js +[openaicreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/openAiCreateOrUpdateSample.js +[openaideletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/openAiDeleteSample.js +[openaigetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/openAiGetSample.js +[openaigetstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/openAiGetStatusSample.js +[openailistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/openAiListSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/operationsListSample.js +[organizationsgetapikeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsGetApiKeySample.js +[organizationsgetelastictoazuresubscriptionmappingsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsGetElasticToAzureSubscriptionMappingSample.js +[organizationsresubscribesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsResubscribeSample.js +[tagrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesCreateOrUpdateSample.js +[tagrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesDeleteSample.js +[tagrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesGetSample.js +[tagruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesListSample.js +[trafficfiltersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/trafficFiltersDeleteSample.js +[upgradableversionsdetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/upgradableVersionsDetailsSample.js +[vmcollectionupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/vmCollectionUpdateSample.js +[vmhostlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/vmHostListSample.js +[vmingestiondetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/javascript/vmIngestionDetailsSample.js +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-elastic?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/elastic/arm-elastic/README.md diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/allTrafficFiltersListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/allTrafficFiltersListSample.js new file mode 100644 index 000000000000..b5a87b77fe23 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/allTrafficFiltersListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. + * + * @summary List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AllTrafficFilters_list.json + */ +async function allTrafficFiltersList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.allTrafficFilters.list(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await allTrafficFiltersList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/associateTrafficFilterAssociateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/associateTrafficFilterAssociateSample.js new file mode 100644 index 000000000000..ff14bafedf4f --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/associateTrafficFilterAssociateSample.js @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Associate a traffic filter with your Elastic monitor resource to control and manage network traffic. + * + * @summary Associate a traffic filter with your Elastic monitor resource to control and manage network traffic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociateTrafficFilter_Update.json + */ +async function associateTrafficFilterAssociate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; + const options = { rulesetId }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.associateTrafficFilter.beginAssociateAndWait( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main() { + await associateTrafficFilterAssociate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/billingInfoGetSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/billingInfoGetSample.js new file mode 100644 index 000000000000..29a1ddaba34c --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/billingInfoGetSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Retrieve marketplace and organization billing information mapped to the given Elastic monitor resource. + * + * @summary Retrieve marketplace and organization billing information mapped to the given Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/BillingInfo_Get.json + */ +async function billingInfoGet() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.billingInfo.get(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await billingInfoGet(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/connectedPartnerResourcesListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/connectedPartnerResourcesListSample.js new file mode 100644 index 000000000000..861a4b0ccd28 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/connectedPartnerResourcesListSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all active deployments associated with the marketplace subscription linked to the given Elastic monitor resource. + * + * @summary List all active deployments associated with the marketplace subscription linked to the given Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ConnectedPartnerResources_List.json + */ +async function connectedPartnerResourcesList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.connectedPartnerResources.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await connectedPartnerResourcesList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/createAndAssociateIPFilterCreateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/createAndAssociateIPFilterCreateSample.js new file mode 100644 index 000000000000..e2c194a9dbe8 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/createAndAssociateIPFilterCreateSample.js @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Create and associate an IP filter with your Elastic monitor resource to control and manage network traffic. + * + * @summary Create and associate an IP filter with your Elastic monitor resource to control and manage network traffic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/IPTrafficFilter_Create.json + */ +async function createAndAssociateIPFilterCreate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const ips = "192.168.131.0, 192.168.132.6/22"; + const options = { ips }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.createAndAssociateIPFilter.beginCreateAndWait( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main() { + await createAndAssociateIPFilterCreate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/createAndAssociatePlFilterCreateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/createAndAssociatePlFilterCreateSample.js new file mode 100644 index 000000000000..71ba4ea8c3ae --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/createAndAssociatePlFilterCreateSample.js @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Create and associate a PL filter with your Elastic monitor resource to control and manage network traffic. + * + * @summary Create and associate a PL filter with your Elastic monitor resource to control and manage network traffic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/PrivateLinkTrafficFilters_Create.json + */ +async function createAndAssociatePlFilterCreate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const privateEndpointGuid = "fdb54d3b-e85e-4d08-8958-0d2f7g523df9"; + const privateEndpointName = "myPrivateEndpoint"; + const options = { + privateEndpointGuid, + privateEndpointName, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.createAndAssociatePLFilter.beginCreateAndWait( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main() { + await createAndAssociatePlFilterCreate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/deploymentInfoListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/deploymentInfoListSample.js new file mode 100644 index 000000000000..662c12053ff9 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/deploymentInfoListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor resource. + * + * @summary Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DeploymentInfo_List.json + */ +async function deploymentInfoList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.deploymentInfo.list(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await deploymentInfoList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/detachAndDeleteTrafficFilterDeleteSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/detachAndDeleteTrafficFilterDeleteSample.js new file mode 100644 index 000000000000..de303a98d394 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/detachAndDeleteTrafficFilterDeleteSample.js @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Detach and delete an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. + * + * @summary Detach and delete an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachAndDeleteTrafficFilter_Delete.json + */ +async function detachAndDeleteTrafficFilterDelete() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; + const options = { + rulesetId, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.detachAndDeleteTrafficFilter.delete( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main() { + await detachAndDeleteTrafficFilterDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/detachTrafficFilterUpdateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/detachTrafficFilterUpdateSample.js new file mode 100644 index 000000000000..3f941cab0aa2 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/detachTrafficFilterUpdateSample.js @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Detach an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. + * + * @summary Detach an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachTrafficFilters_Update.json + */ +async function detachTrafficFilterUpdate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; + const options = { rulesetId }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.detachTrafficFilter.beginUpdateAndWait( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main() { + await detachTrafficFilterUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/elasticVersionsListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/elasticVersionsListSample.js new file mode 100644 index 000000000000..21081fad3c96 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/elasticVersionsListSample.js @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Retrieve a list of all available Elastic versions for a specified region, helping you choose the best version for your deployment. + * + * @summary Retrieve a list of all available Elastic versions for a specified region, helping you choose the best version for your deployment. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ElasticVersions_List.json + */ +async function elasticVersionsList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const region = "myregion"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.elasticVersions.list(region)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await elasticVersionsList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/externalUserCreateOrUpdateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/externalUserCreateOrUpdateSample.js new file mode 100644 index 000000000000..f01778e90c53 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/externalUserCreateOrUpdateSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Create or update external user configurations for your Elastic monitor resource, enabling access and management by external users. + * + * @summary Create or update external user configurations for your Elastic monitor resource, enabling access and management by external users. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ExternalUserInfo.json + */ +async function externalUserCreateOrUpdate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.externalUser.createOrUpdate(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await externalUserCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/listAssociatedTrafficFiltersListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/listAssociatedTrafficFiltersListSample.js new file mode 100644 index 000000000000..294de08f03e9 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/listAssociatedTrafficFiltersListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. + * + * @summary List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociatedFiltersForDeployment_list.json + */ +async function listAssociatedTrafficFiltersList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.listAssociatedTrafficFilters.list(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await listAssociatedTrafficFiltersList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitorUpgradeSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorUpgradeSample.js new file mode 100644 index 000000000000..6005f7836957 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorUpgradeSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and performance. + * + * @summary Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitor_Upgrade.json + */ +async function monitorUpgrade() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitor.beginUpgradeAndWait(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await monitorUpgrade(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredResourcesListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredResourcesListSample.js new file mode 100644 index 000000000000..cefb2e815afe --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredResourcesListSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all resources currently being monitored by the Elastic monitor resource, helping you manage observability. + * + * @summary List all resources currently being monitored by the Elastic monitor resource, helping you manage observability. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredResources_List.json + */ +async function monitoredResourcesList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.monitoredResources.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await monitoredResourcesList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsCreateorUpdateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsCreateorUpdateSample.js new file mode 100644 index 000000000000..7866492a5a21 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsCreateorUpdateSample.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and monitoring. + * + * @summary Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and monitoring. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_CreateorUpdate.json + */ +async function monitorsAddMonitoredSubscriptions() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitoredSubscriptions.beginCreateorUpdateAndWait( + resourceGroupName, + monitorName, + configurationName, + ); + console.log(result); +} + +async function main() { + await monitorsAddMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsDeleteSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsDeleteSample.js new file mode 100644 index 000000000000..5ac866f62cb4 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsDeleteSample.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Delete subscriptions being monitored by the Elastic monitor resource, removing their observability and monitoring capabilities. + * + * @summary Delete subscriptions being monitored by the Elastic monitor resource, removing their observability and monitoring capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Delete.json + */ +async function monitorsDeleteMonitoredSubscriptions() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitoredSubscriptions.beginDeleteAndWait( + resourceGroupName, + monitorName, + configurationName, + ); + console.log(result); +} + +async function main() { + await monitorsDeleteMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsGetSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsGetSample.js new file mode 100644 index 000000000000..8e83e8c5a383 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsGetSample.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Get detailed information about all subscriptions currently being monitored by the Elastic monitor resource. + * + * @summary Get detailed information about all subscriptions currently being monitored by the Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Get.json + */ +async function monitorsGetMonitoredSubscriptions() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitoredSubscriptions.get( + resourceGroupName, + monitorName, + configurationName, + ); + console.log(result); +} + +async function main() { + await monitorsGetMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsListSample.js new file mode 100644 index 000000000000..2f986dab708c --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsListSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all subscriptions currently being monitored by the Elastic monitor resource, helping you manage observability. + * + * @summary List all subscriptions currently being monitored by the Elastic monitor resource, helping you manage observability. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_List.json + */ +async function monitorsGetMonitoredSubscriptions() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.monitoredSubscriptions.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await monitorsGetMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsUpdateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsUpdateSample.js new file mode 100644 index 000000000000..7fdebc100b43 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitoredSubscriptionsUpdateSample.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * + * @summary Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Update.json + */ +async function monitorsUpdateMonitoredSubscriptions() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitoredSubscriptions.beginUpdateAndWait( + resourceGroupName, + monitorName, + configurationName, + ); + console.log(result); +} + +async function main() { + await monitorsUpdateMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsCreateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsCreateSample.js new file mode 100644 index 000000000000..fcfe2b3cfe8a --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsCreateSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Create a new Elastic monitor resource in your Azure subscription, enabling observability and monitoring of your Azure resources through Elastic. + * + * @summary Create a new Elastic monitor resource in your Azure subscription, enabling observability and monitoring of your Azure resources through Elastic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Create.json + */ +async function monitorsCreate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitors.beginCreateAndWait(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await monitorsCreate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsDeleteSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsDeleteSample.js new file mode 100644 index 000000000000..0c06f4d0cabe --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsDeleteSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Delete an existing Elastic monitor resource from your Azure subscription, removing its observability and monitoring capabilities. + * + * @summary Delete an existing Elastic monitor resource from your Azure subscription, removing its observability and monitoring capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Delete.json + */ +async function monitorsDelete() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await monitorsDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsGetSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsGetSample.js new file mode 100644 index 000000000000..6aa724347d62 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsGetSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Get detailed properties of a specific Elastic monitor resource, helping you manage observability and performance. + * + * @summary Get detailed properties of a specific Elastic monitor resource, helping you manage observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Get.json + */ +async function monitorsGet() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitors.get(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await monitorsGet(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsListByResourceGroupSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsListByResourceGroupSample.js new file mode 100644 index 000000000000..5ad164dd7f77 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsListByResourceGroupSample.js @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all Elastic monitor resources within a specified resource group of the subscription, helping you audit and manage your monitoring setup. + * + * @summary List all Elastic monitor resources within a specified resource group of the subscription, helping you audit and manage your monitoring setup. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_ListByResourceGroup.json + */ +async function monitorsListByResourceGroup() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.monitors.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await monitorsListByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsListSample.js new file mode 100644 index 000000000000..e09f44707206 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsListSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all Elastic monitor resources within a specified subscription, helping you audit and manage your monitoring setup. + * + * @summary List all Elastic monitor resources within a specified subscription, helping you audit and manage your monitoring setup. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_List.json + */ +async function monitorsList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.monitors.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await monitorsList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsUpdateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsUpdateSample.js new file mode 100644 index 000000000000..8001abe56fa0 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/monitorsUpdateSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal observability and performance. + * + * @summary Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Update.json + */ +async function monitorsUpdate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitors.beginUpdateAndWait(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await monitorsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/openAiCreateOrUpdateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiCreateOrUpdateSample.js new file mode 100644 index 000000000000..e59c88d557b4 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiCreateOrUpdateSample.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling advanced AI-driven observability and monitoring. + * + * @summary Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling advanced AI-driven observability and monitoring. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_CreateOrUpdate.json + */ +async function openAiCreateOrUpdate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const integrationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.openAI.createOrUpdate( + resourceGroupName, + monitorName, + integrationName, + ); + console.log(result); +} + +async function main() { + await openAiCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/openAiDeleteSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiDeleteSample.js new file mode 100644 index 000000000000..5e88426be8cc --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiDeleteSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven observability and monitoring capabilities. + * + * @summary Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven observability and monitoring capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Delete.json + */ +async function openAiDelete() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const integrationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.openAI.delete(resourceGroupName, monitorName, integrationName); + console.log(result); +} + +async function main() { + await openAiDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/openAiGetSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiGetSample.js new file mode 100644 index 000000000000..7ebb3cf263d0 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiGetSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Get detailed information about OpenAI integration rules for a given Elastic monitor resource. + * + * @summary Get detailed information about OpenAI integration rules for a given Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Get.json + */ +async function openAiGet() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const integrationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.openAI.get(resourceGroupName, monitorName, integrationName); + console.log(result); +} + +async function main() { + await openAiGet(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/openAiGetStatusSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiGetStatusSample.js new file mode 100644 index 000000000000..f0283d0a640e --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiGetStatusSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal observability and performance. + * + * @summary Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_GetStatus.json + */ +async function openAiGetStatus() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const integrationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.openAI.getStatus(resourceGroupName, monitorName, integrationName); + console.log(result); +} + +async function main() { + await openAiGetStatus(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/openAiListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiListSample.js new file mode 100644 index 000000000000..ba15526f99c7 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/openAiListSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all OpenAI integration rules for a given Elastic monitor resource, helping you manage AI-driven observability and monitoring. + * + * @summary List all OpenAI integration rules for a given Elastic monitor resource, helping you manage AI-driven observability and monitoring. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_List.json + */ +async function openAiList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.openAI.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await openAiList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/operationsListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/operationsListSample.js new file mode 100644 index 000000000000..52d2f2c10278 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/operationsListSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all operations provided by Microsoft.Elastic. + * + * @summary List all operations provided by Microsoft.Elastic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await operationsList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsGetApiKeySample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsGetApiKeySample.js new file mode 100644 index 000000000000..1b3e60a5c2f4 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsGetApiKeySample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Fetch the User API Key from the internal database, if it was generated and stored during the creation of the Elasticsearch Organization. + * + * @summary Fetch the User API Key from the internal database, if it was generated and stored during the creation of the Elasticsearch Organization. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetApiKey.json + */ +async function organizationsGetApiKey() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.organizations.getApiKey(); + console.log(result); +} + +async function main() { + await organizationsGetApiKey(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsGetElasticToAzureSubscriptionMappingSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsGetElasticToAzureSubscriptionMappingSample.js new file mode 100644 index 000000000000..55ca3d303acb --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsGetElasticToAzureSubscriptionMappingSample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Retrieve mapping details between the Elastic Organization and Azure Subscription for the logged-in user. + * + * @summary Retrieve mapping details between the Elastic Organization and Azure Subscription for the logged-in user. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetElasticToAzureSubscriptionMapping.json + */ +async function organizationsGetElasticToAzureSubscriptionMapping() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.organizations.getElasticToAzureSubscriptionMapping(); + console.log(result); +} + +async function main() { + await organizationsGetElasticToAzureSubscriptionMapping(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsResubscribeSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsResubscribeSample.js new file mode 100644 index 000000000000..8a0f482379b1 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/organizationsResubscribeSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Resubscribe the Elasticsearch Organization. + * + * @summary Resubscribe the Elasticsearch Organization. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_Resubscribe.json + */ +async function organizationsResubscribe() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.organizations.beginResubscribeAndWait(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await organizationsResubscribe(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/package.json b/sdk/elastic/arm-elastic/samples/v2/javascript/package.json new file mode 100644 index 000000000000..1286fcbac1be --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/package.json @@ -0,0 +1,36 @@ +{ + "name": "@azure-samples/arm-elastic-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=20.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/elastic/arm-elastic" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic", + "cloud" + ], + "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/elastic/arm-elastic", + "dependencies": { + "@azure/arm-elastic": "latest", + "dotenv": "latest", + "@azure/identity": "^4.13.0" + }, + "devDependencies": { + "cross-env": "latest" + } +} diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/sample.env b/sdk/elastic/arm-elastic/samples/v2/javascript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesCreateOrUpdateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..c1d0208c95a2 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesCreateOrUpdateSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained control over observability based on resource tags. + * + * @summary Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained control over observability based on resource tags. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_CreateOrUpdate.json + */ +async function tagRulesCreateOrUpdate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.tagRules.createOrUpdate(resourceGroupName, monitorName, ruleSetName); + console.log(result); +} + +async function main() { + await tagRulesCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesDeleteSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesDeleteSample.js new file mode 100644 index 000000000000..fdcb3ce32fde --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesDeleteSample.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over observability based on resource tags. + * + * @summary Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over observability based on resource tags. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Delete.json + */ +async function tagRulesDelete() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.tagRules.beginDeleteAndWait( + resourceGroupName, + monitorName, + ruleSetName, + ); + console.log(result); +} + +async function main() { + await tagRulesDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesGetSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesGetSample.js new file mode 100644 index 000000000000..fdb4307b062c --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesGetSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Get detailed information about a tag rule set for a given Elastic monitor resource. + * + * @summary Get detailed information about a tag rule set for a given Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Get.json + */ +async function tagRulesGet() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.tagRules.get(resourceGroupName, monitorName, ruleSetName); + console.log(result); +} + +async function main() { + await tagRulesGet(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesListSample.js new file mode 100644 index 000000000000..9b1dd777ee48 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/tagRulesListSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all tag rules for a given Elastic monitor resource, helping you manage fine-grained control over observability based on resource tags. + * + * @summary List all tag rules for a given Elastic monitor resource, helping you manage fine-grained control over observability based on resource tags. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_List.json + */ +async function tagRulesList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tagRules.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await tagRulesList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/trafficFiltersDeleteSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/trafficFiltersDeleteSample.js new file mode 100644 index 000000000000..99e16e70308d --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/trafficFiltersDeleteSample.js @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Delete an existing traffic filter associated with your Elastic monitor resource, removing its network traffic control capabilities. + * + * @summary Delete an existing traffic filter associated with your Elastic monitor resource, removing its network traffic control capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TrafficFilters_Delete.json + */ +async function trafficFiltersDelete() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; + const options = { rulesetId }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.trafficFilters.delete(resourceGroupName, monitorName, options); + console.log(result); +} + +async function main() { + await trafficFiltersDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/upgradableVersionsDetailsSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/upgradableVersionsDetailsSample.js new file mode 100644 index 000000000000..e5efc2e32165 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/upgradableVersionsDetailsSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all upgradable versions for your Elastic monitor resource, helping you plan and execute upgrades. + * + * @summary List all upgradable versions for your Elastic monitor resource, helping you plan and execute upgrades. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/UpgradableVersions_Details.json + */ +async function upgradableVersionsDetails() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.upgradableVersions.details(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await upgradableVersionsDetails(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/vmCollectionUpdateSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/vmCollectionUpdateSample.js new file mode 100644 index 000000000000..36520d6830b5 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/vmCollectionUpdateSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * + * @summary Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMCollection_Update.json + */ +async function vmCollectionUpdate() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.vMCollection.update(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await vmCollectionUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/vmHostListSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/vmHostListSample.js new file mode 100644 index 000000000000..b49280b41340 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/vmHostListSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List all VM resources currently being monitored by the Elastic monitor resource, helping you manage observability. + * + * @summary List all VM resources currently being monitored by the Elastic monitor resource, helping you manage observability. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMHost_List.json + */ +async function vmHostList() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.vMHost.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + await vmHostList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/javascript/vmIngestionDetailsSample.js b/sdk/elastic/arm-elastic/samples/v2/javascript/vmIngestionDetailsSample.js new file mode 100644 index 000000000000..676e60bbef1b --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/javascript/vmIngestionDetailsSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { MicrosoftElastic } = require("@azure/arm-elastic"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv/config"); + +/** + * This sample demonstrates how to List detailed information about VM ingestion that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * + * @summary List detailed information about VM ingestion that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMIngestion_Details.json + */ +async function vmIngestionDetails() { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.vMIngestion.details(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + await vmIngestionDetails(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/README.md b/sdk/elastic/arm-elastic/samples/v2/typescript/README.md new file mode 100644 index 000000000000..3b65e26f55fe --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/README.md @@ -0,0 +1,147 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [allTrafficFiltersListSample.ts][alltrafficfilterslistsample] | List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AllTrafficFilters_list.json | +| [associateTrafficFilterAssociateSample.ts][associatetrafficfilterassociatesample] | Associate a traffic filter with your Elastic monitor resource to control and manage network traffic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociateTrafficFilter_Update.json | +| [billingInfoGetSample.ts][billinginfogetsample] | Retrieve marketplace and organization billing information mapped to the given Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/BillingInfo_Get.json | +| [connectedPartnerResourcesListSample.ts][connectedpartnerresourceslistsample] | List all active deployments associated with the marketplace subscription linked to the given Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ConnectedPartnerResources_List.json | +| [createAndAssociateIPFilterCreateSample.ts][createandassociateipfiltercreatesample] | Create and associate an IP filter with your Elastic monitor resource to control and manage network traffic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/IPTrafficFilter_Create.json | +| [createAndAssociatePlFilterCreateSample.ts][createandassociateplfiltercreatesample] | Create and associate a PL filter with your Elastic monitor resource to control and manage network traffic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/PrivateLinkTrafficFilters_Create.json | +| [deploymentInfoListSample.ts][deploymentinfolistsample] | Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DeploymentInfo_List.json | +| [detachAndDeleteTrafficFilterDeleteSample.ts][detachanddeletetrafficfilterdeletesample] | Detach and delete an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachAndDeleteTrafficFilter_Delete.json | +| [detachTrafficFilterUpdateSample.ts][detachtrafficfilterupdatesample] | Detach an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachTrafficFilters_Update.json | +| [elasticVersionsListSample.ts][elasticversionslistsample] | Retrieve a list of all available Elastic versions for a specified region, helping you choose the best version for your deployment. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ElasticVersions_List.json | +| [externalUserCreateOrUpdateSample.ts][externalusercreateorupdatesample] | Create or update external user configurations for your Elastic monitor resource, enabling access and management by external users. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ExternalUserInfo.json | +| [listAssociatedTrafficFiltersListSample.ts][listassociatedtrafficfilterslistsample] | List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociatedFiltersForDeployment_list.json | +| [monitorUpgradeSample.ts][monitorupgradesample] | Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitor_Upgrade.json | +| [monitoredResourcesListSample.ts][monitoredresourceslistsample] | List all resources currently being monitored by the Elastic monitor resource, helping you manage observability. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredResources_List.json | +| [monitoredSubscriptionsCreateorUpdateSample.ts][monitoredsubscriptionscreateorupdatesample] | Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and monitoring. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_CreateorUpdate.json | +| [monitoredSubscriptionsDeleteSample.ts][monitoredsubscriptionsdeletesample] | Delete subscriptions being monitored by the Elastic monitor resource, removing their observability and monitoring capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Delete.json | +| [monitoredSubscriptionsGetSample.ts][monitoredsubscriptionsgetsample] | Get detailed information about all subscriptions currently being monitored by the Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Get.json | +| [monitoredSubscriptionsListSample.ts][monitoredsubscriptionslistsample] | List all subscriptions currently being monitored by the Elastic monitor resource, helping you manage observability. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_List.json | +| [monitoredSubscriptionsUpdateSample.ts][monitoredsubscriptionsupdatesample] | Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Update.json | +| [monitorsCreateSample.ts][monitorscreatesample] | Create a new Elastic monitor resource in your Azure subscription, enabling observability and monitoring of your Azure resources through Elastic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Create.json | +| [monitorsDeleteSample.ts][monitorsdeletesample] | Delete an existing Elastic monitor resource from your Azure subscription, removing its observability and monitoring capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Delete.json | +| [monitorsGetSample.ts][monitorsgetsample] | Get detailed properties of a specific Elastic monitor resource, helping you manage observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Get.json | +| [monitorsListByResourceGroupSample.ts][monitorslistbyresourcegroupsample] | List all Elastic monitor resources within a specified resource group of the subscription, helping you audit and manage your monitoring setup. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_ListByResourceGroup.json | +| [monitorsListSample.ts][monitorslistsample] | List all Elastic monitor resources within a specified subscription, helping you audit and manage your monitoring setup. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_List.json | +| [monitorsUpdateSample.ts][monitorsupdatesample] | Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Update.json | +| [openAiCreateOrUpdateSample.ts][openaicreateorupdatesample] | Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling advanced AI-driven observability and monitoring. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_CreateOrUpdate.json | +| [openAiDeleteSample.ts][openaideletesample] | Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven observability and monitoring capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Delete.json | +| [openAiGetSample.ts][openaigetsample] | Get detailed information about OpenAI integration rules for a given Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Get.json | +| [openAiGetStatusSample.ts][openaigetstatussample] | Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_GetStatus.json | +| [openAiListSample.ts][openailistsample] | List all OpenAI integration rules for a given Elastic monitor resource, helping you manage AI-driven observability and monitoring. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_List.json | +| [operationsListSample.ts][operationslistsample] | List all operations provided by Microsoft.Elastic. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Operations_List.json | +| [organizationsGetApiKeySample.ts][organizationsgetapikeysample] | Fetch the User API Key from the internal database, if it was generated and stored during the creation of the Elasticsearch Organization. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetApiKey.json | +| [organizationsGetElasticToAzureSubscriptionMappingSample.ts][organizationsgetelastictoazuresubscriptionmappingsample] | Retrieve mapping details between the Elastic Organization and Azure Subscription for the logged-in user. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetElasticToAzureSubscriptionMapping.json | +| [organizationsResubscribeSample.ts][organizationsresubscribesample] | Resubscribe the Elasticsearch Organization. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_Resubscribe.json | +| [tagRulesCreateOrUpdateSample.ts][tagrulescreateorupdatesample] | Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained control over observability based on resource tags. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_CreateOrUpdate.json | +| [tagRulesDeleteSample.ts][tagrulesdeletesample] | Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over observability based on resource tags. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Delete.json | +| [tagRulesGetSample.ts][tagrulesgetsample] | Get detailed information about a tag rule set for a given Elastic monitor resource. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Get.json | +| [tagRulesListSample.ts][tagruleslistsample] | List all tag rules for a given Elastic monitor resource, helping you manage fine-grained control over observability based on resource tags. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_List.json | +| [trafficFiltersDeleteSample.ts][trafficfiltersdeletesample] | Delete an existing traffic filter associated with your Elastic monitor resource, removing its network traffic control capabilities. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TrafficFilters_Delete.json | +| [upgradableVersionsDetailsSample.ts][upgradableversionsdetailssample] | List all upgradable versions for your Elastic monitor resource, helping you plan and execute upgrades. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/UpgradableVersions_Details.json | +| [vmCollectionUpdateSample.ts][vmcollectionupdatesample] | Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMCollection_Update.json | +| [vmHostListSample.ts][vmhostlistsample] | List all VM resources currently being monitored by the Elastic monitor resource, helping you manage observability. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMHost_List.json | +| [vmIngestionDetailsSample.ts][vmingestiondetailssample] | List detailed information about VM ingestion that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMIngestion_Details.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/allTrafficFiltersListSample.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 +cross-env ELASTIC_SUBSCRIPTION_ID="" ELASTIC_RESOURCE_GROUP="" node dist/allTrafficFiltersListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[alltrafficfilterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/allTrafficFiltersListSample.ts +[associatetrafficfilterassociatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/associateTrafficFilterAssociateSample.ts +[billinginfogetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/billingInfoGetSample.ts +[connectedpartnerresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/connectedPartnerResourcesListSample.ts +[createandassociateipfiltercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/createAndAssociateIPFilterCreateSample.ts +[createandassociateplfiltercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/createAndAssociatePlFilterCreateSample.ts +[deploymentinfolistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/deploymentInfoListSample.ts +[detachanddeletetrafficfilterdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/detachAndDeleteTrafficFilterDeleteSample.ts +[detachtrafficfilterupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/detachTrafficFilterUpdateSample.ts +[elasticversionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/elasticVersionsListSample.ts +[externalusercreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/externalUserCreateOrUpdateSample.ts +[listassociatedtrafficfilterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/listAssociatedTrafficFiltersListSample.ts +[monitorupgradesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorUpgradeSample.ts +[monitoredresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredResourcesListSample.ts +[monitoredsubscriptionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsCreateorUpdateSample.ts +[monitoredsubscriptionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsDeleteSample.ts +[monitoredsubscriptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsGetSample.ts +[monitoredsubscriptionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsListSample.ts +[monitoredsubscriptionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsUpdateSample.ts +[monitorscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsCreateSample.ts +[monitorsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsDeleteSample.ts +[monitorsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsGetSample.ts +[monitorslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsListByResourceGroupSample.ts +[monitorslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsListSample.ts +[monitorsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsUpdateSample.ts +[openaicreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiCreateOrUpdateSample.ts +[openaideletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiDeleteSample.ts +[openaigetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiGetSample.ts +[openaigetstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiGetStatusSample.ts +[openailistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiListSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/operationsListSample.ts +[organizationsgetapikeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsGetApiKeySample.ts +[organizationsgetelastictoazuresubscriptionmappingsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsGetElasticToAzureSubscriptionMappingSample.ts +[organizationsresubscribesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsResubscribeSample.ts +[tagrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesCreateOrUpdateSample.ts +[tagrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesDeleteSample.ts +[tagrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesGetSample.ts +[tagruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesListSample.ts +[trafficfiltersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/trafficFiltersDeleteSample.ts +[upgradableversionsdetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/upgradableVersionsDetailsSample.ts +[vmcollectionupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmCollectionUpdateSample.ts +[vmhostlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmHostListSample.ts +[vmingestiondetailssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmIngestionDetailsSample.ts +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-elastic?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/elastic/arm-elastic/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/package.json b/sdk/elastic/arm-elastic/samples/v2/typescript/package.json new file mode 100644 index 000000000000..83b41d6c8600 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/package.json @@ -0,0 +1,43 @@ +{ + "name": "@azure-samples/arm-elastic-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=20.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/elastic/arm-elastic" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic", + "cloud" + ], + "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/elastic/arm-elastic", + "dependencies": { + "@azure/arm-elastic": "latest", + "dotenv": "latest", + "@azure/identity": "^4.13.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "cross-env": "latest", + "rimraf": "latest", + "typescript": "~5.9.3" + } +} diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/sample.env b/sdk/elastic/arm-elastic/samples/v2/typescript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/allTrafficFiltersListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/allTrafficFiltersListSample.ts new file mode 100644 index 000000000000..0698aa0fb033 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/allTrafficFiltersListSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. + * + * @summary List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AllTrafficFilters_list.json + */ +async function allTrafficFiltersList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.allTrafficFilters.list( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await allTrafficFiltersList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/associateTrafficFilterAssociateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/associateTrafficFilterAssociateSample.ts new file mode 100644 index 000000000000..337113fda7ca --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/associateTrafficFilterAssociateSample.ts @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + AssociateTrafficFilterAssociateOptionalParams} from "@azure/arm-elastic"; +import { + MicrosoftElastic, +} from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Associate a traffic filter with your Elastic monitor resource to control and manage network traffic. + * + * @summary Associate a traffic filter with your Elastic monitor resource to control and manage network traffic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociateTrafficFilter_Update.json + */ +async function associateTrafficFilterAssociate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; + const options: AssociateTrafficFilterAssociateOptionalParams = { rulesetId }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.associateTrafficFilter.beginAssociateAndWait( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main(): Promise { + await associateTrafficFilterAssociate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/billingInfoGetSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/billingInfoGetSample.ts new file mode 100644 index 000000000000..a2dce1dbeec8 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/billingInfoGetSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Retrieve marketplace and organization billing information mapped to the given Elastic monitor resource. + * + * @summary Retrieve marketplace and organization billing information mapped to the given Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/BillingInfo_Get.json + */ +async function billingInfoGet(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.billingInfo.get(resourceGroupName, monitorName); + console.log(result); +} + +async function main(): Promise { + await billingInfoGet(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/connectedPartnerResourcesListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/connectedPartnerResourcesListSample.ts new file mode 100644 index 000000000000..04a334a465cd --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/connectedPartnerResourcesListSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all active deployments associated with the marketplace subscription linked to the given Elastic monitor resource. + * + * @summary List all active deployments associated with the marketplace subscription linked to the given Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ConnectedPartnerResources_List.json + */ +async function connectedPartnerResourcesList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.connectedPartnerResources.list( + resourceGroupName, + monitorName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await connectedPartnerResourcesList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/createAndAssociateIPFilterCreateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/createAndAssociateIPFilterCreateSample.ts new file mode 100644 index 000000000000..932325b65329 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/createAndAssociateIPFilterCreateSample.ts @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + CreateAndAssociateIPFilterCreateOptionalParams} from "@azure/arm-elastic"; +import { + MicrosoftElastic, +} from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Create and associate an IP filter with your Elastic monitor resource to control and manage network traffic. + * + * @summary Create and associate an IP filter with your Elastic monitor resource to control and manage network traffic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/IPTrafficFilter_Create.json + */ +async function createAndAssociateIPFilterCreate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const ips = "192.168.131.0, 192.168.132.6/22"; + const options: CreateAndAssociateIPFilterCreateOptionalParams = { ips }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.createAndAssociateIPFilter.beginCreateAndWait( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main(): Promise { + await createAndAssociateIPFilterCreate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/createAndAssociatePlFilterCreateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/createAndAssociatePlFilterCreateSample.ts new file mode 100644 index 000000000000..d184603412bd --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/createAndAssociatePlFilterCreateSample.ts @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + CreateAndAssociatePLFilterCreateOptionalParams} from "@azure/arm-elastic"; +import { + MicrosoftElastic, +} from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Create and associate a PL filter with your Elastic monitor resource to control and manage network traffic. + * + * @summary Create and associate a PL filter with your Elastic monitor resource to control and manage network traffic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/PrivateLinkTrafficFilters_Create.json + */ +async function createAndAssociatePlFilterCreate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const privateEndpointGuid = "fdb54d3b-e85e-4d08-8958-0d2f7g523df9"; + const privateEndpointName = "myPrivateEndpoint"; + const options: CreateAndAssociatePLFilterCreateOptionalParams = { + privateEndpointGuid, + privateEndpointName, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.createAndAssociatePLFilter.beginCreateAndWait( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main(): Promise { + await createAndAssociatePlFilterCreate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/deploymentInfoListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/deploymentInfoListSample.ts new file mode 100644 index 000000000000..ed44ed24e1d5 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/deploymentInfoListSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor resource. + * + * @summary Fetch detailed information about Elastic cloud deployments corresponding to the Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DeploymentInfo_List.json + */ +async function deploymentInfoList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.deploymentInfo.list( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await deploymentInfoList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/detachAndDeleteTrafficFilterDeleteSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/detachAndDeleteTrafficFilterDeleteSample.ts new file mode 100644 index 000000000000..ed8b3cd575d8 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/detachAndDeleteTrafficFilterDeleteSample.ts @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + DetachAndDeleteTrafficFilterDeleteOptionalParams} from "@azure/arm-elastic"; +import { + MicrosoftElastic, +} from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Detach and delete an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. + * + * @summary Detach and delete an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachAndDeleteTrafficFilter_Delete.json + */ +async function detachAndDeleteTrafficFilterDelete(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; + const options: DetachAndDeleteTrafficFilterDeleteOptionalParams = { + rulesetId, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.detachAndDeleteTrafficFilter.delete( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main(): Promise { + await detachAndDeleteTrafficFilterDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/detachTrafficFilterUpdateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/detachTrafficFilterUpdateSample.ts new file mode 100644 index 000000000000..c035fbcdcb07 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/detachTrafficFilterUpdateSample.ts @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + DetachTrafficFilterUpdateOptionalParams} from "@azure/arm-elastic"; +import { + MicrosoftElastic, +} from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Detach an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. + * + * @summary Detach an existing traffic filter from your Elastic monitor resource, removing its network traffic control capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/DetachTrafficFilters_Update.json + */ +async function detachTrafficFilterUpdate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; + const options: DetachTrafficFilterUpdateOptionalParams = { rulesetId }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.detachTrafficFilter.beginUpdateAndWait( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main(): Promise { + await detachTrafficFilterUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/elasticVersionsListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/elasticVersionsListSample.ts new file mode 100644 index 000000000000..efb7fdb47764 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/elasticVersionsListSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Retrieve a list of all available Elastic versions for a specified region, helping you choose the best version for your deployment. + * + * @summary Retrieve a list of all available Elastic versions for a specified region, helping you choose the best version for your deployment. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ElasticVersions_List.json + */ +async function elasticVersionsList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const region = "myregion"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.elasticVersions.list(region)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await elasticVersionsList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/externalUserCreateOrUpdateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/externalUserCreateOrUpdateSample.ts new file mode 100644 index 000000000000..86b22696845c --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/externalUserCreateOrUpdateSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Create or update external user configurations for your Elastic monitor resource, enabling access and management by external users. + * + * @summary Create or update external user configurations for your Elastic monitor resource, enabling access and management by external users. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/ExternalUserInfo.json + */ +async function externalUserCreateOrUpdate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.externalUser.createOrUpdate( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await externalUserCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/listAssociatedTrafficFiltersListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/listAssociatedTrafficFiltersListSample.ts new file mode 100644 index 000000000000..618f11bb2c0b --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/listAssociatedTrafficFiltersListSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. + * + * @summary List all traffic filters associated with your Elastic monitor resource, helping you manage network traffic control. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/AssociatedFiltersForDeployment_list.json + */ +async function listAssociatedTrafficFiltersList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.listAssociatedTrafficFilters.list( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await listAssociatedTrafficFiltersList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorUpgradeSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorUpgradeSample.ts new file mode 100644 index 000000000000..ade9c9393a59 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorUpgradeSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and performance. + * + * @summary Upgrade the Elastic monitor resource to a newer version, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitor_Upgrade.json + */ +async function monitorUpgrade(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitor.beginUpgradeAndWait( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await monitorUpgrade(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredResourcesListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredResourcesListSample.ts new file mode 100644 index 000000000000..ecb873f2ceef --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredResourcesListSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all resources currently being monitored by the Elastic monitor resource, helping you manage observability. + * + * @summary List all resources currently being monitored by the Elastic monitor resource, helping you manage observability. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredResources_List.json + */ +async function monitoredResourcesList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.monitoredResources.list( + resourceGroupName, + monitorName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await monitoredResourcesList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsCreateorUpdateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsCreateorUpdateSample.ts new file mode 100644 index 000000000000..3ad69021d384 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsCreateorUpdateSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and monitoring. + * + * @summary Add subscriptions to be monitored by the Elastic monitor resource, enabling observability and monitoring. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_CreateorUpdate.json + */ +async function monitorsAddMonitoredSubscriptions(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitoredSubscriptions.beginCreateorUpdateAndWait( + resourceGroupName, + monitorName, + configurationName, + ); + console.log(result); +} + +async function main(): Promise { + await monitorsAddMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsDeleteSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsDeleteSample.ts new file mode 100644 index 000000000000..37d2d5831a6e --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsDeleteSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Delete subscriptions being monitored by the Elastic monitor resource, removing their observability and monitoring capabilities. + * + * @summary Delete subscriptions being monitored by the Elastic monitor resource, removing their observability and monitoring capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Delete.json + */ +async function monitorsDeleteMonitoredSubscriptions(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitoredSubscriptions.beginDeleteAndWait( + resourceGroupName, + monitorName, + configurationName, + ); + console.log(result); +} + +async function main(): Promise { + await monitorsDeleteMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsGetSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsGetSample.ts new file mode 100644 index 000000000000..90358877239d --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsGetSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Get detailed information about all subscriptions currently being monitored by the Elastic monitor resource. + * + * @summary Get detailed information about all subscriptions currently being monitored by the Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Get.json + */ +async function monitorsGetMonitoredSubscriptions(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitoredSubscriptions.get( + resourceGroupName, + monitorName, + configurationName, + ); + console.log(result); +} + +async function main(): Promise { + await monitorsGetMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsListSample.ts new file mode 100644 index 000000000000..a22939b499a0 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsListSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all subscriptions currently being monitored by the Elastic monitor resource, helping you manage observability. + * + * @summary List all subscriptions currently being monitored by the Elastic monitor resource, helping you manage observability. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_List.json + */ +async function monitorsGetMonitoredSubscriptions(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.monitoredSubscriptions.list( + resourceGroupName, + monitorName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await monitorsGetMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsUpdateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsUpdateSample.ts new file mode 100644 index 000000000000..eb107622f055 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitoredSubscriptionsUpdateSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * + * @summary Update subscriptions to be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/MonitoredSubscriptions_Update.json + */ +async function monitorsUpdateMonitoredSubscriptions(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const configurationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitoredSubscriptions.beginUpdateAndWait( + resourceGroupName, + monitorName, + configurationName, + ); + console.log(result); +} + +async function main(): Promise { + await monitorsUpdateMonitoredSubscriptions(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsCreateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsCreateSample.ts new file mode 100644 index 000000000000..1d2e942fa0d0 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsCreateSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Create a new Elastic monitor resource in your Azure subscription, enabling observability and monitoring of your Azure resources through Elastic. + * + * @summary Create a new Elastic monitor resource in your Azure subscription, enabling observability and monitoring of your Azure resources through Elastic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Create.json + */ +async function monitorsCreate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitors.beginCreateAndWait( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await monitorsCreate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsDeleteSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsDeleteSample.ts new file mode 100644 index 000000000000..b39e9779e804 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsDeleteSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Delete an existing Elastic monitor resource from your Azure subscription, removing its observability and monitoring capabilities. + * + * @summary Delete an existing Elastic monitor resource from your Azure subscription, removing its observability and monitoring capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Delete.json + */ +async function monitorsDelete(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await monitorsDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsGetSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsGetSample.ts new file mode 100644 index 000000000000..6af9fb9df91b --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsGetSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Get detailed properties of a specific Elastic monitor resource, helping you manage observability and performance. + * + * @summary Get detailed properties of a specific Elastic monitor resource, helping you manage observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Get.json + */ +async function monitorsGet(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitors.get(resourceGroupName, monitorName); + console.log(result); +} + +async function main(): Promise { + await monitorsGet(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsListByResourceGroupSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsListByResourceGroupSample.ts new file mode 100644 index 000000000000..a2d307bc6b0f --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsListByResourceGroupSample.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all Elastic monitor resources within a specified resource group of the subscription, helping you audit and manage your monitoring setup. + * + * @summary List all Elastic monitor resources within a specified resource group of the subscription, helping you audit and manage your monitoring setup. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_ListByResourceGroup.json + */ +async function monitorsListByResourceGroup(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.monitors.listByResourceGroup( + resourceGroupName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await monitorsListByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsListSample.ts new file mode 100644 index 000000000000..38b609e248ff --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsListSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all Elastic monitor resources within a specified subscription, helping you audit and manage your monitoring setup. + * + * @summary List all Elastic monitor resources within a specified subscription, helping you audit and manage your monitoring setup. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_List.json + */ +async function monitorsList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.monitors.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await monitorsList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsUpdateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsUpdateSample.ts new file mode 100644 index 000000000000..4d1821f91db9 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/monitorsUpdateSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal observability and performance. + * + * @summary Update an existing Elastic monitor resource in your Azure subscription, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Monitors_Update.json + */ +async function monitorsUpdate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.monitors.beginUpdateAndWait( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await monitorsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiCreateOrUpdateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiCreateOrUpdateSample.ts new file mode 100644 index 000000000000..57f0f61e2d03 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiCreateOrUpdateSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling advanced AI-driven observability and monitoring. + * + * @summary Create or update an OpenAI integration rule for a given Elastic monitor resource, enabling advanced AI-driven observability and monitoring. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_CreateOrUpdate.json + */ +async function openAiCreateOrUpdate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const integrationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.openAI.createOrUpdate( + resourceGroupName, + monitorName, + integrationName, + ); + console.log(result); +} + +async function main(): Promise { + await openAiCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiDeleteSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiDeleteSample.ts new file mode 100644 index 000000000000..d292e95222eb --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiDeleteSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven observability and monitoring capabilities. + * + * @summary Delete an OpenAI integration rule for a given Elastic monitor resource, removing AI-driven observability and monitoring capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Delete.json + */ +async function openAiDelete(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const integrationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.openAI.delete( + resourceGroupName, + monitorName, + integrationName, + ); + console.log(result); +} + +async function main(): Promise { + await openAiDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiGetSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiGetSample.ts new file mode 100644 index 000000000000..9f20ecb302a6 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiGetSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Get detailed information about OpenAI integration rules for a given Elastic monitor resource. + * + * @summary Get detailed information about OpenAI integration rules for a given Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_Get.json + */ +async function openAiGet(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const integrationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.openAI.get( + resourceGroupName, + monitorName, + integrationName, + ); + console.log(result); +} + +async function main(): Promise { + await openAiGet(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiGetStatusSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiGetStatusSample.ts new file mode 100644 index 000000000000..6df5c88e1937 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiGetStatusSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal observability and performance. + * + * @summary Get the status of OpenAI integration for a given Elastic monitor resource, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_GetStatus.json + */ +async function openAiGetStatus(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const integrationName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.openAI.getStatus( + resourceGroupName, + monitorName, + integrationName, + ); + console.log(result); +} + +async function main(): Promise { + await openAiGetStatus(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiListSample.ts new file mode 100644 index 000000000000..b402af24c3e5 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/openAiListSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all OpenAI integration rules for a given Elastic monitor resource, helping you manage AI-driven observability and monitoring. + * + * @summary List all OpenAI integration rules for a given Elastic monitor resource, helping you manage AI-driven observability and monitoring. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/OpenAI_List.json + */ +async function openAiList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.openAI.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await openAiList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/operationsListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..e39cb0f2b4e2 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/operationsListSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all operations provided by Microsoft.Elastic. + * + * @summary List all operations provided by Microsoft.Elastic. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Operations_List.json + */ +async function operationsList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await operationsList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsGetApiKeySample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsGetApiKeySample.ts new file mode 100644 index 000000000000..631d9b251612 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsGetApiKeySample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Fetch the User API Key from the internal database, if it was generated and stored during the creation of the Elasticsearch Organization. + * + * @summary Fetch the User API Key from the internal database, if it was generated and stored during the creation of the Elasticsearch Organization. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetApiKey.json + */ +async function organizationsGetApiKey(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.organizations.getApiKey(); + console.log(result); +} + +async function main(): Promise { + await organizationsGetApiKey(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsGetElasticToAzureSubscriptionMappingSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsGetElasticToAzureSubscriptionMappingSample.ts new file mode 100644 index 000000000000..7cc199938281 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsGetElasticToAzureSubscriptionMappingSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Retrieve mapping details between the Elastic Organization and Azure Subscription for the logged-in user. + * + * @summary Retrieve mapping details between the Elastic Organization and Azure Subscription for the logged-in user. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_GetElasticToAzureSubscriptionMapping.json + */ +async function organizationsGetElasticToAzureSubscriptionMapping(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = + await client.organizations.getElasticToAzureSubscriptionMapping(); + console.log(result); +} + +async function main(): Promise { + await organizationsGetElasticToAzureSubscriptionMapping(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsResubscribeSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsResubscribeSample.ts new file mode 100644 index 000000000000..ff6834e32bb7 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/organizationsResubscribeSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Resubscribe the Elasticsearch Organization. + * + * @summary Resubscribe the Elasticsearch Organization. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/Organizations_Resubscribe.json + */ +async function organizationsResubscribe(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.organizations.beginResubscribeAndWait( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await organizationsResubscribe(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesCreateOrUpdateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..5806fa3c0ff4 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesCreateOrUpdateSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained control over observability based on resource tags. + * + * @summary Create or update a tag rule set for a given Elastic monitor resource, enabling fine-grained control over observability based on resource tags. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_CreateOrUpdate.json + */ +async function tagRulesCreateOrUpdate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.tagRules.createOrUpdate( + resourceGroupName, + monitorName, + ruleSetName, + ); + console.log(result); +} + +async function main(): Promise { + await tagRulesCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesDeleteSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesDeleteSample.ts new file mode 100644 index 000000000000..0080a370431f --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesDeleteSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over observability based on resource tags. + * + * @summary Delete a tag rule set for a given Elastic monitor resource, removing fine-grained control over observability based on resource tags. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Delete.json + */ +async function tagRulesDelete(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.tagRules.beginDeleteAndWait( + resourceGroupName, + monitorName, + ruleSetName, + ); + console.log(result); +} + +async function main(): Promise { + await tagRulesDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesGetSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesGetSample.ts new file mode 100644 index 000000000000..78e1e8a9beff --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesGetSample.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Get detailed information about a tag rule set for a given Elastic monitor resource. + * + * @summary Get detailed information about a tag rule set for a given Elastic monitor resource. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_Get.json + */ +async function tagRulesGet(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const ruleSetName = "default"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.tagRules.get( + resourceGroupName, + monitorName, + ruleSetName, + ); + console.log(result); +} + +async function main(): Promise { + await tagRulesGet(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesListSample.ts new file mode 100644 index 000000000000..b5c2e4f36dc4 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/tagRulesListSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all tag rules for a given Elastic monitor resource, helping you manage fine-grained control over observability based on resource tags. + * + * @summary List all tag rules for a given Elastic monitor resource, helping you manage fine-grained control over observability based on resource tags. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TagRules_List.json + */ +async function tagRulesList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tagRules.list( + resourceGroupName, + monitorName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await tagRulesList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/trafficFiltersDeleteSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/trafficFiltersDeleteSample.ts new file mode 100644 index 000000000000..bf14b3deb9bf --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/trafficFiltersDeleteSample.ts @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + TrafficFiltersDeleteOptionalParams} from "@azure/arm-elastic"; +import { + MicrosoftElastic, +} from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Delete an existing traffic filter associated with your Elastic monitor resource, removing its network traffic control capabilities. + * + * @summary Delete an existing traffic filter associated with your Elastic monitor resource, removing its network traffic control capabilities. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/TrafficFilters_Delete.json + */ +async function trafficFiltersDelete(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; + const options: TrafficFiltersDeleteOptionalParams = { rulesetId }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.trafficFilters.delete( + resourceGroupName, + monitorName, + options, + ); + console.log(result); +} + +async function main(): Promise { + await trafficFiltersDelete(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/upgradableVersionsDetailsSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/upgradableVersionsDetailsSample.ts new file mode 100644 index 000000000000..ab4ce49374c2 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/upgradableVersionsDetailsSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all upgradable versions for your Elastic monitor resource, helping you plan and execute upgrades. + * + * @summary List all upgradable versions for your Elastic monitor resource, helping you plan and execute upgrades. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/UpgradableVersions_Details.json + */ +async function upgradableVersionsDetails(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.upgradableVersions.details( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await upgradableVersionsDetails(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmCollectionUpdateSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmCollectionUpdateSample.ts new file mode 100644 index 000000000000..317b10de0ca2 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmCollectionUpdateSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * + * @summary Update the VM details that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMCollection_Update.json + */ +async function vmCollectionUpdate(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.vMCollection.update( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await vmCollectionUpdate(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmHostListSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmHostListSample.ts new file mode 100644 index 000000000000..9b4c8fa32709 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmHostListSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List all VM resources currently being monitored by the Elastic monitor resource, helping you manage observability. + * + * @summary List all VM resources currently being monitored by the Elastic monitor resource, helping you manage observability. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMHost_List.json + */ +async function vmHostList(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.vMHost.list(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main(): Promise { + await vmHostList(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmIngestionDetailsSample.ts b/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmIngestionDetailsSample.ts new file mode 100644 index 000000000000..c95d96686be1 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/src/vmIngestionDetailsSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { MicrosoftElastic } from "@azure/arm-elastic"; +import { DefaultAzureCredential } from "@azure/identity"; +import "dotenv/config"; + +/** + * This sample demonstrates how to List detailed information about VM ingestion that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * + * @summary List detailed information about VM ingestion that will be monitored by the Elastic monitor resource, ensuring optimal observability and performance. + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2025-06-01/examples/VMIngestion_Details.json + */ +async function vmIngestionDetails(): Promise { + const subscriptionId = + process.env["ELASTIC_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["ELASTIC_RESOURCE_GROUP"] || "myResourceGroup"; + const monitorName = "myMonitor"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftElastic(credential, subscriptionId); + const result = await client.vMIngestion.details( + resourceGroupName, + monitorName, + ); + console.log(result); +} + +async function main(): Promise { + await vmIngestionDetails(); +} + +main().catch(console.error); diff --git a/sdk/elastic/arm-elastic/samples/v2/typescript/tsconfig.json b/sdk/elastic/arm-elastic/samples/v2/typescript/tsconfig.json new file mode 100644 index 000000000000..400db87cf648 --- /dev/null +++ b/sdk/elastic/arm-elastic/samples/v2/typescript/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ES2023", + "module": "commonjs", + "lib": [], + "importHelpers": true, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node10", + "esModuleInterop": true, + "outDir": "./dist", + "resolveJsonModule": true + }, + "include": [ + "./src" + ] +} diff --git a/sdk/elastic/arm-elastic/src/microsoftElastic.ts b/sdk/elastic/arm-elastic/src/microsoftElastic.ts index b8c5aac20b82..026f47b622fd 100644 --- a/sdk/elastic/arm-elastic/src/microsoftElastic.ts +++ b/sdk/elastic/arm-elastic/src/microsoftElastic.ts @@ -96,7 +96,7 @@ export class MicrosoftElastic extends coreClient.ServiceClient { credential: credentials, }; - const packageDetails = `azsdk-js-arm-elastic/2.0.0`; + const packageDetails = `azsdk-js-arm-elastic/2.0.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`