diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/README.md b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/README.md new file mode 100644 index 000000000000..bf701c39da60 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/README.md @@ -0,0 +1,238 @@ +# client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [availableWorkloadProfilesGetSample.js][availableworkloadprofilesgetsample] | Get all available workload profiles for a location. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AvailableWorkloadProfiles_Get.json | +| [billingMetersGetSample.js][billingmetersgetsample] | Get all billingMeters for a location. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/BillingMeters_Get.json | +| [certificatesCreateOrUpdateSample.js][certificatescreateorupdatesample] | Create or Update a Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_CreateOrUpdate.json | +| [certificatesDeleteSample.js][certificatesdeletesample] | Deletes the specified Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Delete.json | +| [certificatesGetSample.js][certificatesgetsample] | Get the specified Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Get.json | +| [certificatesListSample.js][certificateslistsample] | Get the Certificates in a given managed environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_ListByManagedEnvironment.json | +| [certificatesUpdateSample.js][certificatesupdatesample] | Patches a certificate. Currently only patching of tags is supported x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_Patch.json | +| [connectedEnvironmentsCertificatesCreateOrUpdateSample.js][connectedenvironmentscertificatescreateorupdatesample] | Create or Update a Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json | +| [connectedEnvironmentsCertificatesDeleteSample.js][connectedenvironmentscertificatesdeletesample] | Deletes the specified Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Delete.json | +| [connectedEnvironmentsCertificatesGetSample.js][connectedenvironmentscertificatesgetsample] | Get the specified Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Get.json | +| [connectedEnvironmentsCertificatesListSample.js][connectedenvironmentscertificateslistsample] | Get the Certificates in a given connected environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json | +| [connectedEnvironmentsCertificatesUpdateSample.js][connectedenvironmentscertificatesupdatesample] | Patches a certificate. Currently only patching of tags is supported x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_Patch.json | +| [connectedEnvironmentsCheckNameAvailabilitySample.js][connectedenvironmentschecknameavailabilitysample] | Checks if resource connectedEnvironmentName is available. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json | +| [connectedEnvironmentsCreateOrUpdateSample.js][connectedenvironmentscreateorupdatesample] | Creates or updates an connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_CreateOrUpdate.json | +| [connectedEnvironmentsDaprComponentsCreateOrUpdateSample.js][connectedenvironmentsdaprcomponentscreateorupdatesample] | Creates or updates a Dapr Component in a connected environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json | +| [connectedEnvironmentsDaprComponentsDeleteSample.js][connectedenvironmentsdaprcomponentsdeletesample] | Delete a Dapr Component from a connected environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json | +| [connectedEnvironmentsDaprComponentsGetSample.js][connectedenvironmentsdaprcomponentsgetsample] | Get a dapr component. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json | +| [connectedEnvironmentsDaprComponentsListSample.js][connectedenvironmentsdaprcomponentslistsample] | Get the Dapr Components for a connected environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_List.json | +| [connectedEnvironmentsDaprComponentsListSecretsSample.js][connectedenvironmentsdaprcomponentslistsecretssample] | List secrets for a dapr component x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json | +| [connectedEnvironmentsDeleteSample.js][connectedenvironmentsdeletesample] | Delete an connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Delete.json | +| [connectedEnvironmentsGetSample.js][connectedenvironmentsgetsample] | Get the properties of an connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Get.json | +| [connectedEnvironmentsListByResourceGroupSample.js][connectedenvironmentslistbyresourcegroupsample] | Get all connectedEnvironments in a resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListByResourceGroup.json | +| [connectedEnvironmentsListBySubscriptionSample.js][connectedenvironmentslistbysubscriptionsample] | Get all connectedEnvironments for a subscription. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListBySubscription.json | +| [connectedEnvironmentsStoragesCreateOrUpdateSample.js][connectedenvironmentsstoragescreateorupdatesample] | Create or update storage for a connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json | +| [connectedEnvironmentsStoragesDeleteSample.js][connectedenvironmentsstoragesdeletesample] | Delete storage for a connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Delete.json | +| [connectedEnvironmentsStoragesGetSample.js][connectedenvironmentsstoragesgetsample] | Get storage for a connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Get.json | +| [connectedEnvironmentsStoragesListSample.js][connectedenvironmentsstorageslistsample] | Get all storages for a connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_List.json | +| [connectedEnvironmentsUpdateSample.js][connectedenvironmentsupdatesample] | Patches a Managed Environment. Only patching of tags is supported currently x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Patch.json | +| [containerAppsAuthConfigsCreateOrUpdateSample.js][containerappsauthconfigscreateorupdatesample] | Create or update the AuthConfig for a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_CreateOrUpdate.json | +| [containerAppsAuthConfigsDeleteSample.js][containerappsauthconfigsdeletesample] | Delete a Container App AuthConfig. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Delete.json | +| [containerAppsAuthConfigsGetSample.js][containerappsauthconfigsgetsample] | Get a AuthConfig of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Get.json | +| [containerAppsAuthConfigsListByContainerAppSample.js][containerappsauthconfigslistbycontainerappsample] | Get the Container App AuthConfigs in a given resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_ListByContainer.json | +| [containerAppsCreateOrUpdateSample.js][containerappscreateorupdatesample] | Create or update a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CreateOrUpdate.json | +| [containerAppsDeleteSample.js][containerappsdeletesample] | Delete a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Delete.json | +| [containerAppsDiagnosticsGetDetectorSample.js][containerappsdiagnosticsgetdetectorsample] | Get a diagnostics result of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_Get.json | +| [containerAppsDiagnosticsGetRevisionSample.js][containerappsdiagnosticsgetrevisionsample] | Get a revision of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json | +| [containerAppsDiagnosticsGetRootSample.js][containerappsdiagnosticsgetrootsample] | Get the properties of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json | +| [containerAppsDiagnosticsListDetectorsSample.js][containerappsdiagnosticslistdetectorssample] | Get the list of diagnostics for a given Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_List.json | +| [containerAppsDiagnosticsListRevisionsSample.js][containerappsdiagnosticslistrevisionssample] | Get the Revisions for a given Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json | +| [containerAppsGetAuthTokenSample.js][containerappsgetauthtokensample] | Get auth token for a container app x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_GetAuthToken.json | +| [containerAppsGetSample.js][containerappsgetsample] | Get the properties of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json | +| [containerAppsListByResourceGroupSample.js][containerappslistbyresourcegroupsample] | Get the Container Apps in a given resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListByResourceGroup.json | +| [containerAppsListBySubscriptionSample.js][containerappslistbysubscriptionsample] | Get the Container Apps in a given subscription. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListBySubscription.json | +| [containerAppsListCustomHostNameAnalysisSample.js][containerappslistcustomhostnameanalysissample] | Analyzes a custom hostname for a Container App x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json | +| [containerAppsListSecretsSample.js][containerappslistsecretssample] | List secrets for a container app x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListSecrets.json | +| [containerAppsRevisionReplicasGetReplicaSample.js][containerappsrevisionreplicasgetreplicasample] | Get a replica for a Container App Revision. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_Get.json | +| [containerAppsRevisionReplicasListReplicasSample.js][containerappsrevisionreplicaslistreplicassample] | List replicas for a Container App Revision. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_List.json | +| [containerAppsRevisionsActivateRevisionSample.js][containerappsrevisionsactivaterevisionsample] | Activates a revision for a Container App x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Activate.json | +| [containerAppsRevisionsDeactivateRevisionSample.js][containerappsrevisionsdeactivaterevisionsample] | Deactivates a revision for a Container App x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Deactivate.json | +| [containerAppsRevisionsGetRevisionSample.js][containerappsrevisionsgetrevisionsample] | Get a revision of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json | +| [containerAppsRevisionsListRevisionsSample.js][containerappsrevisionslistrevisionssample] | Get the Revisions for a given Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json | +| [containerAppsRevisionsRestartRevisionSample.js][containerappsrevisionsrestartrevisionsample] | Restarts a revision for a Container App x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Restart.json | +| [containerAppsSourceControlsCreateOrUpdateSample.js][containerappssourcecontrolscreateorupdatesample] | Create or update the SourceControl for a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_CreateOrUpdate.json | +| [containerAppsSourceControlsDeleteSample.js][containerappssourcecontrolsdeletesample] | Delete a Container App SourceControl. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Delete.json | +| [containerAppsSourceControlsGetSample.js][containerappssourcecontrolsgetsample] | Get a SourceControl of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Get.json | +| [containerAppsSourceControlsListByContainerAppSample.js][containerappssourcecontrolslistbycontainerappsample] | Get the Container App SourceControls in a given resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_ListByContainer.json | +| [containerAppsUpdateSample.js][containerappsupdatesample] | Patches a Container App using JSON Merge Patch x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Patch.json | +| [daprComponentsCreateOrUpdateSample.js][daprcomponentscreateorupdatesample] | Creates or updates a Dapr Component in a Managed Environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json | +| [daprComponentsDeleteSample.js][daprcomponentsdeletesample] | Delete a Dapr Component from a Managed Environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Delete.json | +| [daprComponentsGetSample.js][daprcomponentsgetsample] | Get a dapr component. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_SecretStoreComponent.json | +| [daprComponentsListSample.js][daprcomponentslistsample] | Get the Dapr Components for a managed environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_List.json | +| [daprComponentsListSecretsSample.js][daprcomponentslistsecretssample] | List secrets for a dapr component x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_ListSecrets.json | +| [jobsCreateOrUpdateSample.js][jobscreateorupdatesample] | Create or Update a Container Apps Job. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_CreateorUpdate.json | +| [jobsDeleteSample.js][jobsdeletesample] | Delete a Container Apps Job. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Delete.json | +| [jobsExecutionsListSample.js][jobsexecutionslistsample] | Get a Container Apps Job's executions x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Executions_Get.json | +| [jobsGetSample.js][jobsgetsample] | Get the properties of a Container Apps Job. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Get.json | +| [jobsListByResourceGroupSample.js][jobslistbyresourcegroupsample] | Get the Container Apps Jobs in a given resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListByResourceGroup.json | +| [jobsListBySubscriptionSample.js][jobslistbysubscriptionsample] | Get the Container Apps Jobs in a given subscription. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListBySubscription.json | +| [jobsListSecretsSample.js][jobslistsecretssample] | List secrets for a container apps job x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_ListSecrets.json | +| [jobsStartSample.js][jobsstartsample] | Start a Container Apps Job x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Start.json | +| [jobsStopExecutionSample.js][jobsstopexecutionsample] | Terminates execution of a running container apps job x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Execution.json | +| [jobsStopMultipleExecutionsSample.js][jobsstopmultipleexecutionssample] | Terminates execution of a running container apps job x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Multiple.json | +| [jobsUpdateSample.js][jobsupdatesample] | Patches a Container Apps Job using JSON Merge Patch x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Patch.json | +| [managedCertificatesCreateOrUpdateSample.js][managedcertificatescreateorupdatesample] | Create or Update a Managed Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_CreateOrUpdate.json | +| [managedCertificatesDeleteSample.js][managedcertificatesdeletesample] | Deletes the specified Managed Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Delete.json | +| [managedCertificatesGetSample.js][managedcertificatesgetsample] | Get the specified Managed Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Get.json | +| [managedCertificatesListSample.js][managedcertificateslistsample] | Get the Managed Certificates in a given managed environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_ListByManagedEnvironment.json | +| [managedCertificatesUpdateSample.js][managedcertificatesupdatesample] | Patches a managed certificate. Oly patching of tags is supported x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_Patch.json | +| [managedEnvironmentDiagnosticsGetDetectorSample.js][managedenvironmentdiagnosticsgetdetectorsample] | Get the diagnostics data for a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_Get.json | +| [managedEnvironmentDiagnosticsListDetectorsSample.js][managedenvironmentdiagnosticslistdetectorssample] | Get the list of diagnostics for a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_List.json | +| [managedEnvironmentsCreateOrUpdateSample.js][managedenvironmentscreateorupdatesample] | Creates or updates a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json | +| [managedEnvironmentsDeleteSample.js][managedenvironmentsdeletesample] | Delete a Managed Environment if it does not have any container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Delete.json | +| [managedEnvironmentsDiagnosticsGetRootSample.js][managedenvironmentsdiagnosticsgetrootsample] | Get the properties of a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json | +| [managedEnvironmentsGetAuthTokenSample.js][managedenvironmentsgetauthtokensample] | Checks if resource name is available. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_GetAuthToken.json | +| [managedEnvironmentsGetSample.js][managedenvironmentsgetsample] | Get the properties of a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json | +| [managedEnvironmentsListByResourceGroupSample.js][managedenvironmentslistbyresourcegroupsample] | Get all the Managed Environments in a resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListByResourceGroup.json | +| [managedEnvironmentsListBySubscriptionSample.js][managedenvironmentslistbysubscriptionsample] | Get all Managed Environments for a subscription. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListBySubscription.json | +| [managedEnvironmentsListWorkloadProfileStatesSample.js][managedenvironmentslistworkloadprofilestatessample] | Get all workload Profile States for a Managed Environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json | +| [managedEnvironmentsStoragesCreateOrUpdateSample.js][managedenvironmentsstoragescreateorupdatesample] | Create or update storage for a managedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json | +| [managedEnvironmentsStoragesDeleteSample.js][managedenvironmentsstoragesdeletesample] | Delete storage for a managedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Delete.json | +| [managedEnvironmentsStoragesGetSample.js][managedenvironmentsstoragesgetsample] | Get storage for a managedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Get.json | +| [managedEnvironmentsStoragesListSample.js][managedenvironmentsstorageslistsample] | Get all storages for a managedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_List.json | +| [managedEnvironmentsUpdateSample.js][managedenvironmentsupdatesample] | Patches a Managed Environment using JSON Merge Patch x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Patch.json | +| [namespacesCheckNameAvailabilitySample.js][namespaceschecknameavailabilitysample] | Checks if resource name is available. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_CheckNameAvailability.json | +| [operationsListSample.js][operationslistsample] | Lists all of the available RP operations. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Operations_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node availableWorkloadProfilesGetSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env APPCONTAINERS_SUBSCRIPTION_ID="" node availableWorkloadProfilesGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[availableworkloadprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/availableWorkloadProfilesGetSample.js +[billingmetersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/billingMetersGetSample.js +[certificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesCreateOrUpdateSample.js +[certificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesDeleteSample.js +[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesGetSample.js +[certificateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesListSample.js +[certificatesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesUpdateSample.js +[connectedenvironmentscertificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesCreateOrUpdateSample.js +[connectedenvironmentscertificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesDeleteSample.js +[connectedenvironmentscertificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesGetSample.js +[connectedenvironmentscertificateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesListSample.js +[connectedenvironmentscertificatesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesUpdateSample.js +[connectedenvironmentschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCheckNameAvailabilitySample.js +[connectedenvironmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCreateOrUpdateSample.js +[connectedenvironmentsdaprcomponentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsCreateOrUpdateSample.js +[connectedenvironmentsdaprcomponentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsDeleteSample.js +[connectedenvironmentsdaprcomponentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsGetSample.js +[connectedenvironmentsdaprcomponentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsListSample.js +[connectedenvironmentsdaprcomponentslistsecretssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsListSecretsSample.js +[connectedenvironmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDeleteSample.js +[connectedenvironmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsGetSample.js +[connectedenvironmentslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsListByResourceGroupSample.js +[connectedenvironmentslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsListBySubscriptionSample.js +[connectedenvironmentsstoragescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesCreateOrUpdateSample.js +[connectedenvironmentsstoragesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesDeleteSample.js +[connectedenvironmentsstoragesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesGetSample.js +[connectedenvironmentsstorageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesListSample.js +[connectedenvironmentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsUpdateSample.js +[containerappsauthconfigscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsCreateOrUpdateSample.js +[containerappsauthconfigsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsDeleteSample.js +[containerappsauthconfigsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsGetSample.js +[containerappsauthconfigslistbycontainerappsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsListByContainerAppSample.js +[containerappscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsCreateOrUpdateSample.js +[containerappsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDeleteSample.js +[containerappsdiagnosticsgetdetectorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetDetectorSample.js +[containerappsdiagnosticsgetrevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetRevisionSample.js +[containerappsdiagnosticsgetrootsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetRootSample.js +[containerappsdiagnosticslistdetectorssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsListDetectorsSample.js +[containerappsdiagnosticslistrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsListRevisionsSample.js +[containerappsgetauthtokensample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsGetAuthTokenSample.js +[containerappsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsGetSample.js +[containerappslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListByResourceGroupSample.js +[containerappslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListBySubscriptionSample.js +[containerappslistcustomhostnameanalysissample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListCustomHostNameAnalysisSample.js +[containerappslistsecretssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListSecretsSample.js +[containerappsrevisionreplicasgetreplicasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionReplicasGetReplicaSample.js +[containerappsrevisionreplicaslistreplicassample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionReplicasListReplicasSample.js +[containerappsrevisionsactivaterevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsActivateRevisionSample.js +[containerappsrevisionsdeactivaterevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsDeactivateRevisionSample.js +[containerappsrevisionsgetrevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsGetRevisionSample.js +[containerappsrevisionslistrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsListRevisionsSample.js +[containerappsrevisionsrestartrevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsRestartRevisionSample.js +[containerappssourcecontrolscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsCreateOrUpdateSample.js +[containerappssourcecontrolsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsDeleteSample.js +[containerappssourcecontrolsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsGetSample.js +[containerappssourcecontrolslistbycontainerappsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsListByContainerAppSample.js +[containerappsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsUpdateSample.js +[daprcomponentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsCreateOrUpdateSample.js +[daprcomponentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsDeleteSample.js +[daprcomponentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsGetSample.js +[daprcomponentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsListSample.js +[daprcomponentslistsecretssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsListSecretsSample.js +[jobscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsCreateOrUpdateSample.js +[jobsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsDeleteSample.js +[jobsexecutionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsExecutionsListSample.js +[jobsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsGetSample.js +[jobslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListByResourceGroupSample.js +[jobslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListBySubscriptionSample.js +[jobslistsecretssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListSecretsSample.js +[jobsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStartSample.js +[jobsstopexecutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStopExecutionSample.js +[jobsstopmultipleexecutionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStopMultipleExecutionsSample.js +[jobsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsUpdateSample.js +[managedcertificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesCreateOrUpdateSample.js +[managedcertificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesDeleteSample.js +[managedcertificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesGetSample.js +[managedcertificateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesListSample.js +[managedcertificatesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesUpdateSample.js +[managedenvironmentdiagnosticsgetdetectorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentDiagnosticsGetDetectorSample.js +[managedenvironmentdiagnosticslistdetectorssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentDiagnosticsListDetectorsSample.js +[managedenvironmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsCreateOrUpdateSample.js +[managedenvironmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsDeleteSample.js +[managedenvironmentsdiagnosticsgetrootsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsDiagnosticsGetRootSample.js +[managedenvironmentsgetauthtokensample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsGetAuthTokenSample.js +[managedenvironmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsGetSample.js +[managedenvironmentslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListByResourceGroupSample.js +[managedenvironmentslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListBySubscriptionSample.js +[managedenvironmentslistworkloadprofilestatessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListWorkloadProfileStatesSample.js +[managedenvironmentsstoragescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesCreateOrUpdateSample.js +[managedenvironmentsstoragesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesDeleteSample.js +[managedenvironmentsstoragesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesGetSample.js +[managedenvironmentsstorageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesListSample.js +[managedenvironmentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsUpdateSample.js +[namespaceschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/namespacesCheckNameAvailabilitySample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/operationsListSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-appcontainers?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/appcontainers/arm-appcontainers/README.md diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/availableWorkloadProfilesGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/availableWorkloadProfilesGetSample.js new file mode 100644 index 000000000000..697b57aaa2c9 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/availableWorkloadProfilesGetSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all available workload profiles for a location. + * + * @summary Get all available workload profiles for a location. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AvailableWorkloadProfiles_Get.json + */ +async function billingMetersGet() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "East US"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availableWorkloadProfiles.list(location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + billingMetersGet(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/billingMetersGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/billingMetersGetSample.js new file mode 100644 index 000000000000..ca1c2fd4390d --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/billingMetersGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all billingMeters for a location. + * + * @summary Get all billingMeters for a location. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/BillingMeters_Get.json + */ +async function billingMetersGet() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "East US"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.billingMeters.get(location); + console.log(result); +} + +async function main() { + billingMetersGet(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesCreateOrUpdateSample.js new file mode 100644 index 000000000000..c9af1d9a06cb --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesCreateOrUpdateSample.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or Update a Certificate. + * + * @summary Create or Update a Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_CreateOrUpdate.json + */ +async function createOrUpdateCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const certificateEnvelope = { + location: "East US", + properties: { + password: "private key password", + value: Buffer.from("Y2VydA=="), + }, + }; + const options = { + certificateEnvelope, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate( + resourceGroupName, + environmentName, + certificateName, + options + ); + console.log(result); +} + +async function main() { + createOrUpdateCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesDeleteSample.js new file mode 100644 index 000000000000..7edb0b464440 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the specified Certificate. + * + * @summary Deletes the specified Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Delete.json + */ +async function deleteCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.certificates.delete( + resourceGroupName, + environmentName, + certificateName + ); + console.log(result); +} + +async function main() { + deleteCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesGetSample.js new file mode 100644 index 000000000000..c68a5c10a0f8 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesGetSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the specified Certificate. + * + * @summary Get the specified Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Get.json + */ +async function getCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.certificates.get(resourceGroupName, environmentName, certificateName); + console.log(result); +} + +async function main() { + getCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesListSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesListSample.js new file mode 100644 index 000000000000..da35051f3708 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesListSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Certificates in a given managed environment. + * + * @summary Get the Certificates in a given managed environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_ListByManagedEnvironment.json + */ +async function listCertificatesByManagedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificates.list(resourceGroupName, environmentName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesByManagedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesUpdateSample.js new file mode 100644 index 000000000000..d039dc23a815 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/certificatesUpdateSample.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Patches a certificate. Currently only patching of tags is supported + * + * @summary Patches a certificate. Currently only patching of tags is supported + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_Patch.json + */ +async function patchCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const certificateEnvelope = { + tags: { tag1: "value1", tag2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.certificates.update( + resourceGroupName, + environmentName, + certificateName, + certificateEnvelope + ); + console.log(result); +} + +async function main() { + patchCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesCreateOrUpdateSample.js new file mode 100644 index 000000000000..4ff374608dfc --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesCreateOrUpdateSample.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or Update a Certificate. + * + * @summary Create or Update a Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json + */ +async function createOrUpdateCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const certificateEnvelope = { + location: "East US", + properties: { + password: "private key password", + value: Buffer.from("Y2VydA=="), + }, + }; + const options = { + certificateEnvelope, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsCertificates.createOrUpdate( + resourceGroupName, + connectedEnvironmentName, + certificateName, + options + ); + console.log(result); +} + +async function main() { + createOrUpdateCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesDeleteSample.js new file mode 100644 index 000000000000..6a836c3e0cf5 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the specified Certificate. + * + * @summary Deletes the specified Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Delete.json + */ +async function deleteCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsCertificates.delete( + resourceGroupName, + connectedEnvironmentName, + certificateName + ); + console.log(result); +} + +async function main() { + deleteCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesGetSample.js new file mode 100644 index 000000000000..8f3c7e2382fa --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the specified Certificate. + * + * @summary Get the specified Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Get.json + */ +async function getCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsCertificates.get( + resourceGroupName, + connectedEnvironmentName, + certificateName + ); + console.log(result); +} + +async function main() { + getCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesListSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesListSample.js new file mode 100644 index 000000000000..9cf7c3b92c40 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesListSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Certificates in a given connected environment. + * + * @summary Get the Certificates in a given connected environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json + */ +async function listCertificatesByConnectedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.connectedEnvironmentsCertificates.list( + resourceGroupName, + connectedEnvironmentName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesByConnectedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesUpdateSample.js new file mode 100644 index 000000000000..435f387c3941 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCertificatesUpdateSample.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Patches a certificate. Currently only patching of tags is supported + * + * @summary Patches a certificate. Currently only patching of tags is supported + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_Patch.json + */ +async function patchCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const certificateEnvelope = { + tags: { tag1: "value1", tag2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsCertificates.update( + resourceGroupName, + connectedEnvironmentName, + certificateName, + certificateEnvelope + ); + console.log(result); +} + +async function main() { + patchCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCheckNameAvailabilitySample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..f0e81ff0926f --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCheckNameAvailabilitySample.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Checks if resource connectedEnvironmentName is available. + * + * @summary Checks if resource connectedEnvironmentName is available. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json + */ +async function certificatesCheckNameAvailability() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const checkNameAvailabilityRequest = { + name: "testcertificatename", + type: "Microsoft.App/connectedEnvironments/certificates", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.checkNameAvailability( + resourceGroupName, + connectedEnvironmentName, + checkNameAvailabilityRequest + ); + console.log(result); +} + +async function main() { + certificatesCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..d39c23aacdd6 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsCreateOrUpdateSample.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates an connectedEnvironment. + * + * @summary Creates or updates an connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_CreateOrUpdate.json + */ +async function createKubeEnvironments() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testenv"; + const environmentEnvelope = { + customDomainConfiguration: { + certificatePassword: "private key password", + certificateValue: Buffer.from("Y2VydA=="), + dnsSuffix: "www.my-name.com", + }, + daprAIConnectionString: + "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + location: "East US", + staticIp: "1.2.3.4", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.beginCreateOrUpdateAndWait( + resourceGroupName, + connectedEnvironmentName, + environmentEnvelope + ); + console.log(result); +} + +async function main() { + createKubeEnvironments(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..4b2eb9940123 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsCreateOrUpdateSample.js @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a Dapr Component in a connected environment. + * + * @summary Creates or updates a Dapr Component in a connected environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json + */ +async function createOrUpdateDaprComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const componentName = "reddog"; + const daprComponentEnvelope = { + componentType: "state.azure.cosmosdb", + ignoreErrors: false, + initTimeout: "50s", + metadata: [ + { name: "url", value: "" }, + { name: "database", value: "itemsDB" }, + { name: "collection", value: "items" }, + { name: "masterkey", secretRef: "masterkey" }, + ], + scopes: ["container-app-1", "container-app-2"], + secrets: [{ name: "masterkey", value: "keyvalue" }], + version: "v1", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsDaprComponents.createOrUpdate( + resourceGroupName, + connectedEnvironmentName, + componentName, + daprComponentEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateDaprComponent(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsDeleteSample.js new file mode 100644 index 000000000000..72f634fb0177 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a Dapr Component from a connected environment. + * + * @summary Delete a Dapr Component from a connected environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json + */ +async function deleteDaprComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsDaprComponents.delete( + resourceGroupName, + connectedEnvironmentName, + componentName + ); + console.log(result); +} + +async function main() { + deleteDaprComponent(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsGetSample.js new file mode 100644 index 000000000000..0be96eed73e0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a dapr component. + * + * @summary Get a dapr component. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json + */ +async function getDaprComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsDaprComponents.get( + resourceGroupName, + connectedEnvironmentName, + componentName + ); + console.log(result); +} + +async function main() { + getDaprComponent(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsListSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsListSample.js new file mode 100644 index 000000000000..507e3c05be2b --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsListSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Dapr Components for a connected environment. + * + * @summary Get the Dapr Components for a connected environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_List.json + */ +async function listDaprComponents() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.connectedEnvironmentsDaprComponents.list( + resourceGroupName, + connectedEnvironmentName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listDaprComponents(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsListSecretsSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsListSecretsSample.js new file mode 100644 index 000000000000..fdaf03c56c5b --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDaprComponentsListSecretsSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List secrets for a dapr component + * + * @summary List secrets for a dapr component + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json + */ +async function listContainerAppsSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsDaprComponents.listSecrets( + resourceGroupName, + connectedEnvironmentName, + componentName + ); + console.log(result); +} + +async function main() { + listContainerAppsSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDeleteSample.js new file mode 100644 index 000000000000..7026080440bc --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsDeleteSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete an connectedEnvironment. + * + * @summary Delete an connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Delete.json + */ +async function deleteConnectedEnvironmentByConnectedEnvironmentName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "examplekenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.beginDeleteAndWait( + resourceGroupName, + connectedEnvironmentName + ); + console.log(result); +} + +async function main() { + deleteConnectedEnvironmentByConnectedEnvironmentName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsGetSample.js new file mode 100644 index 000000000000..f12d4d01cfa7 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsGetSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the properties of an connectedEnvironment. + * + * @summary Get the properties of an connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Get.json + */ +async function getConnectedEnvironmentByConnectedEnvironmentName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "examplekenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.get( + resourceGroupName, + connectedEnvironmentName + ); + console.log(result); +} + +async function main() { + getConnectedEnvironmentByConnectedEnvironmentName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsListByResourceGroupSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsListByResourceGroupSample.js new file mode 100644 index 000000000000..cb26227344f3 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsListByResourceGroupSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all connectedEnvironments in a resource group. + * + * @summary Get all connectedEnvironments in a resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListByResourceGroup.json + */ +async function listEnvironmentsByResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.connectedEnvironments.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEnvironmentsByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsListBySubscriptionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsListBySubscriptionSample.js new file mode 100644 index 000000000000..5994d3b12095 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsListBySubscriptionSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all connectedEnvironments for a subscription. + * + * @summary Get all connectedEnvironments for a subscription. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListBySubscription.json + */ +async function listConnectedEnvironmentsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.connectedEnvironments.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listConnectedEnvironmentsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesCreateOrUpdateSample.js new file mode 100644 index 000000000000..80aec60dd1e1 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesCreateOrUpdateSample.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update storage for a connectedEnvironment. + * + * @summary Create or update storage for a connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json + */ +async function createOrUpdateEnvironmentsStorage() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "env"; + const storageName = "jlaw-demo1"; + const storageEnvelope = { + properties: { + azureFile: { + accessMode: "ReadOnly", + accountKey: "key", + accountName: "account1", + shareName: "share1", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsStorages.createOrUpdate( + resourceGroupName, + connectedEnvironmentName, + storageName, + storageEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateEnvironmentsStorage(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesDeleteSample.js new file mode 100644 index 000000000000..1862142a6407 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete storage for a connectedEnvironment. + * + * @summary Delete storage for a connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Delete.json + */ +async function listEnvironmentsStoragesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "env"; + const storageName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsStorages.delete( + resourceGroupName, + connectedEnvironmentName, + storageName + ); + console.log(result); +} + +async function main() { + listEnvironmentsStoragesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesGetSample.js new file mode 100644 index 000000000000..cde7f5181426 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get storage for a connectedEnvironment. + * + * @summary Get storage for a connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Get.json + */ +async function getAEnvironmentsStoragePropertiesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "env"; + const storageName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsStorages.get( + resourceGroupName, + connectedEnvironmentName, + storageName + ); + console.log(result); +} + +async function main() { + getAEnvironmentsStoragePropertiesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesListSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesListSample.js new file mode 100644 index 000000000000..22d2e834c4e8 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsStoragesListSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all storages for a connectedEnvironment. + * + * @summary Get all storages for a connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_List.json + */ +async function listEnvironmentsStoragesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "managedEnv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsStorages.list( + resourceGroupName, + connectedEnvironmentName + ); + console.log(result); +} + +async function main() { + listEnvironmentsStoragesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsUpdateSample.js new file mode 100644 index 000000000000..0e55ee14e9c9 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/connectedEnvironmentsUpdateSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Patches a Managed Environment. Only patching of tags is supported currently + * + * @summary Patches a Managed Environment. Only patching of tags is supported currently + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Patch.json + */ +async function patchManagedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.update( + resourceGroupName, + connectedEnvironmentName + ); + console.log(result); +} + +async function main() { + patchManagedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsCreateOrUpdateSample.js new file mode 100644 index 000000000000..284d2ddffb26 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsCreateOrUpdateSample.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update the AuthConfig for a Container App. + * + * @summary Create or update the AuthConfig for a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_CreateOrUpdate.json + */ +async function createOrUpdateContainerAppAuthConfig() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const authConfigName = "current"; + const authConfigEnvelope = { + globalValidation: { unauthenticatedClientAction: "AllowAnonymous" }, + identityProviders: { + facebook: { + registration: { appId: "123", appSecretSettingName: "facebook-secret" }, + }, + }, + platform: { enabled: true }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsAuthConfigs.createOrUpdate( + resourceGroupName, + containerAppName, + authConfigName, + authConfigEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateContainerAppAuthConfig(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsDeleteSample.js new file mode 100644 index 000000000000..bc1655dd0e3c --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a Container App AuthConfig. + * + * @summary Delete a Container App AuthConfig. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Delete.json + */ +async function deleteContainerAppAuthConfig() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const authConfigName = "current"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsAuthConfigs.delete( + resourceGroupName, + containerAppName, + authConfigName + ); + console.log(result); +} + +async function main() { + deleteContainerAppAuthConfig(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsGetSample.js new file mode 100644 index 000000000000..111e27745539 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a AuthConfig of a Container App. + * + * @summary Get a AuthConfig of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Get.json + */ +async function getContainerAppAuthConfig() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const authConfigName = "current"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsAuthConfigs.get( + resourceGroupName, + containerAppName, + authConfigName + ); + console.log(result); +} + +async function main() { + getContainerAppAuthConfig(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsListByContainerAppSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsListByContainerAppSample.js new file mode 100644 index 000000000000..df35a2d2775a --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsAuthConfigsListByContainerAppSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Container App AuthConfigs in a given resource group. + * + * @summary Get the Container App AuthConfigs in a given resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_ListByContainer.json + */ +async function listAuthConfigsByContainerApps() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsAuthConfigs.listByContainerApp( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAuthConfigsByContainerApps(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsCreateOrUpdateSample.js new file mode 100644 index 000000000000..6039ac3109b1 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsCreateOrUpdateSample.js @@ -0,0 +1,272 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update a Container App. + * + * @summary Create or update a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CreateOrUpdate.json + */ +async function createOrUpdateContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const containerAppEnvelope = { + configuration: { + dapr: { + appPort: 3000, + appProtocol: "http", + enableApiLogging: true, + enabled: true, + httpMaxRequestSize: 10, + httpReadBufferSize: 30, + logLevel: "debug", + }, + ingress: { + clientCertificateMode: "accept", + corsPolicy: { + allowCredentials: true, + allowedHeaders: ["HEADER1", "HEADER2"], + allowedMethods: ["GET", "POST"], + allowedOrigins: ["https://a.test.com", "https://b.test.com"], + exposeHeaders: ["HEADER3", "HEADER4"], + maxAge: 1234, + }, + customDomains: [ + { + name: "www.my-name.com", + bindingType: "SniEnabled", + certificateId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com", + }, + { + name: "www.my-other-name.com", + bindingType: "SniEnabled", + certificateId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com", + }, + ], + external: true, + ipSecurityRestrictions: [ + { + name: "Allow work IP A subnet", + description: "Allowing all IP's within the subnet below to access containerapp", + action: "Allow", + ipAddressRange: "192.168.1.1/32", + }, + { + name: "Allow work IP B subnet", + description: "Allowing all IP's within the subnet below to access containerapp", + action: "Allow", + ipAddressRange: "192.168.1.1/8", + }, + ], + stickySessions: { affinity: "sticky" }, + targetPort: 3000, + traffic: [ + { + label: "production", + revisionName: "testcontainerApp0-ab1234", + weight: 100, + }, + ], + }, + maxInactiveRevisions: 10, + }, + environmentId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + location: "East US", + template: { + containers: [ + { + name: "testcontainerApp0", + image: "repo/testcontainerApp0:v1", + probes: [ + { + type: "Liveness", + httpGet: { + path: "/health", + httpHeaders: [{ name: "Custom-Header", value: "Awesome" }], + port: 8080, + }, + initialDelaySeconds: 3, + periodSeconds: 3, + }, + ], + }, + ], + initContainers: [ + { + name: "testinitcontainerApp0", + args: ["-c", "while true; do echo hello; sleep 10;done"], + command: ["/bin/sh"], + image: "repo/testcontainerApp0:v4", + resources: { cpu: 0.2, memory: "100Mi" }, + }, + ], + scale: { + maxReplicas: 5, + minReplicas: 1, + rules: [ + { + name: "httpscalingrule", + custom: { type: "http", metadata: { concurrentRequests: "50" } }, + }, + ], + }, + }, + workloadProfileName: "My-GP-01", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginCreateOrUpdateAndWait( + resourceGroupName, + containerAppName, + containerAppEnvelope + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a Container App. + * + * @summary Create or update a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json + */ +async function createOrUpdateManagedByApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerAppManagedBy"; + const containerAppEnvelope = { + configuration: { + ingress: { + exposedPort: 4000, + external: true, + targetPort: 3000, + traffic: [{ revisionName: "testcontainerAppManagedBy-ab1234", weight: 100 }], + transport: "tcp", + }, + }, + environmentId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + location: "East US", + managedBy: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp", + template: { + containers: [ + { + name: "testcontainerAppManagedBy", + image: "repo/testcontainerAppManagedBy:v1", + probes: [ + { + type: "Liveness", + initialDelaySeconds: 3, + periodSeconds: 3, + tcpSocket: { port: 8080 }, + }, + ], + }, + ], + scale: { + maxReplicas: 5, + minReplicas: 1, + rules: [ + { + name: "tcpscalingrule", + tcp: { metadata: { concurrentConnections: "50" } }, + }, + ], + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginCreateOrUpdateAndWait( + resourceGroupName, + containerAppName, + containerAppEnvelope + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a Container App. + * + * @summary Create or update a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json + */ +async function createOrUpdateTcpApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerAppTcp"; + const containerAppEnvelope = { + configuration: { + ingress: { + exposedPort: 4000, + external: true, + targetPort: 3000, + traffic: [{ revisionName: "testcontainerAppTcp-ab1234", weight: 100 }], + transport: "tcp", + }, + }, + environmentId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + location: "East US", + template: { + containers: [ + { + name: "testcontainerAppTcp", + image: "repo/testcontainerAppTcp:v1", + probes: [ + { + type: "Liveness", + initialDelaySeconds: 3, + periodSeconds: 3, + tcpSocket: { port: 8080 }, + }, + ], + }, + ], + scale: { + maxReplicas: 5, + minReplicas: 1, + rules: [ + { + name: "tcpscalingrule", + tcp: { metadata: { concurrentConnections: "50" } }, + }, + ], + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginCreateOrUpdateAndWait( + resourceGroupName, + containerAppName, + containerAppEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateContainerApp(); + createOrUpdateManagedByApp(); + createOrUpdateTcpApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDeleteSample.js new file mode 100644 index 000000000000..e69c2f743ff0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDeleteSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a Container App. + * + * @summary Delete a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Delete.json + */ +async function deleteContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testWorkerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginDeleteAndWait(resourceGroupName, containerAppName); + console.log(result); +} + +async function main() { + deleteContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetDetectorSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetDetectorSample.js new file mode 100644 index 000000000000..4a12660df14f --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetDetectorSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a diagnostics result of a Container App. + * + * @summary Get a diagnostics result of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_Get.json + */ +async function getContainerAppDiagnosticsInfo() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "mikono-workerapp-test-rg"; + const containerAppName = "mikono-capp-stage1"; + const detectorName = "cappcontainerappnetworkIO"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsDiagnostics.getDetector( + resourceGroupName, + containerAppName, + detectorName + ); + console.log(result); +} + +async function main() { + getContainerAppDiagnosticsInfo(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetRevisionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetRevisionSample.js new file mode 100644 index 000000000000..b669579ec983 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetRevisionSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a revision of a Container App. + * + * @summary Get a revision of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json + */ +async function getContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsDiagnostics.getRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + getContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetRootSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetRootSample.js new file mode 100644 index 000000000000..2b096b5e6214 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsGetRootSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the properties of a Container App. + * + * @summary Get the properties of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json + */ +async function getContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsDiagnostics.getRoot(resourceGroupName, containerAppName); + console.log(result); +} + +async function main() { + getContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsListDetectorsSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsListDetectorsSample.js new file mode 100644 index 000000000000..aac8cdba35b8 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsListDetectorsSample.js @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the list of diagnostics for a given Container App. + * + * @summary Get the list of diagnostics for a given Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_List.json + */ +async function getTheListOfAvailableDiagnosticsForAGivenContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "mikono-workerapp-test-rg"; + const containerAppName = "mikono-capp-stage1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsDiagnostics.listDetectors( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getTheListOfAvailableDiagnosticsForAGivenContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsListRevisionsSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsListRevisionsSample.js new file mode 100644 index 000000000000..b734ae4429c0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsDiagnosticsListRevisionsSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Revisions for a given Container App. + * + * @summary Get the Revisions for a given Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json + */ +async function listContainerAppRevisions() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsDiagnostics.listRevisions( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppRevisions(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsGetAuthTokenSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsGetAuthTokenSample.js new file mode 100644 index 000000000000..1dfe2c244a6d --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsGetAuthTokenSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get auth token for a container app + * + * @summary Get auth token for a container app + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_GetAuthToken.json + */ +async function getContainerAppAuthToken() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.getAuthToken(resourceGroupName, containerAppName); + console.log(result); +} + +async function main() { + getContainerAppAuthToken(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsGetSample.js new file mode 100644 index 000000000000..8455898e0d87 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsGetSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the properties of a Container App. + * + * @summary Get the properties of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json + */ +async function getContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.get(resourceGroupName, containerAppName); + console.log(result); +} + +async function main() { + getContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListByResourceGroupSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListByResourceGroupSample.js new file mode 100644 index 000000000000..f4cacac91af8 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListByResourceGroupSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Container Apps in a given resource group. + * + * @summary Get the Container Apps in a given resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListByResourceGroup.json + */ +async function listContainerAppsByResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerApps.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppsByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListBySubscriptionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListBySubscriptionSample.js new file mode 100644 index 000000000000..e521f01f2dcd --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListBySubscriptionSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Container Apps in a given subscription. + * + * @summary Get the Container Apps in a given subscription. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListBySubscription.json + */ +async function listContainerAppsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerApps.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListCustomHostNameAnalysisSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListCustomHostNameAnalysisSample.js new file mode 100644 index 000000000000..e4ac56332b89 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListCustomHostNameAnalysisSample.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Analyzes a custom hostname for a Container App + * + * @summary Analyzes a custom hostname for a Container App + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json + */ +async function analyzeCustomHostname() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const customHostname = "my.name.corp"; + const options = { + customHostname, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.listCustomHostNameAnalysis( + resourceGroupName, + containerAppName, + options + ); + console.log(result); +} + +async function main() { + analyzeCustomHostname(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListSecretsSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListSecretsSample.js new file mode 100644 index 000000000000..a50ec23506ea --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsListSecretsSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List secrets for a container app + * + * @summary List secrets for a container app + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListSecrets.json + */ +async function listContainerAppsSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.listSecrets(resourceGroupName, containerAppName); + console.log(result); +} + +async function main() { + listContainerAppsSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionReplicasGetReplicaSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionReplicasGetReplicaSample.js new file mode 100644 index 000000000000..167bcbfdd6fa --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionReplicasGetReplicaSample.js @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a replica for a Container App Revision. + * + * @summary Get a replica for a Container App Revision. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_Get.json + */ +async function getContainerAppRevisionReplica() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "myapp"; + const revisionName = "myapp--0wlqy09"; + const replicaName = "myapp--0wlqy09-5d9774cff-5wnd8"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisionReplicas.getReplica( + resourceGroupName, + containerAppName, + revisionName, + replicaName + ); + console.log(result); +} + +async function main() { + getContainerAppRevisionReplica(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionReplicasListReplicasSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionReplicasListReplicasSample.js new file mode 100644 index 000000000000..ada72067bf18 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionReplicasListReplicasSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List replicas for a Container App Revision. + * + * @summary List replicas for a Container App Revision. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_List.json + */ +async function listContainerAppReplicas() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "myapp"; + const revisionName = "myapp--0wlqy09"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisionReplicas.listReplicas( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + listContainerAppReplicas(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsActivateRevisionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsActivateRevisionSample.js new file mode 100644 index 000000000000..56dd5c014288 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsActivateRevisionSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Activates a revision for a Container App + * + * @summary Activates a revision for a Container App + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Activate.json + */ +async function activateContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisions.activateRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + activateContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsDeactivateRevisionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsDeactivateRevisionSample.js new file mode 100644 index 000000000000..d04d8e4eb251 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsDeactivateRevisionSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deactivates a revision for a Container App + * + * @summary Deactivates a revision for a Container App + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Deactivate.json + */ +async function deactivateContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisions.deactivateRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + deactivateContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsGetRevisionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsGetRevisionSample.js new file mode 100644 index 000000000000..8c38f3a82294 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsGetRevisionSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a revision of a Container App. + * + * @summary Get a revision of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json + */ +async function getContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisions.getRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + getContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsListRevisionsSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsListRevisionsSample.js new file mode 100644 index 000000000000..7fb90ece8bc0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsListRevisionsSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Revisions for a given Container App. + * + * @summary Get the Revisions for a given Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json + */ +async function listContainerAppRevisions() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsRevisions.listRevisions( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppRevisions(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsRestartRevisionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsRestartRevisionSample.js new file mode 100644 index 000000000000..8911cdf02bce --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsRevisionsRestartRevisionSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Restarts a revision for a Container App + * + * @summary Restarts a revision for a Container App + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Restart.json + */ +async function restartContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testStaticSite0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisions.restartRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + restartContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsCreateOrUpdateSample.js new file mode 100644 index 000000000000..5e75aaedfa08 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsCreateOrUpdateSample.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update the SourceControl for a Container App. + * + * @summary Create or update the SourceControl for a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_CreateOrUpdate.json + */ +async function createOrUpdateContainerAppSourceControl() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const sourceControlName = "current"; + const sourceControlEnvelope = { + branch: "master", + githubActionConfiguration: { + azureCredentials: { + clientId: "", + clientSecret: "", + tenantId: "", + }, + contextPath: "./", + image: "image/tag", + registryInfo: { + registryPassword: "", + registryUrl: "xwang971reg.azurecr.io", + registryUserName: "xwang971reg", + }, + }, + repoUrl: "https://github.com/xwang971/ghatest", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsSourceControls.beginCreateOrUpdateAndWait( + resourceGroupName, + containerAppName, + sourceControlName, + sourceControlEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateContainerAppSourceControl(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsDeleteSample.js new file mode 100644 index 000000000000..15184f9e465d --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a Container App SourceControl. + * + * @summary Delete a Container App SourceControl. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Delete.json + */ +async function deleteContainerAppSourceControl() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const sourceControlName = "current"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsSourceControls.beginDeleteAndWait( + resourceGroupName, + containerAppName, + sourceControlName + ); + console.log(result); +} + +async function main() { + deleteContainerAppSourceControl(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsGetSample.js new file mode 100644 index 000000000000..a4256bde6dd2 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a SourceControl of a Container App. + * + * @summary Get a SourceControl of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Get.json + */ +async function getContainerAppSourceControl() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const sourceControlName = "current"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsSourceControls.get( + resourceGroupName, + containerAppName, + sourceControlName + ); + console.log(result); +} + +async function main() { + getContainerAppSourceControl(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsListByContainerAppSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsListByContainerAppSample.js new file mode 100644 index 000000000000..76363f4b49ec --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsSourceControlsListByContainerAppSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Container App SourceControls in a given resource group. + * + * @summary Get the Container App SourceControls in a given resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_ListByContainer.json + */ +async function listAppSourceControls() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsSourceControls.listByContainerApp( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAppSourceControls(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsUpdateSample.js new file mode 100644 index 000000000000..c0f529899689 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/containerAppsUpdateSample.js @@ -0,0 +1,133 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Patches a Container App using JSON Merge Patch + * + * @summary Patches a Container App using JSON Merge Patch + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Patch.json + */ +async function patchContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const containerAppEnvelope = { + configuration: { + dapr: { + appPort: 3000, + appProtocol: "http", + enableApiLogging: true, + enabled: true, + httpMaxRequestSize: 10, + httpReadBufferSize: 30, + logLevel: "debug", + }, + ingress: { + customDomains: [ + { + name: "www.my-name.com", + bindingType: "SniEnabled", + certificateId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com", + }, + { + name: "www.my-other-name.com", + bindingType: "SniEnabled", + certificateId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com", + }, + ], + external: true, + ipSecurityRestrictions: [ + { + name: "Allow work IP A subnet", + description: "Allowing all IP's within the subnet below to access containerapp", + action: "Allow", + ipAddressRange: "192.168.1.1/32", + }, + { + name: "Allow work IP B subnet", + description: "Allowing all IP's within the subnet below to access containerapp", + action: "Allow", + ipAddressRange: "192.168.1.1/8", + }, + ], + stickySessions: { affinity: "sticky" }, + targetPort: 3000, + traffic: [ + { + label: "production", + revisionName: "testcontainerApp0-ab1234", + weight: 100, + }, + ], + }, + maxInactiveRevisions: 10, + }, + location: "East US", + tags: { tag1: "value1", tag2: "value2" }, + template: { + containers: [ + { + name: "testcontainerApp0", + image: "repo/testcontainerApp0:v1", + probes: [ + { + type: "Liveness", + httpGet: { + path: "/health", + httpHeaders: [{ name: "Custom-Header", value: "Awesome" }], + port: 8080, + }, + initialDelaySeconds: 3, + periodSeconds: 3, + }, + ], + }, + ], + initContainers: [ + { + name: "testinitcontainerApp0", + image: "repo/testcontainerApp0:v4", + resources: { cpu: 0.2, memory: "100Mi" }, + }, + ], + scale: { + maxReplicas: 5, + minReplicas: 1, + rules: [ + { + name: "httpscalingrule", + custom: { type: "http", metadata: { concurrentRequests: "50" } }, + }, + ], + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginUpdateAndWait( + resourceGroupName, + containerAppName, + containerAppEnvelope + ); + console.log(result); +} + +async function main() { + patchContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..607d567ef3eb --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsCreateOrUpdateSample.js @@ -0,0 +1,94 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a Dapr Component in a Managed Environment. + * + * @summary Creates or updates a Dapr Component in a Managed Environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json + */ +async function createOrUpdateDaprComponentWithSecretStoreComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const daprComponentEnvelope = { + componentType: "state.azure.cosmosdb", + ignoreErrors: false, + initTimeout: "50s", + metadata: [ + { name: "url", value: "" }, + { name: "database", value: "itemsDB" }, + { name: "collection", value: "items" }, + { name: "masterkey", secretRef: "masterkey" }, + ], + scopes: ["container-app-1", "container-app-2"], + secretStoreComponent: "my-secret-store", + version: "v1", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.createOrUpdate( + resourceGroupName, + environmentName, + componentName, + daprComponentEnvelope + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a Dapr Component in a Managed Environment. + * + * @summary Creates or updates a Dapr Component in a Managed Environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json + */ +async function createOrUpdateDaprComponentWithSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const daprComponentEnvelope = { + componentType: "state.azure.cosmosdb", + ignoreErrors: false, + initTimeout: "50s", + metadata: [ + { name: "url", value: "" }, + { name: "database", value: "itemsDB" }, + { name: "collection", value: "items" }, + { name: "masterkey", secretRef: "masterkey" }, + ], + scopes: ["container-app-1", "container-app-2"], + secrets: [{ name: "masterkey", value: "keyvalue" }], + version: "v1", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.createOrUpdate( + resourceGroupName, + environmentName, + componentName, + daprComponentEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateDaprComponentWithSecretStoreComponent(); + createOrUpdateDaprComponentWithSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsDeleteSample.js new file mode 100644 index 000000000000..939e8503e930 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a Dapr Component from a Managed Environment. + * + * @summary Delete a Dapr Component from a Managed Environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Delete.json + */ +async function deleteDaprComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.delete( + resourceGroupName, + environmentName, + componentName + ); + console.log(result); +} + +async function main() { + deleteDaprComponent(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsGetSample.js new file mode 100644 index 000000000000..455fe1ce9f29 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsGetSample.js @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a dapr component. + * + * @summary Get a dapr component. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_SecretStoreComponent.json + */ +async function getDaprComponentWithSecretStoreComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.get(resourceGroupName, environmentName, componentName); + console.log(result); +} + +/** + * This sample demonstrates how to Get a dapr component. + * + * @summary Get a dapr component. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_Secrets.json + */ +async function getDaprComponentWithSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.get(resourceGroupName, environmentName, componentName); + console.log(result); +} + +async function main() { + getDaprComponentWithSecretStoreComponent(); + getDaprComponentWithSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsListSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsListSample.js new file mode 100644 index 000000000000..eccb8e239b5a --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsListSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Dapr Components for a managed environment. + * + * @summary Get the Dapr Components for a managed environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_List.json + */ +async function listDaprComponents() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.daprComponents.list(resourceGroupName, environmentName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listDaprComponents(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsListSecretsSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsListSecretsSample.js new file mode 100644 index 000000000000..c528f957ce94 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/daprComponentsListSecretsSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List secrets for a dapr component + * + * @summary List secrets for a dapr component + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_ListSecrets.json + */ +async function listContainerAppsSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.listSecrets( + resourceGroupName, + environmentName, + componentName + ); + console.log(result); +} + +async function main() { + listContainerAppsSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsCreateOrUpdateSample.js new file mode 100644 index 000000000000..bdf729c808b5 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsCreateOrUpdateSample.js @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or Update a Container Apps Job. + * + * @summary Create or Update a Container Apps Job. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_CreateorUpdate.json + */ +async function createOrUpdateContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const jobEnvelope = { + configuration: { + manualTriggerConfig: { parallelism: 4, replicaCompletionCount: 1 }, + replicaRetryLimit: 10, + replicaTimeout: 10, + triggerType: "Manual", + }, + environmentId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + location: "East US", + template: { + containers: [ + { + name: "testcontainerAppsJob0", + image: "repo/testcontainerAppsJob0:v1", + probes: [ + { + type: "Liveness", + httpGet: { + path: "/health", + httpHeaders: [{ name: "Custom-Header", value: "Awesome" }], + port: 8080, + }, + initialDelaySeconds: 5, + periodSeconds: 3, + }, + ], + }, + ], + initContainers: [ + { + name: "testinitcontainerAppsJob0", + args: ["-c", "while true; do echo hello; sleep 10;done"], + command: ["/bin/sh"], + image: "repo/testcontainerAppsJob0:v4", + resources: { cpu: 0.2, memory: "100Mi" }, + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginCreateOrUpdateAndWait( + resourceGroupName, + jobName, + jobEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsDeleteSample.js new file mode 100644 index 000000000000..f6b80d04dc0b --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsDeleteSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a Container Apps Job. + * + * @summary Delete a Container Apps Job. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Delete.json + */ +async function deleteContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testWorkerContainerAppsJob0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginDeleteAndWait(resourceGroupName, jobName); + console.log(result); +} + +async function main() { + deleteContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsExecutionsListSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsExecutionsListSample.js new file mode 100644 index 000000000000..4434fab8bf1e --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsExecutionsListSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a Container Apps Job's executions + * + * @summary Get a Container Apps Job's executions + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Executions_Get.json + */ +async function getAContainerAppsJobExecutions() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobsExecutions.list(resourceGroupName, jobName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getAContainerAppsJobExecutions(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsGetSample.js new file mode 100644 index 000000000000..359e6d26f05b --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsGetSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the properties of a Container Apps Job. + * + * @summary Get the properties of a Container Apps Job. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Get.json + */ +async function getContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.get(resourceGroupName, jobName); + console.log(result); +} + +async function main() { + getContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListByResourceGroupSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListByResourceGroupSample.js new file mode 100644 index 000000000000..56dec80d62be --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListByResourceGroupSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Container Apps Jobs in a given resource group. + * + * @summary Get the Container Apps Jobs in a given resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListByResourceGroup.json + */ +async function listContainerAppsJobsByResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobs.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppsJobsByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListBySubscriptionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListBySubscriptionSample.js new file mode 100644 index 000000000000..bf0db4dce839 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListBySubscriptionSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Container Apps Jobs in a given subscription. + * + * @summary Get the Container Apps Jobs in a given subscription. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListBySubscription.json + */ +async function listContainerAppsJobsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobs.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppsJobsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListSecretsSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListSecretsSample.js new file mode 100644 index 000000000000..66a94294d9a6 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsListSecretsSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List secrets for a container apps job + * + * @summary List secrets for a container apps job + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_ListSecrets.json + */ +async function listContainerAppsJobSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.listSecrets(resourceGroupName, jobName); + console.log(result); +} + +async function main() { + listContainerAppsJobSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStartSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStartSample.js new file mode 100644 index 000000000000..4d16e886aff5 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStartSample.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Start a Container Apps Job + * + * @summary Start a Container Apps Job + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Start.json + */ +async function runAContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const template = { + containers: [ + { + name: "testcontainerAppsJob0", + image: "repo/testcontainerAppsJob0:v4", + resources: { cpu: 0.2, memory: "100Mi" }, + }, + ], + initContainers: [ + { + name: "testinitcontainerAppsJob0", + args: ["-c", "while true; do echo hello; sleep 10;done"], + command: ["/bin/sh"], + image: "repo/testcontainerAppsJob0:v4", + resources: { cpu: 0.2, memory: "100Mi" }, + }, + ], + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginStartAndWait(resourceGroupName, jobName, template); + console.log(result); +} + +async function main() { + runAContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStopExecutionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStopExecutionSample.js new file mode 100644 index 000000000000..327698f36587 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStopExecutionSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Terminates execution of a running container apps job + * + * @summary Terminates execution of a running container apps job + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Execution.json + */ +async function terminateAContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const jobExecutionName = "jobExecution1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginStopExecutionAndWait( + resourceGroupName, + jobName, + jobExecutionName + ); + console.log(result); +} + +async function main() { + terminateAContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStopMultipleExecutionsSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStopMultipleExecutionsSample.js new file mode 100644 index 000000000000..15e4eb266727 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsStopMultipleExecutionsSample.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Terminates execution of a running container apps job + * + * @summary Terminates execution of a running container apps job + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Multiple.json + */ +async function terminateMultipleContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const jobExecutionName = { + value: [ + { name: "jobExecution-27944453" }, + { name: "jobExecution-27944452" }, + { name: "jobExecution-27944451" }, + ], + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginStopMultipleExecutionsAndWait( + resourceGroupName, + jobName, + jobExecutionName + ); + console.log(result); +} + +async function main() { + terminateMultipleContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsUpdateSample.js new file mode 100644 index 000000000000..5c483b6da9ce --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/jobsUpdateSample.js @@ -0,0 +1,75 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Patches a Container Apps Job using JSON Merge Patch + * + * @summary Patches a Container Apps Job using JSON Merge Patch + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Patch.json + */ +async function patchContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const jobEnvelope = { + properties: { + configuration: { + manualTriggerConfig: { parallelism: 4, replicaCompletionCount: 1 }, + replicaRetryLimit: 10, + replicaTimeout: 10, + triggerType: "Manual", + }, + template: { + containers: [ + { + name: "testcontainerAppsJob0", + image: "repo/testcontainerAppsJob0:v1", + probes: [ + { + type: "Liveness", + httpGet: { + path: "/health", + httpHeaders: [{ name: "Custom-Header", value: "Awesome" }], + port: 8080, + }, + initialDelaySeconds: 3, + periodSeconds: 3, + }, + ], + }, + ], + initContainers: [ + { + name: "testinitcontainerAppsJob0", + args: ["-c", "while true; do echo hello; sleep 10;done"], + command: ["/bin/sh"], + image: "repo/testcontainerAppsJob0:v4", + resources: { cpu: 0.2, memory: "100Mi" }, + }, + ], + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginUpdateAndWait(resourceGroupName, jobName, jobEnvelope); + console.log(result); +} + +async function main() { + patchContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesCreateOrUpdateSample.js new file mode 100644 index 000000000000..a44df5e8f977 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesCreateOrUpdateSample.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or Update a Managed Certificate. + * + * @summary Create or Update a Managed Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_CreateOrUpdate.json + */ +async function createOrUpdateCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const managedCertificateName = "certificate-firendly-name"; + const managedCertificateEnvelope = { + location: "East US", + properties: { + domainControlValidation: "CNAME", + subjectName: "my-subject-name.company.country.net", + }, + }; + const options = { + managedCertificateEnvelope, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedCertificates.beginCreateOrUpdateAndWait( + resourceGroupName, + environmentName, + managedCertificateName, + options + ); + console.log(result); +} + +async function main() { + createOrUpdateCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesDeleteSample.js new file mode 100644 index 000000000000..efb80abcedcb --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the specified Managed Certificate. + * + * @summary Deletes the specified Managed Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Delete.json + */ +async function deleteCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const managedCertificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedCertificates.delete( + resourceGroupName, + environmentName, + managedCertificateName + ); + console.log(result); +} + +async function main() { + deleteCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesGetSample.js new file mode 100644 index 000000000000..8ec59431a1a0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the specified Managed Certificate. + * + * @summary Get the specified Managed Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Get.json + */ +async function getCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const managedCertificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedCertificates.get( + resourceGroupName, + environmentName, + managedCertificateName + ); + console.log(result); +} + +async function main() { + getCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesListSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesListSample.js new file mode 100644 index 000000000000..4dffaae47df7 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesListSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the Managed Certificates in a given managed environment. + * + * @summary Get the Managed Certificates in a given managed environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_ListByManagedEnvironment.json + */ +async function listManagedCertificatesByManagedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedCertificates.list(resourceGroupName, environmentName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listManagedCertificatesByManagedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesUpdateSample.js new file mode 100644 index 000000000000..b01cc0e38896 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedCertificatesUpdateSample.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Patches a managed certificate. Oly patching of tags is supported + * + * @summary Patches a managed certificate. Oly patching of tags is supported + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_Patch.json + */ +async function patchManagedCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const managedCertificateName = "certificate-firendly-name"; + const managedCertificateEnvelope = { + tags: { tag1: "value1", tag2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedCertificates.update( + resourceGroupName, + environmentName, + managedCertificateName, + managedCertificateEnvelope + ); + console.log(result); +} + +async function main() { + patchManagedCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentDiagnosticsGetDetectorSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentDiagnosticsGetDetectorSample.js new file mode 100644 index 000000000000..71224c189f1e --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentDiagnosticsGetDetectorSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the diagnostics data for a Managed Environment used to host container apps. + * + * @summary Get the diagnostics data for a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_Get.json + */ +async function getDiagnosticDataForAManagedEnvironments() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "mikono-workerapp-test-rg"; + const environmentName = "mikonokubeenv"; + const detectorName = "ManagedEnvAvailabilityMetrics"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentDiagnostics.getDetector( + resourceGroupName, + environmentName, + detectorName + ); + console.log(result); +} + +async function main() { + getDiagnosticDataForAManagedEnvironments(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentDiagnosticsListDetectorsSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentDiagnosticsListDetectorsSample.js new file mode 100644 index 000000000000..bccb1c6f42e5 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentDiagnosticsListDetectorsSample.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the list of diagnostics for a Managed Environment used to host container apps. + * + * @summary Get the list of diagnostics for a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_List.json + */ +async function getTheListOfAvailableDiagnosticDataForAManagedEnvironments() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "mikono-workerapp-test-rg"; + const environmentName = "mikonokubeenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentDiagnostics.listDetectors( + resourceGroupName, + environmentName + ); + console.log(result); +} + +async function main() { + getTheListOfAvailableDiagnosticDataForAManagedEnvironments(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..36b2fd96e2e6 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsCreateOrUpdateSample.js @@ -0,0 +1,141 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a Managed Environment used to host container apps. + * + * @summary Creates or updates a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json + */ +async function createEnvironmentWithCustomInfrastructureResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const environmentEnvelope = { + appLogsConfiguration: { + logAnalyticsConfiguration: { customerId: "string", sharedKey: "string" }, + }, + customDomainConfiguration: { + certificatePassword: "1234", + certificateValue: Buffer.from("Y2VydA=="), + dnsSuffix: "www.my-name.com", + }, + daprAIConnectionString: + "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + infrastructureResourceGroup: "myInfrastructureRgName", + location: "East US", + vnetConfiguration: { + infrastructureSubnetId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1", + }, + workloadProfiles: [ + { + name: "My-GP-01", + maximumCount: 12, + minimumCount: 3, + workloadProfileType: "GeneralPurpose", + }, + { + name: "My-MO-01", + maximumCount: 6, + minimumCount: 3, + workloadProfileType: "MemoryOptimized", + }, + { + name: "My-CO-01", + maximumCount: 6, + minimumCount: 3, + workloadProfileType: "ComputeOptimized", + }, + { name: "My-consumption-01", workloadProfileType: "Consumption" }, + ], + zoneRedundant: true, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.beginCreateOrUpdateAndWait( + resourceGroupName, + environmentName, + environmentEnvelope + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a Managed Environment used to host container apps. + * + * @summary Creates or updates a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CreateOrUpdate.json + */ +async function createEnvironments() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const environmentEnvelope = { + appLogsConfiguration: { + logAnalyticsConfiguration: { customerId: "string", sharedKey: "string" }, + }, + customDomainConfiguration: { + certificatePassword: "1234", + certificateValue: Buffer.from("Y2VydA=="), + dnsSuffix: "www.my-name.com", + }, + daprAIConnectionString: + "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + location: "East US", + vnetConfiguration: { + infrastructureSubnetId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1", + }, + workloadProfiles: [ + { + name: "My-GP-01", + maximumCount: 12, + minimumCount: 3, + workloadProfileType: "GeneralPurpose", + }, + { + name: "My-MO-01", + maximumCount: 6, + minimumCount: 3, + workloadProfileType: "MemoryOptimized", + }, + { + name: "My-CO-01", + maximumCount: 6, + minimumCount: 3, + workloadProfileType: "ComputeOptimized", + }, + { name: "My-consumption-01", workloadProfileType: "Consumption" }, + ], + zoneRedundant: true, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.beginCreateOrUpdateAndWait( + resourceGroupName, + environmentName, + environmentEnvelope + ); + console.log(result); +} + +async function main() { + createEnvironmentWithCustomInfrastructureResourceGroup(); + createEnvironments(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsDeleteSample.js new file mode 100644 index 000000000000..4533c2e129fc --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsDeleteSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a Managed Environment if it does not have any container apps. + * + * @summary Delete a Managed Environment if it does not have any container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Delete.json + */ +async function deleteEnvironmentByName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "examplekenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.beginDeleteAndWait( + resourceGroupName, + environmentName + ); + console.log(result); +} + +async function main() { + deleteEnvironmentByName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsDiagnosticsGetRootSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsDiagnosticsGetRootSample.js new file mode 100644 index 000000000000..318a7bfc5df9 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsDiagnosticsGetRootSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the properties of a Managed Environment used to host container apps. + * + * @summary Get the properties of a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json + */ +async function getEnvironmentsByName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsDiagnostics.getRoot( + resourceGroupName, + environmentName + ); + console.log(result); +} + +async function main() { + getEnvironmentsByName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsGetAuthTokenSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsGetAuthTokenSample.js new file mode 100644 index 000000000000..256752f46dfa --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsGetAuthTokenSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Checks if resource name is available. + * + * @summary Checks if resource name is available. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_GetAuthToken.json + */ +async function getManagedEnvironmentAuthToken() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const environmentName = "testenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.getAuthToken(resourceGroupName, environmentName); + console.log(result); +} + +async function main() { + getManagedEnvironmentAuthToken(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsGetSample.js new file mode 100644 index 000000000000..f4eeb4b79c8a --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsGetSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get the properties of a Managed Environment used to host container apps. + * + * @summary Get the properties of a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json + */ +async function getEnvironmentsByName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.get(resourceGroupName, environmentName); + console.log(result); +} + +async function main() { + getEnvironmentsByName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListByResourceGroupSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListByResourceGroupSample.js new file mode 100644 index 000000000000..994773a2df30 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListByResourceGroupSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all the Managed Environments in a resource group. + * + * @summary Get all the Managed Environments in a resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListByResourceGroup.json + */ +async function listEnvironmentsByResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedEnvironments.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEnvironmentsByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListBySubscriptionSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListBySubscriptionSample.js new file mode 100644 index 000000000000..9daad5ea4417 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListBySubscriptionSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all Managed Environments for a subscription. + * + * @summary Get all Managed Environments for a subscription. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListBySubscription.json + */ +async function listEnvironmentsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedEnvironments.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEnvironmentsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListWorkloadProfileStatesSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListWorkloadProfileStatesSample.js new file mode 100644 index 000000000000..d4e8a60faf62 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsListWorkloadProfileStatesSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all workload Profile States for a Managed Environment. + * + * @summary Get all workload Profile States for a Managed Environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json + */ +async function listEnvironmentsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedEnvironments.listWorkloadProfileStates( + resourceGroupName, + environmentName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEnvironmentsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesCreateOrUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesCreateOrUpdateSample.js new file mode 100644 index 000000000000..fb4bba072850 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesCreateOrUpdateSample.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update storage for a managedEnvironment. + * + * @summary Create or update storage for a managedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json + */ +async function createOrUpdateEnvironmentsStorage() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "managedEnv"; + const storageName = "jlaw-demo1"; + const storageEnvelope = { + properties: { + azureFile: { + accessMode: "ReadOnly", + accountKey: "key", + accountName: "account1", + shareName: "share1", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsStorages.createOrUpdate( + resourceGroupName, + environmentName, + storageName, + storageEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateEnvironmentsStorage(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesDeleteSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesDeleteSample.js new file mode 100644 index 000000000000..88c68224a743 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete storage for a managedEnvironment. + * + * @summary Delete storage for a managedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Delete.json + */ +async function listEnvironmentsStoragesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "managedEnv"; + const storageName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsStorages.delete( + resourceGroupName, + environmentName, + storageName + ); + console.log(result); +} + +async function main() { + listEnvironmentsStoragesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesGetSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesGetSample.js new file mode 100644 index 000000000000..18e65494acf1 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get storage for a managedEnvironment. + * + * @summary Get storage for a managedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Get.json + */ +async function getAEnvironmentsStoragePropertiesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "managedEnv"; + const storageName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsStorages.get( + resourceGroupName, + environmentName, + storageName + ); + console.log(result); +} + +async function main() { + getAEnvironmentsStoragePropertiesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesListSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesListSample.js new file mode 100644 index 000000000000..03f72507d247 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsStoragesListSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get all storages for a managedEnvironment. + * + * @summary Get all storages for a managedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_List.json + */ +async function listEnvironmentsStoragesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "managedEnv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsStorages.list(resourceGroupName, environmentName); + console.log(result); +} + +async function main() { + listEnvironmentsStoragesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsUpdateSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsUpdateSample.js new file mode 100644 index 000000000000..4e7ad340d912 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/managedEnvironmentsUpdateSample.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Patches a Managed Environment using JSON Merge Patch + * + * @summary Patches a Managed Environment using JSON Merge Patch + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Patch.json + */ +async function patchManagedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const environmentEnvelope = { + location: "East US", + tags: { tag1: "value1", tag2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.beginUpdateAndWait( + resourceGroupName, + environmentName, + environmentEnvelope + ); + console.log(result); +} + +async function main() { + patchManagedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/namespacesCheckNameAvailabilitySample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/namespacesCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..0f9aac11a593 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/namespacesCheckNameAvailabilitySample.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Checks if resource name is available. + * + * @summary Checks if resource name is available. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_CheckNameAvailability.json + */ +async function certificatesCheckNameAvailability() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const checkNameAvailabilityRequest = { + name: "testcertificatename", + type: "Microsoft.App/managedEnvironments/certificates", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.namespaces.checkNameAvailability( + resourceGroupName, + environmentName, + checkNameAvailabilityRequest + ); + console.log(result); +} + +/** + * This sample demonstrates how to Checks if resource name is available. + * + * @summary Checks if resource name is available. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CheckNameAvailability.json + */ +async function containerAppsCheckNameAvailability() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const checkNameAvailabilityRequest = { + name: "testcappname", + type: "Microsoft.App/containerApps", + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.namespaces.checkNameAvailability( + resourceGroupName, + environmentName, + checkNameAvailabilityRequest + ); + console.log(result); +} + +async function main() { + certificatesCheckNameAvailability(); + containerAppsCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/operationsListSample.js b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..2272f3a760d1 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/operationsListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all of the available RP operations. + * + * @summary Lists all of the available RP operations. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Operations_List.json + */ +async function listAllOperations() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllOperations(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/package.json b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/package.json new file mode 100644 index 000000000000..26b909b3012e --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-appcontainers-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/appcontainers/arm-appcontainers" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/appcontainers/arm-appcontainers", + "dependencies": { + "@azure/arm-appcontainers": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/sample.env b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/README.md b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/README.md new file mode 100644 index 000000000000..9f939fef3495 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/README.md @@ -0,0 +1,251 @@ +# client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [availableWorkloadProfilesGetSample.ts][availableworkloadprofilesgetsample] | Get all available workload profiles for a location. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AvailableWorkloadProfiles_Get.json | +| [billingMetersGetSample.ts][billingmetersgetsample] | Get all billingMeters for a location. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/BillingMeters_Get.json | +| [certificatesCreateOrUpdateSample.ts][certificatescreateorupdatesample] | Create or Update a Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_CreateOrUpdate.json | +| [certificatesDeleteSample.ts][certificatesdeletesample] | Deletes the specified Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Delete.json | +| [certificatesGetSample.ts][certificatesgetsample] | Get the specified Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Get.json | +| [certificatesListSample.ts][certificateslistsample] | Get the Certificates in a given managed environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_ListByManagedEnvironment.json | +| [certificatesUpdateSample.ts][certificatesupdatesample] | Patches a certificate. Currently only patching of tags is supported x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_Patch.json | +| [connectedEnvironmentsCertificatesCreateOrUpdateSample.ts][connectedenvironmentscertificatescreateorupdatesample] | Create or Update a Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json | +| [connectedEnvironmentsCertificatesDeleteSample.ts][connectedenvironmentscertificatesdeletesample] | Deletes the specified Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Delete.json | +| [connectedEnvironmentsCertificatesGetSample.ts][connectedenvironmentscertificatesgetsample] | Get the specified Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Get.json | +| [connectedEnvironmentsCertificatesListSample.ts][connectedenvironmentscertificateslistsample] | Get the Certificates in a given connected environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json | +| [connectedEnvironmentsCertificatesUpdateSample.ts][connectedenvironmentscertificatesupdatesample] | Patches a certificate. Currently only patching of tags is supported x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_Patch.json | +| [connectedEnvironmentsCheckNameAvailabilitySample.ts][connectedenvironmentschecknameavailabilitysample] | Checks if resource connectedEnvironmentName is available. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json | +| [connectedEnvironmentsCreateOrUpdateSample.ts][connectedenvironmentscreateorupdatesample] | Creates or updates an connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_CreateOrUpdate.json | +| [connectedEnvironmentsDaprComponentsCreateOrUpdateSample.ts][connectedenvironmentsdaprcomponentscreateorupdatesample] | Creates or updates a Dapr Component in a connected environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json | +| [connectedEnvironmentsDaprComponentsDeleteSample.ts][connectedenvironmentsdaprcomponentsdeletesample] | Delete a Dapr Component from a connected environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json | +| [connectedEnvironmentsDaprComponentsGetSample.ts][connectedenvironmentsdaprcomponentsgetsample] | Get a dapr component. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json | +| [connectedEnvironmentsDaprComponentsListSample.ts][connectedenvironmentsdaprcomponentslistsample] | Get the Dapr Components for a connected environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_List.json | +| [connectedEnvironmentsDaprComponentsListSecretsSample.ts][connectedenvironmentsdaprcomponentslistsecretssample] | List secrets for a dapr component x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json | +| [connectedEnvironmentsDeleteSample.ts][connectedenvironmentsdeletesample] | Delete an connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Delete.json | +| [connectedEnvironmentsGetSample.ts][connectedenvironmentsgetsample] | Get the properties of an connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Get.json | +| [connectedEnvironmentsListByResourceGroupSample.ts][connectedenvironmentslistbyresourcegroupsample] | Get all connectedEnvironments in a resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListByResourceGroup.json | +| [connectedEnvironmentsListBySubscriptionSample.ts][connectedenvironmentslistbysubscriptionsample] | Get all connectedEnvironments for a subscription. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListBySubscription.json | +| [connectedEnvironmentsStoragesCreateOrUpdateSample.ts][connectedenvironmentsstoragescreateorupdatesample] | Create or update storage for a connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json | +| [connectedEnvironmentsStoragesDeleteSample.ts][connectedenvironmentsstoragesdeletesample] | Delete storage for a connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Delete.json | +| [connectedEnvironmentsStoragesGetSample.ts][connectedenvironmentsstoragesgetsample] | Get storage for a connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Get.json | +| [connectedEnvironmentsStoragesListSample.ts][connectedenvironmentsstorageslistsample] | Get all storages for a connectedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_List.json | +| [connectedEnvironmentsUpdateSample.ts][connectedenvironmentsupdatesample] | Patches a Managed Environment. Only patching of tags is supported currently x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Patch.json | +| [containerAppsAuthConfigsCreateOrUpdateSample.ts][containerappsauthconfigscreateorupdatesample] | Create or update the AuthConfig for a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_CreateOrUpdate.json | +| [containerAppsAuthConfigsDeleteSample.ts][containerappsauthconfigsdeletesample] | Delete a Container App AuthConfig. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Delete.json | +| [containerAppsAuthConfigsGetSample.ts][containerappsauthconfigsgetsample] | Get a AuthConfig of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Get.json | +| [containerAppsAuthConfigsListByContainerAppSample.ts][containerappsauthconfigslistbycontainerappsample] | Get the Container App AuthConfigs in a given resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_ListByContainer.json | +| [containerAppsCreateOrUpdateSample.ts][containerappscreateorupdatesample] | Create or update a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CreateOrUpdate.json | +| [containerAppsDeleteSample.ts][containerappsdeletesample] | Delete a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Delete.json | +| [containerAppsDiagnosticsGetDetectorSample.ts][containerappsdiagnosticsgetdetectorsample] | Get a diagnostics result of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_Get.json | +| [containerAppsDiagnosticsGetRevisionSample.ts][containerappsdiagnosticsgetrevisionsample] | Get a revision of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json | +| [containerAppsDiagnosticsGetRootSample.ts][containerappsdiagnosticsgetrootsample] | Get the properties of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json | +| [containerAppsDiagnosticsListDetectorsSample.ts][containerappsdiagnosticslistdetectorssample] | Get the list of diagnostics for a given Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_List.json | +| [containerAppsDiagnosticsListRevisionsSample.ts][containerappsdiagnosticslistrevisionssample] | Get the Revisions for a given Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json | +| [containerAppsGetAuthTokenSample.ts][containerappsgetauthtokensample] | Get auth token for a container app x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_GetAuthToken.json | +| [containerAppsGetSample.ts][containerappsgetsample] | Get the properties of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json | +| [containerAppsListByResourceGroupSample.ts][containerappslistbyresourcegroupsample] | Get the Container Apps in a given resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListByResourceGroup.json | +| [containerAppsListBySubscriptionSample.ts][containerappslistbysubscriptionsample] | Get the Container Apps in a given subscription. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListBySubscription.json | +| [containerAppsListCustomHostNameAnalysisSample.ts][containerappslistcustomhostnameanalysissample] | Analyzes a custom hostname for a Container App x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json | +| [containerAppsListSecretsSample.ts][containerappslistsecretssample] | List secrets for a container app x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListSecrets.json | +| [containerAppsRevisionReplicasGetReplicaSample.ts][containerappsrevisionreplicasgetreplicasample] | Get a replica for a Container App Revision. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_Get.json | +| [containerAppsRevisionReplicasListReplicasSample.ts][containerappsrevisionreplicaslistreplicassample] | List replicas for a Container App Revision. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_List.json | +| [containerAppsRevisionsActivateRevisionSample.ts][containerappsrevisionsactivaterevisionsample] | Activates a revision for a Container App x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Activate.json | +| [containerAppsRevisionsDeactivateRevisionSample.ts][containerappsrevisionsdeactivaterevisionsample] | Deactivates a revision for a Container App x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Deactivate.json | +| [containerAppsRevisionsGetRevisionSample.ts][containerappsrevisionsgetrevisionsample] | Get a revision of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json | +| [containerAppsRevisionsListRevisionsSample.ts][containerappsrevisionslistrevisionssample] | Get the Revisions for a given Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json | +| [containerAppsRevisionsRestartRevisionSample.ts][containerappsrevisionsrestartrevisionsample] | Restarts a revision for a Container App x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Restart.json | +| [containerAppsSourceControlsCreateOrUpdateSample.ts][containerappssourcecontrolscreateorupdatesample] | Create or update the SourceControl for a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_CreateOrUpdate.json | +| [containerAppsSourceControlsDeleteSample.ts][containerappssourcecontrolsdeletesample] | Delete a Container App SourceControl. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Delete.json | +| [containerAppsSourceControlsGetSample.ts][containerappssourcecontrolsgetsample] | Get a SourceControl of a Container App. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Get.json | +| [containerAppsSourceControlsListByContainerAppSample.ts][containerappssourcecontrolslistbycontainerappsample] | Get the Container App SourceControls in a given resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_ListByContainer.json | +| [containerAppsUpdateSample.ts][containerappsupdatesample] | Patches a Container App using JSON Merge Patch x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Patch.json | +| [daprComponentsCreateOrUpdateSample.ts][daprcomponentscreateorupdatesample] | Creates or updates a Dapr Component in a Managed Environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json | +| [daprComponentsDeleteSample.ts][daprcomponentsdeletesample] | Delete a Dapr Component from a Managed Environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Delete.json | +| [daprComponentsGetSample.ts][daprcomponentsgetsample] | Get a dapr component. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_SecretStoreComponent.json | +| [daprComponentsListSample.ts][daprcomponentslistsample] | Get the Dapr Components for a managed environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_List.json | +| [daprComponentsListSecretsSample.ts][daprcomponentslistsecretssample] | List secrets for a dapr component x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_ListSecrets.json | +| [jobsCreateOrUpdateSample.ts][jobscreateorupdatesample] | Create or Update a Container Apps Job. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_CreateorUpdate.json | +| [jobsDeleteSample.ts][jobsdeletesample] | Delete a Container Apps Job. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Delete.json | +| [jobsExecutionsListSample.ts][jobsexecutionslistsample] | Get a Container Apps Job's executions x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Executions_Get.json | +| [jobsGetSample.ts][jobsgetsample] | Get the properties of a Container Apps Job. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Get.json | +| [jobsListByResourceGroupSample.ts][jobslistbyresourcegroupsample] | Get the Container Apps Jobs in a given resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListByResourceGroup.json | +| [jobsListBySubscriptionSample.ts][jobslistbysubscriptionsample] | Get the Container Apps Jobs in a given subscription. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListBySubscription.json | +| [jobsListSecretsSample.ts][jobslistsecretssample] | List secrets for a container apps job x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_ListSecrets.json | +| [jobsStartSample.ts][jobsstartsample] | Start a Container Apps Job x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Start.json | +| [jobsStopExecutionSample.ts][jobsstopexecutionsample] | Terminates execution of a running container apps job x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Execution.json | +| [jobsStopMultipleExecutionsSample.ts][jobsstopmultipleexecutionssample] | Terminates execution of a running container apps job x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Multiple.json | +| [jobsUpdateSample.ts][jobsupdatesample] | Patches a Container Apps Job using JSON Merge Patch x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Patch.json | +| [managedCertificatesCreateOrUpdateSample.ts][managedcertificatescreateorupdatesample] | Create or Update a Managed Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_CreateOrUpdate.json | +| [managedCertificatesDeleteSample.ts][managedcertificatesdeletesample] | Deletes the specified Managed Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Delete.json | +| [managedCertificatesGetSample.ts][managedcertificatesgetsample] | Get the specified Managed Certificate. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Get.json | +| [managedCertificatesListSample.ts][managedcertificateslistsample] | Get the Managed Certificates in a given managed environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_ListByManagedEnvironment.json | +| [managedCertificatesUpdateSample.ts][managedcertificatesupdatesample] | Patches a managed certificate. Oly patching of tags is supported x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_Patch.json | +| [managedEnvironmentDiagnosticsGetDetectorSample.ts][managedenvironmentdiagnosticsgetdetectorsample] | Get the diagnostics data for a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_Get.json | +| [managedEnvironmentDiagnosticsListDetectorsSample.ts][managedenvironmentdiagnosticslistdetectorssample] | Get the list of diagnostics for a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_List.json | +| [managedEnvironmentsCreateOrUpdateSample.ts][managedenvironmentscreateorupdatesample] | Creates or updates a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json | +| [managedEnvironmentsDeleteSample.ts][managedenvironmentsdeletesample] | Delete a Managed Environment if it does not have any container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Delete.json | +| [managedEnvironmentsDiagnosticsGetRootSample.ts][managedenvironmentsdiagnosticsgetrootsample] | Get the properties of a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json | +| [managedEnvironmentsGetAuthTokenSample.ts][managedenvironmentsgetauthtokensample] | Checks if resource name is available. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_GetAuthToken.json | +| [managedEnvironmentsGetSample.ts][managedenvironmentsgetsample] | Get the properties of a Managed Environment used to host container apps. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json | +| [managedEnvironmentsListByResourceGroupSample.ts][managedenvironmentslistbyresourcegroupsample] | Get all the Managed Environments in a resource group. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListByResourceGroup.json | +| [managedEnvironmentsListBySubscriptionSample.ts][managedenvironmentslistbysubscriptionsample] | Get all Managed Environments for a subscription. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListBySubscription.json | +| [managedEnvironmentsListWorkloadProfileStatesSample.ts][managedenvironmentslistworkloadprofilestatessample] | Get all workload Profile States for a Managed Environment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json | +| [managedEnvironmentsStoragesCreateOrUpdateSample.ts][managedenvironmentsstoragescreateorupdatesample] | Create or update storage for a managedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json | +| [managedEnvironmentsStoragesDeleteSample.ts][managedenvironmentsstoragesdeletesample] | Delete storage for a managedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Delete.json | +| [managedEnvironmentsStoragesGetSample.ts][managedenvironmentsstoragesgetsample] | Get storage for a managedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Get.json | +| [managedEnvironmentsStoragesListSample.ts][managedenvironmentsstorageslistsample] | Get all storages for a managedEnvironment. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_List.json | +| [managedEnvironmentsUpdateSample.ts][managedenvironmentsupdatesample] | Patches a Managed Environment using JSON Merge Patch x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Patch.json | +| [namespacesCheckNameAvailabilitySample.ts][namespaceschecknameavailabilitysample] | Checks if resource name is available. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_CheckNameAvailability.json | +| [operationsListSample.ts][operationslistsample] | Lists all of the available RP operations. x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Operations_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/availableWorkloadProfilesGetSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env APPCONTAINERS_SUBSCRIPTION_ID="" node dist/availableWorkloadProfilesGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[availableworkloadprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/availableWorkloadProfilesGetSample.ts +[billingmetersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/billingMetersGetSample.ts +[certificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesCreateOrUpdateSample.ts +[certificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesDeleteSample.ts +[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesGetSample.ts +[certificateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesListSample.ts +[certificatesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesUpdateSample.ts +[connectedenvironmentscertificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesCreateOrUpdateSample.ts +[connectedenvironmentscertificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesDeleteSample.ts +[connectedenvironmentscertificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesGetSample.ts +[connectedenvironmentscertificateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesListSample.ts +[connectedenvironmentscertificatesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesUpdateSample.ts +[connectedenvironmentschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCheckNameAvailabilitySample.ts +[connectedenvironmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCreateOrUpdateSample.ts +[connectedenvironmentsdaprcomponentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsCreateOrUpdateSample.ts +[connectedenvironmentsdaprcomponentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsDeleteSample.ts +[connectedenvironmentsdaprcomponentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsGetSample.ts +[connectedenvironmentsdaprcomponentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsListSample.ts +[connectedenvironmentsdaprcomponentslistsecretssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsListSecretsSample.ts +[connectedenvironmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDeleteSample.ts +[connectedenvironmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsGetSample.ts +[connectedenvironmentslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsListByResourceGroupSample.ts +[connectedenvironmentslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsListBySubscriptionSample.ts +[connectedenvironmentsstoragescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesCreateOrUpdateSample.ts +[connectedenvironmentsstoragesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesDeleteSample.ts +[connectedenvironmentsstoragesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesGetSample.ts +[connectedenvironmentsstorageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesListSample.ts +[connectedenvironmentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsUpdateSample.ts +[containerappsauthconfigscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsCreateOrUpdateSample.ts +[containerappsauthconfigsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsDeleteSample.ts +[containerappsauthconfigsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsGetSample.ts +[containerappsauthconfigslistbycontainerappsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsListByContainerAppSample.ts +[containerappscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsCreateOrUpdateSample.ts +[containerappsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDeleteSample.ts +[containerappsdiagnosticsgetdetectorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetDetectorSample.ts +[containerappsdiagnosticsgetrevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetRevisionSample.ts +[containerappsdiagnosticsgetrootsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetRootSample.ts +[containerappsdiagnosticslistdetectorssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsListDetectorsSample.ts +[containerappsdiagnosticslistrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsListRevisionsSample.ts +[containerappsgetauthtokensample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsGetAuthTokenSample.ts +[containerappsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsGetSample.ts +[containerappslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListByResourceGroupSample.ts +[containerappslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListBySubscriptionSample.ts +[containerappslistcustomhostnameanalysissample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListCustomHostNameAnalysisSample.ts +[containerappslistsecretssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListSecretsSample.ts +[containerappsrevisionreplicasgetreplicasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionReplicasGetReplicaSample.ts +[containerappsrevisionreplicaslistreplicassample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionReplicasListReplicasSample.ts +[containerappsrevisionsactivaterevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsActivateRevisionSample.ts +[containerappsrevisionsdeactivaterevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsDeactivateRevisionSample.ts +[containerappsrevisionsgetrevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsGetRevisionSample.ts +[containerappsrevisionslistrevisionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsListRevisionsSample.ts +[containerappsrevisionsrestartrevisionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsRestartRevisionSample.ts +[containerappssourcecontrolscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsCreateOrUpdateSample.ts +[containerappssourcecontrolsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsDeleteSample.ts +[containerappssourcecontrolsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsGetSample.ts +[containerappssourcecontrolslistbycontainerappsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsListByContainerAppSample.ts +[containerappsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsUpdateSample.ts +[daprcomponentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsCreateOrUpdateSample.ts +[daprcomponentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsDeleteSample.ts +[daprcomponentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsGetSample.ts +[daprcomponentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsListSample.ts +[daprcomponentslistsecretssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsListSecretsSample.ts +[jobscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsCreateOrUpdateSample.ts +[jobsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsDeleteSample.ts +[jobsexecutionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsExecutionsListSample.ts +[jobsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsGetSample.ts +[jobslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListByResourceGroupSample.ts +[jobslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListBySubscriptionSample.ts +[jobslistsecretssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListSecretsSample.ts +[jobsstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStartSample.ts +[jobsstopexecutionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStopExecutionSample.ts +[jobsstopmultipleexecutionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStopMultipleExecutionsSample.ts +[jobsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsUpdateSample.ts +[managedcertificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesCreateOrUpdateSample.ts +[managedcertificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesDeleteSample.ts +[managedcertificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesGetSample.ts +[managedcertificateslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesListSample.ts +[managedcertificatesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesUpdateSample.ts +[managedenvironmentdiagnosticsgetdetectorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentDiagnosticsGetDetectorSample.ts +[managedenvironmentdiagnosticslistdetectorssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentDiagnosticsListDetectorsSample.ts +[managedenvironmentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsCreateOrUpdateSample.ts +[managedenvironmentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsDeleteSample.ts +[managedenvironmentsdiagnosticsgetrootsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsDiagnosticsGetRootSample.ts +[managedenvironmentsgetauthtokensample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsGetAuthTokenSample.ts +[managedenvironmentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsGetSample.ts +[managedenvironmentslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListByResourceGroupSample.ts +[managedenvironmentslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListBySubscriptionSample.ts +[managedenvironmentslistworkloadprofilestatessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListWorkloadProfileStatesSample.ts +[managedenvironmentsstoragescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesCreateOrUpdateSample.ts +[managedenvironmentsstoragesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesDeleteSample.ts +[managedenvironmentsstoragesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesGetSample.ts +[managedenvironmentsstorageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesListSample.ts +[managedenvironmentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsUpdateSample.ts +[namespaceschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/namespacesCheckNameAvailabilitySample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/operationsListSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-appcontainers?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/appcontainers/arm-appcontainers/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/package.json b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/package.json new file mode 100644 index 000000000000..2d9864e0c891 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-appcontainers-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/appcontainers/arm-appcontainers" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/appcontainers/arm-appcontainers", + "dependencies": { + "@azure/arm-appcontainers": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~5.0.0", + "rimraf": "latest" + } +} diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/sample.env b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/availableWorkloadProfilesGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/availableWorkloadProfilesGetSample.ts new file mode 100644 index 000000000000..c1b852734e23 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/availableWorkloadProfilesGetSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all available workload profiles for a location. + * + * @summary Get all available workload profiles for a location. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AvailableWorkloadProfiles_Get.json + */ +async function billingMetersGet() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "East US"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.availableWorkloadProfiles.list(location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + billingMetersGet(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/billingMetersGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/billingMetersGetSample.ts new file mode 100644 index 000000000000..6ef7d5fe2483 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/billingMetersGetSample.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all billingMeters for a location. + * + * @summary Get all billingMeters for a location. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/BillingMeters_Get.json + */ +async function billingMetersGet() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const location = "East US"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.billingMeters.get(location); + console.log(result); +} + +async function main() { + billingMetersGet(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..427265a7faf6 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesCreateOrUpdateSample.ts @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + Certificate, + CertificatesCreateOrUpdateOptionalParams, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or Update a Certificate. + * + * @summary Create or Update a Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_CreateOrUpdate.json + */ +async function createOrUpdateCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const certificateEnvelope: Certificate = { + location: "East US", + properties: { + password: "private key password", + value: Buffer.from("Y2VydA==") + } + }; + const options: CertificatesCreateOrUpdateOptionalParams = { + certificateEnvelope + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate( + resourceGroupName, + environmentName, + certificateName, + options + ); + console.log(result); +} + +async function main() { + createOrUpdateCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesDeleteSample.ts new file mode 100644 index 000000000000..921aea9b75bc --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the specified Certificate. + * + * @summary Deletes the specified Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Delete.json + */ +async function deleteCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.certificates.delete( + resourceGroupName, + environmentName, + certificateName + ); + console.log(result); +} + +async function main() { + deleteCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesGetSample.ts new file mode 100644 index 000000000000..9ea615439f30 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the specified Certificate. + * + * @summary Get the specified Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Get.json + */ +async function getCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.certificates.get( + resourceGroupName, + environmentName, + certificateName + ); + console.log(result); +} + +async function main() { + getCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesListSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesListSample.ts new file mode 100644 index 000000000000..ed459b096c87 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesListSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Certificates in a given managed environment. + * + * @summary Get the Certificates in a given managed environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_ListByManagedEnvironment.json + */ +async function listCertificatesByManagedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.certificates.list( + resourceGroupName, + environmentName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesByManagedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesUpdateSample.ts new file mode 100644 index 000000000000..3256b0faa04a --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/certificatesUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CertificatePatch, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Patches a certificate. Currently only patching of tags is supported + * + * @summary Patches a certificate. Currently only patching of tags is supported + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_Patch.json + */ +async function patchCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const certificateEnvelope: CertificatePatch = { + tags: { tag1: "value1", tag2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.certificates.update( + resourceGroupName, + environmentName, + certificateName, + certificateEnvelope + ); + console.log(result); +} + +async function main() { + patchCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..4e3287d0f52c --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesCreateOrUpdateSample.ts @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + Certificate, + ConnectedEnvironmentsCertificatesCreateOrUpdateOptionalParams, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or Update a Certificate. + * + * @summary Create or Update a Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json + */ +async function createOrUpdateCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const certificateEnvelope: Certificate = { + location: "East US", + properties: { + password: "private key password", + value: Buffer.from("Y2VydA==") + } + }; + const options: ConnectedEnvironmentsCertificatesCreateOrUpdateOptionalParams = { + certificateEnvelope + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsCertificates.createOrUpdate( + resourceGroupName, + connectedEnvironmentName, + certificateName, + options + ); + console.log(result); +} + +async function main() { + createOrUpdateCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesDeleteSample.ts new file mode 100644 index 000000000000..ec12520c0494 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the specified Certificate. + * + * @summary Deletes the specified Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Delete.json + */ +async function deleteCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsCertificates.delete( + resourceGroupName, + connectedEnvironmentName, + certificateName + ); + console.log(result); +} + +async function main() { + deleteCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesGetSample.ts new file mode 100644 index 000000000000..e1baa23f157d --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the specified Certificate. + * + * @summary Get the specified Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Get.json + */ +async function getCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsCertificates.get( + resourceGroupName, + connectedEnvironmentName, + certificateName + ); + console.log(result); +} + +async function main() { + getCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesListSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesListSample.ts new file mode 100644 index 000000000000..9a1ade0f3c50 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesListSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Certificates in a given connected environment. + * + * @summary Get the Certificates in a given connected environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json + */ +async function listCertificatesByConnectedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.connectedEnvironmentsCertificates.list( + resourceGroupName, + connectedEnvironmentName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listCertificatesByConnectedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesUpdateSample.ts new file mode 100644 index 000000000000..315475d52aaa --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCertificatesUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CertificatePatch, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Patches a certificate. Currently only patching of tags is supported + * + * @summary Patches a certificate. Currently only patching of tags is supported + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_Patch.json + */ +async function patchCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const certificateName = "certificate-firendly-name"; + const certificateEnvelope: CertificatePatch = { + tags: { tag1: "value1", tag2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsCertificates.update( + resourceGroupName, + connectedEnvironmentName, + certificateName, + certificateEnvelope + ); + console.log(result); +} + +async function main() { + patchCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCheckNameAvailabilitySample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..4e1459b577df --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCheckNameAvailabilitySample.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CheckNameAvailabilityRequest, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Checks if resource connectedEnvironmentName is available. + * + * @summary Checks if resource connectedEnvironmentName is available. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json + */ +async function certificatesCheckNameAvailability() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testcontainerenv"; + const checkNameAvailabilityRequest: CheckNameAvailabilityRequest = { + name: "testcertificatename", + type: "Microsoft.App/connectedEnvironments/certificates" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.checkNameAvailability( + resourceGroupName, + connectedEnvironmentName, + checkNameAvailabilityRequest + ); + console.log(result); +} + +async function main() { + certificatesCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..414997d18432 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsCreateOrUpdateSample.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConnectedEnvironment, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an connectedEnvironment. + * + * @summary Creates or updates an connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_CreateOrUpdate.json + */ +async function createKubeEnvironments() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testenv"; + const environmentEnvelope: ConnectedEnvironment = { + customDomainConfiguration: { + certificatePassword: "private key password", + certificateValue: Buffer.from("Y2VydA=="), + dnsSuffix: "www.my-name.com" + }, + daprAIConnectionString: + "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + location: "East US", + staticIp: "1.2.3.4" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.beginCreateOrUpdateAndWait( + resourceGroupName, + connectedEnvironmentName, + environmentEnvelope + ); + console.log(result); +} + +async function main() { + createKubeEnvironments(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ed5bcbcf828c --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsCreateOrUpdateSample.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + DaprComponent, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Dapr Component in a connected environment. + * + * @summary Creates or updates a Dapr Component in a connected environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json + */ +async function createOrUpdateDaprComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const componentName = "reddog"; + const daprComponentEnvelope: DaprComponent = { + componentType: "state.azure.cosmosdb", + ignoreErrors: false, + initTimeout: "50s", + metadata: [ + { name: "url", value: "" }, + { name: "database", value: "itemsDB" }, + { name: "collection", value: "items" }, + { name: "masterkey", secretRef: "masterkey" } + ], + scopes: ["container-app-1", "container-app-2"], + secrets: [{ name: "masterkey", value: "keyvalue" }], + version: "v1" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsDaprComponents.createOrUpdate( + resourceGroupName, + connectedEnvironmentName, + componentName, + daprComponentEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateDaprComponent(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsDeleteSample.ts new file mode 100644 index 000000000000..368ecf926c6a --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a Dapr Component from a connected environment. + * + * @summary Delete a Dapr Component from a connected environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json + */ +async function deleteDaprComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsDaprComponents.delete( + resourceGroupName, + connectedEnvironmentName, + componentName + ); + console.log(result); +} + +async function main() { + deleteDaprComponent(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsGetSample.ts new file mode 100644 index 000000000000..e2786d2c7fa3 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a dapr component. + * + * @summary Get a dapr component. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json + */ +async function getDaprComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsDaprComponents.get( + resourceGroupName, + connectedEnvironmentName, + componentName + ); + console.log(result); +} + +async function main() { + getDaprComponent(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsListSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsListSample.ts new file mode 100644 index 000000000000..19094d5d885e --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsListSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Dapr Components for a connected environment. + * + * @summary Get the Dapr Components for a connected environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_List.json + */ +async function listDaprComponents() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.connectedEnvironmentsDaprComponents.list( + resourceGroupName, + connectedEnvironmentName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listDaprComponents(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsListSecretsSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsListSecretsSample.ts new file mode 100644 index 000000000000..557f3b108cc1 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDaprComponentsListSecretsSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List secrets for a dapr component + * + * @summary List secrets for a dapr component + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json + */ +async function listContainerAppsSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsDaprComponents.listSecrets( + resourceGroupName, + connectedEnvironmentName, + componentName + ); + console.log(result); +} + +async function main() { + listContainerAppsSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDeleteSample.ts new file mode 100644 index 000000000000..26674465f43a --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete an connectedEnvironment. + * + * @summary Delete an connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Delete.json + */ +async function deleteConnectedEnvironmentByConnectedEnvironmentName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "examplekenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.beginDeleteAndWait( + resourceGroupName, + connectedEnvironmentName + ); + console.log(result); +} + +async function main() { + deleteConnectedEnvironmentByConnectedEnvironmentName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsGetSample.ts new file mode 100644 index 000000000000..d89d060736a1 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsGetSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the properties of an connectedEnvironment. + * + * @summary Get the properties of an connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Get.json + */ +async function getConnectedEnvironmentByConnectedEnvironmentName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "examplekenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.get( + resourceGroupName, + connectedEnvironmentName + ); + console.log(result); +} + +async function main() { + getConnectedEnvironmentByConnectedEnvironmentName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsListByResourceGroupSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsListByResourceGroupSample.ts new file mode 100644 index 000000000000..725f561968c0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsListByResourceGroupSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all connectedEnvironments in a resource group. + * + * @summary Get all connectedEnvironments in a resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListByResourceGroup.json + */ +async function listEnvironmentsByResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.connectedEnvironments.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEnvironmentsByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsListBySubscriptionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsListBySubscriptionSample.ts new file mode 100644 index 000000000000..e52528c74c64 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsListBySubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all connectedEnvironments for a subscription. + * + * @summary Get all connectedEnvironments for a subscription. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListBySubscription.json + */ +async function listConnectedEnvironmentsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.connectedEnvironments.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listConnectedEnvironmentsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..159b0fd37e02 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesCreateOrUpdateSample.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ConnectedEnvironmentStorage, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update storage for a connectedEnvironment. + * + * @summary Create or update storage for a connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json + */ +async function createOrUpdateEnvironmentsStorage() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "env"; + const storageName = "jlaw-demo1"; + const storageEnvelope: ConnectedEnvironmentStorage = { + properties: { + azureFile: { + accessMode: "ReadOnly", + accountKey: "key", + accountName: "account1", + shareName: "share1" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsStorages.createOrUpdate( + resourceGroupName, + connectedEnvironmentName, + storageName, + storageEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateEnvironmentsStorage(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesDeleteSample.ts new file mode 100644 index 000000000000..119a17a00f5e --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete storage for a connectedEnvironment. + * + * @summary Delete storage for a connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Delete.json + */ +async function listEnvironmentsStoragesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "env"; + const storageName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsStorages.delete( + resourceGroupName, + connectedEnvironmentName, + storageName + ); + console.log(result); +} + +async function main() { + listEnvironmentsStoragesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesGetSample.ts new file mode 100644 index 000000000000..069492c1d62d --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get storage for a connectedEnvironment. + * + * @summary Get storage for a connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Get.json + */ +async function getAEnvironmentsStoragePropertiesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "env"; + const storageName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsStorages.get( + resourceGroupName, + connectedEnvironmentName, + storageName + ); + console.log(result); +} + +async function main() { + getAEnvironmentsStoragePropertiesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesListSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesListSample.ts new file mode 100644 index 000000000000..d26e9c473719 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsStoragesListSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all storages for a connectedEnvironment. + * + * @summary Get all storages for a connectedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_List.json + */ +async function listEnvironmentsStoragesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "managedEnv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironmentsStorages.list( + resourceGroupName, + connectedEnvironmentName + ); + console.log(result); +} + +async function main() { + listEnvironmentsStoragesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsUpdateSample.ts new file mode 100644 index 000000000000..f0cf7d8cc859 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/connectedEnvironmentsUpdateSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Patches a Managed Environment. Only patching of tags is supported currently + * + * @summary Patches a Managed Environment. Only patching of tags is supported currently + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Patch.json + */ +async function patchManagedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const connectedEnvironmentName = "testenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.connectedEnvironments.update( + resourceGroupName, + connectedEnvironmentName + ); + console.log(result); +} + +async function main() { + patchManagedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..f743fdf5197b --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsCreateOrUpdateSample.ts @@ -0,0 +1,55 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AuthConfig, ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update the AuthConfig for a Container App. + * + * @summary Create or update the AuthConfig for a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_CreateOrUpdate.json + */ +async function createOrUpdateContainerAppAuthConfig() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const authConfigName = "current"; + const authConfigEnvelope: AuthConfig = { + globalValidation: { unauthenticatedClientAction: "AllowAnonymous" }, + identityProviders: { + facebook: { + registration: { appId: "123", appSecretSettingName: "facebook-secret" } + } + }, + platform: { enabled: true } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsAuthConfigs.createOrUpdate( + resourceGroupName, + containerAppName, + authConfigName, + authConfigEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateContainerAppAuthConfig(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsDeleteSample.ts new file mode 100644 index 000000000000..a9b70f9d41d0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a Container App AuthConfig. + * + * @summary Delete a Container App AuthConfig. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Delete.json + */ +async function deleteContainerAppAuthConfig() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const authConfigName = "current"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsAuthConfigs.delete( + resourceGroupName, + containerAppName, + authConfigName + ); + console.log(result); +} + +async function main() { + deleteContainerAppAuthConfig(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsGetSample.ts new file mode 100644 index 000000000000..57ae061a7b34 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a AuthConfig of a Container App. + * + * @summary Get a AuthConfig of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Get.json + */ +async function getContainerAppAuthConfig() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const authConfigName = "current"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsAuthConfigs.get( + resourceGroupName, + containerAppName, + authConfigName + ); + console.log(result); +} + +async function main() { + getContainerAppAuthConfig(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsListByContainerAppSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsListByContainerAppSample.ts new file mode 100644 index 000000000000..7d0de398ec27 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsAuthConfigsListByContainerAppSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Container App AuthConfigs in a given resource group. + * + * @summary Get the Container App AuthConfigs in a given resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_ListByContainer.json + */ +async function listAuthConfigsByContainerApps() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsAuthConfigs.listByContainerApp( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAuthConfigsByContainerApps(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..4cbf4f4ae1e8 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsCreateOrUpdateSample.ts @@ -0,0 +1,281 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerApp, ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a Container App. + * + * @summary Create or update a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CreateOrUpdate.json + */ +async function createOrUpdateContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const containerAppEnvelope: ContainerApp = { + configuration: { + dapr: { + appPort: 3000, + appProtocol: "http", + enableApiLogging: true, + enabled: true, + httpMaxRequestSize: 10, + httpReadBufferSize: 30, + logLevel: "debug" + }, + ingress: { + clientCertificateMode: "accept", + corsPolicy: { + allowCredentials: true, + allowedHeaders: ["HEADER1", "HEADER2"], + allowedMethods: ["GET", "POST"], + allowedOrigins: ["https://a.test.com", "https://b.test.com"], + exposeHeaders: ["HEADER3", "HEADER4"], + maxAge: 1234 + }, + customDomains: [ + { + name: "www.my-name.com", + bindingType: "SniEnabled", + certificateId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com" + }, + { + name: "www.my-other-name.com", + bindingType: "SniEnabled", + certificateId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com" + } + ], + external: true, + ipSecurityRestrictions: [ + { + name: "Allow work IP A subnet", + description: + "Allowing all IP's within the subnet below to access containerapp", + action: "Allow", + ipAddressRange: "192.168.1.1/32" + }, + { + name: "Allow work IP B subnet", + description: + "Allowing all IP's within the subnet below to access containerapp", + action: "Allow", + ipAddressRange: "192.168.1.1/8" + } + ], + stickySessions: { affinity: "sticky" }, + targetPort: 3000, + traffic: [ + { + label: "production", + revisionName: "testcontainerApp0-ab1234", + weight: 100 + } + ] + }, + maxInactiveRevisions: 10 + }, + environmentId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + location: "East US", + template: { + containers: [ + { + name: "testcontainerApp0", + image: "repo/testcontainerApp0:v1", + probes: [ + { + type: "Liveness", + httpGet: { + path: "/health", + httpHeaders: [{ name: "Custom-Header", value: "Awesome" }], + port: 8080 + }, + initialDelaySeconds: 3, + periodSeconds: 3 + } + ] + } + ], + initContainers: [ + { + name: "testinitcontainerApp0", + args: ["-c", "while true; do echo hello; sleep 10;done"], + command: ["/bin/sh"], + image: "repo/testcontainerApp0:v4", + resources: { cpu: 0.2, memory: "100Mi" } + } + ], + scale: { + maxReplicas: 5, + minReplicas: 1, + rules: [ + { + name: "httpscalingrule", + custom: { type: "http", metadata: { concurrentRequests: "50" } } + } + ] + } + }, + workloadProfileName: "My-GP-01" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginCreateOrUpdateAndWait( + resourceGroupName, + containerAppName, + containerAppEnvelope + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a Container App. + * + * @summary Create or update a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json + */ +async function createOrUpdateManagedByApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerAppManagedBy"; + const containerAppEnvelope: ContainerApp = { + configuration: { + ingress: { + exposedPort: 4000, + external: true, + targetPort: 3000, + traffic: [ + { revisionName: "testcontainerAppManagedBy-ab1234", weight: 100 } + ], + transport: "tcp" + } + }, + environmentId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + location: "East US", + managedBy: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp", + template: { + containers: [ + { + name: "testcontainerAppManagedBy", + image: "repo/testcontainerAppManagedBy:v1", + probes: [ + { + type: "Liveness", + initialDelaySeconds: 3, + periodSeconds: 3, + tcpSocket: { port: 8080 } + } + ] + } + ], + scale: { + maxReplicas: 5, + minReplicas: 1, + rules: [ + { + name: "tcpscalingrule", + tcp: { metadata: { concurrentConnections: "50" } } + } + ] + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginCreateOrUpdateAndWait( + resourceGroupName, + containerAppName, + containerAppEnvelope + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or update a Container App. + * + * @summary Create or update a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json + */ +async function createOrUpdateTcpApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerAppTcp"; + const containerAppEnvelope: ContainerApp = { + configuration: { + ingress: { + exposedPort: 4000, + external: true, + targetPort: 3000, + traffic: [{ revisionName: "testcontainerAppTcp-ab1234", weight: 100 }], + transport: "tcp" + } + }, + environmentId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + location: "East US", + template: { + containers: [ + { + name: "testcontainerAppTcp", + image: "repo/testcontainerAppTcp:v1", + probes: [ + { + type: "Liveness", + initialDelaySeconds: 3, + periodSeconds: 3, + tcpSocket: { port: 8080 } + } + ] + } + ], + scale: { + maxReplicas: 5, + minReplicas: 1, + rules: [ + { + name: "tcpscalingrule", + tcp: { metadata: { concurrentConnections: "50" } } + } + ] + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginCreateOrUpdateAndWait( + resourceGroupName, + containerAppName, + containerAppEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateContainerApp(); + createOrUpdateManagedByApp(); + createOrUpdateTcpApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDeleteSample.ts new file mode 100644 index 000000000000..7086851d39ec --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a Container App. + * + * @summary Delete a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Delete.json + */ +async function deleteContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testWorkerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginDeleteAndWait( + resourceGroupName, + containerAppName + ); + console.log(result); +} + +async function main() { + deleteContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetDetectorSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetDetectorSample.ts new file mode 100644 index 000000000000..f516f414c4ae --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetDetectorSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a diagnostics result of a Container App. + * + * @summary Get a diagnostics result of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_Get.json + */ +async function getContainerAppDiagnosticsInfo() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "mikono-workerapp-test-rg"; + const containerAppName = "mikono-capp-stage1"; + const detectorName = "cappcontainerappnetworkIO"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsDiagnostics.getDetector( + resourceGroupName, + containerAppName, + detectorName + ); + console.log(result); +} + +async function main() { + getContainerAppDiagnosticsInfo(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetRevisionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetRevisionSample.ts new file mode 100644 index 000000000000..6ca77f4c5ed3 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetRevisionSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a revision of a Container App. + * + * @summary Get a revision of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json + */ +async function getContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsDiagnostics.getRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + getContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetRootSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetRootSample.ts new file mode 100644 index 000000000000..c2f517b46b68 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsGetRootSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the properties of a Container App. + * + * @summary Get the properties of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json + */ +async function getContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsDiagnostics.getRoot( + resourceGroupName, + containerAppName + ); + console.log(result); +} + +async function main() { + getContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsListDetectorsSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsListDetectorsSample.ts new file mode 100644 index 000000000000..ef8e3f8befcf --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsListDetectorsSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the list of diagnostics for a given Container App. + * + * @summary Get the list of diagnostics for a given Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_List.json + */ +async function getTheListOfAvailableDiagnosticsForAGivenContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "mikono-workerapp-test-rg"; + const containerAppName = "mikono-capp-stage1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsDiagnostics.listDetectors( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getTheListOfAvailableDiagnosticsForAGivenContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsListRevisionsSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsListRevisionsSample.ts new file mode 100644 index 000000000000..fe96c4e59354 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsDiagnosticsListRevisionsSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Revisions for a given Container App. + * + * @summary Get the Revisions for a given Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json + */ +async function listContainerAppRevisions() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsDiagnostics.listRevisions( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppRevisions(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsGetAuthTokenSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsGetAuthTokenSample.ts new file mode 100644 index 000000000000..17bf7b42e400 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsGetAuthTokenSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get auth token for a container app + * + * @summary Get auth token for a container app + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_GetAuthToken.json + */ +async function getContainerAppAuthToken() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.getAuthToken( + resourceGroupName, + containerAppName + ); + console.log(result); +} + +async function main() { + getContainerAppAuthToken(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsGetSample.ts new file mode 100644 index 000000000000..a80cebb595e1 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsGetSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the properties of a Container App. + * + * @summary Get the properties of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json + */ +async function getContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.get( + resourceGroupName, + containerAppName + ); + console.log(result); +} + +async function main() { + getContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListByResourceGroupSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListByResourceGroupSample.ts new file mode 100644 index 000000000000..6be535aba06b --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListByResourceGroupSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Container Apps in a given resource group. + * + * @summary Get the Container Apps in a given resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListByResourceGroup.json + */ +async function listContainerAppsByResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerApps.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppsByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListBySubscriptionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListBySubscriptionSample.ts new file mode 100644 index 000000000000..0cd8131f30b2 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListBySubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Container Apps in a given subscription. + * + * @summary Get the Container Apps in a given subscription. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListBySubscription.json + */ +async function listContainerAppsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerApps.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListCustomHostNameAnalysisSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListCustomHostNameAnalysisSample.ts new file mode 100644 index 000000000000..e460aca3b631 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListCustomHostNameAnalysisSample.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ContainerAppsListCustomHostNameAnalysisOptionalParams, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Analyzes a custom hostname for a Container App + * + * @summary Analyzes a custom hostname for a Container App + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json + */ +async function analyzeCustomHostname() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const customHostname = "my.name.corp"; + const options: ContainerAppsListCustomHostNameAnalysisOptionalParams = { + customHostname + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.listCustomHostNameAnalysis( + resourceGroupName, + containerAppName, + options + ); + console.log(result); +} + +async function main() { + analyzeCustomHostname(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListSecretsSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListSecretsSample.ts new file mode 100644 index 000000000000..856e856c4d63 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsListSecretsSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List secrets for a container app + * + * @summary List secrets for a container app + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListSecrets.json + */ +async function listContainerAppsSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.listSecrets( + resourceGroupName, + containerAppName + ); + console.log(result); +} + +async function main() { + listContainerAppsSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionReplicasGetReplicaSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionReplicasGetReplicaSample.ts new file mode 100644 index 000000000000..79112d9282a9 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionReplicasGetReplicaSample.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a replica for a Container App Revision. + * + * @summary Get a replica for a Container App Revision. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_Get.json + */ +async function getContainerAppRevisionReplica() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "myapp"; + const revisionName = "myapp--0wlqy09"; + const replicaName = "myapp--0wlqy09-5d9774cff-5wnd8"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisionReplicas.getReplica( + resourceGroupName, + containerAppName, + revisionName, + replicaName + ); + console.log(result); +} + +async function main() { + getContainerAppRevisionReplica(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionReplicasListReplicasSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionReplicasListReplicasSample.ts new file mode 100644 index 000000000000..cfd0c66be596 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionReplicasListReplicasSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List replicas for a Container App Revision. + * + * @summary List replicas for a Container App Revision. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_List.json + */ +async function listContainerAppReplicas() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "myapp"; + const revisionName = "myapp--0wlqy09"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisionReplicas.listReplicas( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + listContainerAppReplicas(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsActivateRevisionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsActivateRevisionSample.ts new file mode 100644 index 000000000000..0648b97690da --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsActivateRevisionSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Activates a revision for a Container App + * + * @summary Activates a revision for a Container App + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Activate.json + */ +async function activateContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisions.activateRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + activateContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsDeactivateRevisionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsDeactivateRevisionSample.ts new file mode 100644 index 000000000000..7b01102d463c --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsDeactivateRevisionSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deactivates a revision for a Container App + * + * @summary Deactivates a revision for a Container App + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Deactivate.json + */ +async function deactivateContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisions.deactivateRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + deactivateContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsGetRevisionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsGetRevisionSample.ts new file mode 100644 index 000000000000..573af0e63fe9 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsGetRevisionSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a revision of a Container App. + * + * @summary Get a revision of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json + */ +async function getContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisions.getRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + getContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsListRevisionsSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsListRevisionsSample.ts new file mode 100644 index 000000000000..23c0160be4ec --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsListRevisionsSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Revisions for a given Container App. + * + * @summary Get the Revisions for a given Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json + */ +async function listContainerAppRevisions() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsRevisions.listRevisions( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppRevisions(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsRestartRevisionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsRestartRevisionSample.ts new file mode 100644 index 000000000000..885c3cb1ed9e --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsRevisionsRestartRevisionSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Restarts a revision for a Container App + * + * @summary Restarts a revision for a Container App + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Restart.json + */ +async function restartContainerAppRevision() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testStaticSite0"; + const revisionName = "testcontainerApp0-pjxhsye"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsRevisions.restartRevision( + resourceGroupName, + containerAppName, + revisionName + ); + console.log(result); +} + +async function main() { + restartContainerAppRevision(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..2b38efb5b1b4 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsCreateOrUpdateSample.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + SourceControl, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update the SourceControl for a Container App. + * + * @summary Create or update the SourceControl for a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_CreateOrUpdate.json + */ +async function createOrUpdateContainerAppSourceControl() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const sourceControlName = "current"; + const sourceControlEnvelope: SourceControl = { + branch: "master", + githubActionConfiguration: { + azureCredentials: { + clientId: "", + clientSecret: "", + tenantId: "" + }, + contextPath: "./", + image: "image/tag", + registryInfo: { + registryPassword: "", + registryUrl: "xwang971reg.azurecr.io", + registryUserName: "xwang971reg" + } + }, + repoUrl: "https://github.com/xwang971/ghatest" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsSourceControls.beginCreateOrUpdateAndWait( + resourceGroupName, + containerAppName, + sourceControlName, + sourceControlEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateContainerAppSourceControl(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsDeleteSample.ts new file mode 100644 index 000000000000..fb82577bcc18 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a Container App SourceControl. + * + * @summary Delete a Container App SourceControl. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Delete.json + */ +async function deleteContainerAppSourceControl() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const sourceControlName = "current"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsSourceControls.beginDeleteAndWait( + resourceGroupName, + containerAppName, + sourceControlName + ); + console.log(result); +} + +async function main() { + deleteContainerAppSourceControl(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsGetSample.ts new file mode 100644 index 000000000000..a92818f309c6 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a SourceControl of a Container App. + * + * @summary Get a SourceControl of a Container App. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Get.json + */ +async function getContainerAppSourceControl() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const sourceControlName = "current"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerAppsSourceControls.get( + resourceGroupName, + containerAppName, + sourceControlName + ); + console.log(result); +} + +async function main() { + getContainerAppSourceControl(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsListByContainerAppSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsListByContainerAppSample.ts new file mode 100644 index 000000000000..d0c34cdbbe13 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsSourceControlsListByContainerAppSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Container App SourceControls in a given resource group. + * + * @summary Get the Container App SourceControls in a given resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_ListByContainer.json + */ +async function listAppSourceControls() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "workerapps-rg-xj"; + const containerAppName = "testcanadacentral"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.containerAppsSourceControls.listByContainerApp( + resourceGroupName, + containerAppName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAppSourceControls(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsUpdateSample.ts new file mode 100644 index 000000000000..76c5f1b085b0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/containerAppsUpdateSample.ts @@ -0,0 +1,138 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerApp, ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Patches a Container App using JSON Merge Patch + * + * @summary Patches a Container App using JSON Merge Patch + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Patch.json + */ +async function patchContainerApp() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const containerAppName = "testcontainerApp0"; + const containerAppEnvelope: ContainerApp = { + configuration: { + dapr: { + appPort: 3000, + appProtocol: "http", + enableApiLogging: true, + enabled: true, + httpMaxRequestSize: 10, + httpReadBufferSize: 30, + logLevel: "debug" + }, + ingress: { + customDomains: [ + { + name: "www.my-name.com", + bindingType: "SniEnabled", + certificateId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com" + }, + { + name: "www.my-other-name.com", + bindingType: "SniEnabled", + certificateId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com" + } + ], + external: true, + ipSecurityRestrictions: [ + { + name: "Allow work IP A subnet", + description: + "Allowing all IP's within the subnet below to access containerapp", + action: "Allow", + ipAddressRange: "192.168.1.1/32" + }, + { + name: "Allow work IP B subnet", + description: + "Allowing all IP's within the subnet below to access containerapp", + action: "Allow", + ipAddressRange: "192.168.1.1/8" + } + ], + stickySessions: { affinity: "sticky" }, + targetPort: 3000, + traffic: [ + { + label: "production", + revisionName: "testcontainerApp0-ab1234", + weight: 100 + } + ] + }, + maxInactiveRevisions: 10 + }, + location: "East US", + tags: { tag1: "value1", tag2: "value2" }, + template: { + containers: [ + { + name: "testcontainerApp0", + image: "repo/testcontainerApp0:v1", + probes: [ + { + type: "Liveness", + httpGet: { + path: "/health", + httpHeaders: [{ name: "Custom-Header", value: "Awesome" }], + port: 8080 + }, + initialDelaySeconds: 3, + periodSeconds: 3 + } + ] + } + ], + initContainers: [ + { + name: "testinitcontainerApp0", + image: "repo/testcontainerApp0:v4", + resources: { cpu: 0.2, memory: "100Mi" } + } + ], + scale: { + maxReplicas: 5, + minReplicas: 1, + rules: [ + { + name: "httpscalingrule", + custom: { type: "http", metadata: { concurrentRequests: "50" } } + } + ] + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.containerApps.beginUpdateAndWait( + resourceGroupName, + containerAppName, + containerAppEnvelope + ); + console.log(result); +} + +async function main() { + patchContainerApp(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..f6098068c3f5 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsCreateOrUpdateSample.ts @@ -0,0 +1,103 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + DaprComponent, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Dapr Component in a Managed Environment. + * + * @summary Creates or updates a Dapr Component in a Managed Environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json + */ +async function createOrUpdateDaprComponentWithSecretStoreComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const daprComponentEnvelope: DaprComponent = { + componentType: "state.azure.cosmosdb", + ignoreErrors: false, + initTimeout: "50s", + metadata: [ + { name: "url", value: "" }, + { name: "database", value: "itemsDB" }, + { name: "collection", value: "items" }, + { name: "masterkey", secretRef: "masterkey" } + ], + scopes: ["container-app-1", "container-app-2"], + secretStoreComponent: "my-secret-store", + version: "v1" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.createOrUpdate( + resourceGroupName, + environmentName, + componentName, + daprComponentEnvelope + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a Dapr Component in a Managed Environment. + * + * @summary Creates or updates a Dapr Component in a Managed Environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json + */ +async function createOrUpdateDaprComponentWithSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const daprComponentEnvelope: DaprComponent = { + componentType: "state.azure.cosmosdb", + ignoreErrors: false, + initTimeout: "50s", + metadata: [ + { name: "url", value: "" }, + { name: "database", value: "itemsDB" }, + { name: "collection", value: "items" }, + { name: "masterkey", secretRef: "masterkey" } + ], + scopes: ["container-app-1", "container-app-2"], + secrets: [{ name: "masterkey", value: "keyvalue" }], + version: "v1" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.createOrUpdate( + resourceGroupName, + environmentName, + componentName, + daprComponentEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateDaprComponentWithSecretStoreComponent(); + createOrUpdateDaprComponentWithSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsDeleteSample.ts new file mode 100644 index 000000000000..77ff870d85c1 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a Dapr Component from a Managed Environment. + * + * @summary Delete a Dapr Component from a Managed Environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Delete.json + */ +async function deleteDaprComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.delete( + resourceGroupName, + environmentName, + componentName + ); + console.log(result); +} + +async function main() { + deleteDaprComponent(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsGetSample.ts new file mode 100644 index 000000000000..2230288a6fe5 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsGetSample.ts @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a dapr component. + * + * @summary Get a dapr component. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_SecretStoreComponent.json + */ +async function getDaprComponentWithSecretStoreComponent() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.get( + resourceGroupName, + environmentName, + componentName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get a dapr component. + * + * @summary Get a dapr component. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_Secrets.json + */ +async function getDaprComponentWithSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.get( + resourceGroupName, + environmentName, + componentName + ); + console.log(result); +} + +async function main() { + getDaprComponentWithSecretStoreComponent(); + getDaprComponentWithSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsListSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsListSample.ts new file mode 100644 index 000000000000..2bbd0b4acca9 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsListSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Dapr Components for a managed environment. + * + * @summary Get the Dapr Components for a managed environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_List.json + */ +async function listDaprComponents() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.daprComponents.list( + resourceGroupName, + environmentName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listDaprComponents(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsListSecretsSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsListSecretsSample.ts new file mode 100644 index 000000000000..6c18584651a2 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/daprComponentsListSecretsSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List secrets for a dapr component + * + * @summary List secrets for a dapr component + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_ListSecrets.json + */ +async function listContainerAppsSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "myenvironment"; + const componentName = "reddog"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.daprComponents.listSecrets( + resourceGroupName, + environmentName, + componentName + ); + console.log(result); +} + +async function main() { + listContainerAppsSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..193b245ca8bc --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsCreateOrUpdateSample.ts @@ -0,0 +1,83 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { Job, ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or Update a Container Apps Job. + * + * @summary Create or Update a Container Apps Job. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_CreateorUpdate.json + */ +async function createOrUpdateContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const jobEnvelope: Job = { + configuration: { + manualTriggerConfig: { parallelism: 4, replicaCompletionCount: 1 }, + replicaRetryLimit: 10, + replicaTimeout: 10, + triggerType: "Manual" + }, + environmentId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + location: "East US", + template: { + containers: [ + { + name: "testcontainerAppsJob0", + image: "repo/testcontainerAppsJob0:v1", + probes: [ + { + type: "Liveness", + httpGet: { + path: "/health", + httpHeaders: [{ name: "Custom-Header", value: "Awesome" }], + port: 8080 + }, + initialDelaySeconds: 5, + periodSeconds: 3 + } + ] + } + ], + initContainers: [ + { + name: "testinitcontainerAppsJob0", + args: ["-c", "while true; do echo hello; sleep 10;done"], + command: ["/bin/sh"], + image: "repo/testcontainerAppsJob0:v4", + resources: { cpu: 0.2, memory: "100Mi" } + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginCreateOrUpdateAndWait( + resourceGroupName, + jobName, + jobEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsDeleteSample.ts new file mode 100644 index 000000000000..4c6b66a98b80 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a Container Apps Job. + * + * @summary Delete a Container Apps Job. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Delete.json + */ +async function deleteContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testWorkerContainerAppsJob0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginDeleteAndWait( + resourceGroupName, + jobName + ); + console.log(result); +} + +async function main() { + deleteContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsExecutionsListSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsExecutionsListSample.ts new file mode 100644 index 000000000000..9c7d47be3834 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsExecutionsListSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a Container Apps Job's executions + * + * @summary Get a Container Apps Job's executions + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Executions_Get.json + */ +async function getAContainerAppsJobExecutions() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobsExecutions.list( + resourceGroupName, + jobName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getAContainerAppsJobExecutions(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsGetSample.ts new file mode 100644 index 000000000000..163f63df34b9 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsGetSample.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the properties of a Container Apps Job. + * + * @summary Get the properties of a Container Apps Job. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Get.json + */ +async function getContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.get(resourceGroupName, jobName); + console.log(result); +} + +async function main() { + getContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListByResourceGroupSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListByResourceGroupSample.ts new file mode 100644 index 000000000000..e8b8d847fad2 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListByResourceGroupSample.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Container Apps Jobs in a given resource group. + * + * @summary Get the Container Apps Jobs in a given resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListByResourceGroup.json + */ +async function listContainerAppsJobsByResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobs.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppsJobsByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListBySubscriptionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListBySubscriptionSample.ts new file mode 100644 index 000000000000..73cd0c684cd6 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListBySubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Container Apps Jobs in a given subscription. + * + * @summary Get the Container Apps Jobs in a given subscription. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListBySubscription.json + */ +async function listContainerAppsJobsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobs.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listContainerAppsJobsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListSecretsSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListSecretsSample.ts new file mode 100644 index 000000000000..4cd509568b2d --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsListSecretsSample.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List secrets for a container apps job + * + * @summary List secrets for a container apps job + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_ListSecrets.json + */ +async function listContainerAppsJobSecrets() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.listSecrets(resourceGroupName, jobName); + console.log(result); +} + +async function main() { + listContainerAppsJobSecrets(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStartSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStartSample.ts new file mode 100644 index 000000000000..03eeadfdd2da --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStartSample.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + JobExecutionTemplate, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Start a Container Apps Job + * + * @summary Start a Container Apps Job + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Start.json + */ +async function runAContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const template: JobExecutionTemplate = { + containers: [ + { + name: "testcontainerAppsJob0", + image: "repo/testcontainerAppsJob0:v4", + resources: { cpu: 0.2, memory: "100Mi" } + } + ], + initContainers: [ + { + name: "testinitcontainerAppsJob0", + args: ["-c", "while true; do echo hello; sleep 10;done"], + command: ["/bin/sh"], + image: "repo/testcontainerAppsJob0:v4", + resources: { cpu: 0.2, memory: "100Mi" } + } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginStartAndWait( + resourceGroupName, + jobName, + template + ); + console.log(result); +} + +async function main() { + runAContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStopExecutionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStopExecutionSample.ts new file mode 100644 index 000000000000..2b50617de174 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStopExecutionSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Terminates execution of a running container apps job + * + * @summary Terminates execution of a running container apps job + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Execution.json + */ +async function terminateAContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const jobExecutionName = "jobExecution1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginStopExecutionAndWait( + resourceGroupName, + jobName, + jobExecutionName + ); + console.log(result); +} + +async function main() { + terminateAContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStopMultipleExecutionsSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStopMultipleExecutionsSample.ts new file mode 100644 index 000000000000..3b18792ab00f --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsStopMultipleExecutionsSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + JobExecutionNamesCollection, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Terminates execution of a running container apps job + * + * @summary Terminates execution of a running container apps job + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Multiple.json + */ +async function terminateMultipleContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const jobExecutionName: JobExecutionNamesCollection = { + value: [ + { name: "jobExecution-27944453" }, + { name: "jobExecution-27944452" }, + { name: "jobExecution-27944451" } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginStopMultipleExecutionsAndWait( + resourceGroupName, + jobName, + jobExecutionName + ); + console.log(result); +} + +async function main() { + terminateMultipleContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsUpdateSample.ts new file mode 100644 index 000000000000..4b4439363ea3 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/jobsUpdateSample.ts @@ -0,0 +1,85 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + JobPatchProperties, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Patches a Container Apps Job using JSON Merge Patch + * + * @summary Patches a Container Apps Job using JSON Merge Patch + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Patch.json + */ +async function patchContainerAppsJob() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const jobName = "testcontainerAppsJob0"; + const jobEnvelope: JobPatchProperties = { + properties: { + configuration: { + manualTriggerConfig: { parallelism: 4, replicaCompletionCount: 1 }, + replicaRetryLimit: 10, + replicaTimeout: 10, + triggerType: "Manual" + }, + template: { + containers: [ + { + name: "testcontainerAppsJob0", + image: "repo/testcontainerAppsJob0:v1", + probes: [ + { + type: "Liveness", + httpGet: { + path: "/health", + httpHeaders: [{ name: "Custom-Header", value: "Awesome" }], + port: 8080 + }, + initialDelaySeconds: 3, + periodSeconds: 3 + } + ] + } + ], + initContainers: [ + { + name: "testinitcontainerAppsJob0", + args: ["-c", "while true; do echo hello; sleep 10;done"], + command: ["/bin/sh"], + image: "repo/testcontainerAppsJob0:v4", + resources: { cpu: 0.2, memory: "100Mi" } + } + ] + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.jobs.beginUpdateAndWait( + resourceGroupName, + jobName, + jobEnvelope + ); + console.log(result); +} + +async function main() { + patchContainerAppsJob(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..81506f3dd869 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesCreateOrUpdateSample.ts @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ManagedCertificate, + ManagedCertificatesCreateOrUpdateOptionalParams, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or Update a Managed Certificate. + * + * @summary Create or Update a Managed Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_CreateOrUpdate.json + */ +async function createOrUpdateCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const managedCertificateName = "certificate-firendly-name"; + const managedCertificateEnvelope: ManagedCertificate = { + location: "East US", + properties: { + domainControlValidation: "CNAME", + subjectName: "my-subject-name.company.country.net" + } + }; + const options: ManagedCertificatesCreateOrUpdateOptionalParams = { + managedCertificateEnvelope + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedCertificates.beginCreateOrUpdateAndWait( + resourceGroupName, + environmentName, + managedCertificateName, + options + ); + console.log(result); +} + +async function main() { + createOrUpdateCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesDeleteSample.ts new file mode 100644 index 000000000000..5c1fdb327d67 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the specified Managed Certificate. + * + * @summary Deletes the specified Managed Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Delete.json + */ +async function deleteCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const managedCertificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedCertificates.delete( + resourceGroupName, + environmentName, + managedCertificateName + ); + console.log(result); +} + +async function main() { + deleteCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesGetSample.ts new file mode 100644 index 000000000000..d0a37a92fb8e --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the specified Managed Certificate. + * + * @summary Get the specified Managed Certificate. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Get.json + */ +async function getCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const managedCertificateName = "certificate-firendly-name"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedCertificates.get( + resourceGroupName, + environmentName, + managedCertificateName + ); + console.log(result); +} + +async function main() { + getCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesListSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesListSample.ts new file mode 100644 index 000000000000..25db64d33fe2 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesListSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the Managed Certificates in a given managed environment. + * + * @summary Get the Managed Certificates in a given managed environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_ListByManagedEnvironment.json + */ +async function listManagedCertificatesByManagedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedCertificates.list( + resourceGroupName, + environmentName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listManagedCertificatesByManagedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesUpdateSample.ts new file mode 100644 index 000000000000..1c19bfb5bf21 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedCertificatesUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ManagedCertificatePatch, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Patches a managed certificate. Oly patching of tags is supported + * + * @summary Patches a managed certificate. Oly patching of tags is supported + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_Patch.json + */ +async function patchManagedCertificate() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const managedCertificateName = "certificate-firendly-name"; + const managedCertificateEnvelope: ManagedCertificatePatch = { + tags: { tag1: "value1", tag2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedCertificates.update( + resourceGroupName, + environmentName, + managedCertificateName, + managedCertificateEnvelope + ); + console.log(result); +} + +async function main() { + patchManagedCertificate(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentDiagnosticsGetDetectorSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentDiagnosticsGetDetectorSample.ts new file mode 100644 index 000000000000..b48e57d93bf7 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentDiagnosticsGetDetectorSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the diagnostics data for a Managed Environment used to host container apps. + * + * @summary Get the diagnostics data for a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_Get.json + */ +async function getDiagnosticDataForAManagedEnvironments() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "mikono-workerapp-test-rg"; + const environmentName = "mikonokubeenv"; + const detectorName = "ManagedEnvAvailabilityMetrics"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentDiagnostics.getDetector( + resourceGroupName, + environmentName, + detectorName + ); + console.log(result); +} + +async function main() { + getDiagnosticDataForAManagedEnvironments(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentDiagnosticsListDetectorsSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentDiagnosticsListDetectorsSample.ts new file mode 100644 index 000000000000..71759dc309a0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentDiagnosticsListDetectorsSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the list of diagnostics for a Managed Environment used to host container apps. + * + * @summary Get the list of diagnostics for a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_List.json + */ +async function getTheListOfAvailableDiagnosticDataForAManagedEnvironments() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "f07f3711-b45e-40fe-a941-4e6d93f851e6"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "mikono-workerapp-test-rg"; + const environmentName = "mikonokubeenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentDiagnostics.listDetectors( + resourceGroupName, + environmentName + ); + console.log(result); +} + +async function main() { + getTheListOfAvailableDiagnosticDataForAManagedEnvironments(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..6cbbd3844005 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsCreateOrUpdateSample.ts @@ -0,0 +1,150 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ManagedEnvironment, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Managed Environment used to host container apps. + * + * @summary Creates or updates a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json + */ +async function createEnvironmentWithCustomInfrastructureResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const environmentEnvelope: ManagedEnvironment = { + appLogsConfiguration: { + logAnalyticsConfiguration: { customerId: "string", sharedKey: "string" } + }, + customDomainConfiguration: { + certificatePassword: "1234", + certificateValue: Buffer.from("Y2VydA=="), + dnsSuffix: "www.my-name.com" + }, + daprAIConnectionString: + "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + infrastructureResourceGroup: "myInfrastructureRgName", + location: "East US", + vnetConfiguration: { + infrastructureSubnetId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1" + }, + workloadProfiles: [ + { + name: "My-GP-01", + maximumCount: 12, + minimumCount: 3, + workloadProfileType: "GeneralPurpose" + }, + { + name: "My-MO-01", + maximumCount: 6, + minimumCount: 3, + workloadProfileType: "MemoryOptimized" + }, + { + name: "My-CO-01", + maximumCount: 6, + minimumCount: 3, + workloadProfileType: "ComputeOptimized" + }, + { name: "My-consumption-01", workloadProfileType: "Consumption" } + ], + zoneRedundant: true + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.beginCreateOrUpdateAndWait( + resourceGroupName, + environmentName, + environmentEnvelope + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a Managed Environment used to host container apps. + * + * @summary Creates or updates a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CreateOrUpdate.json + */ +async function createEnvironments() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const environmentEnvelope: ManagedEnvironment = { + appLogsConfiguration: { + logAnalyticsConfiguration: { customerId: "string", sharedKey: "string" } + }, + customDomainConfiguration: { + certificatePassword: "1234", + certificateValue: Buffer.from("Y2VydA=="), + dnsSuffix: "www.my-name.com" + }, + daprAIConnectionString: + "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + location: "East US", + vnetConfiguration: { + infrastructureSubnetId: + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1" + }, + workloadProfiles: [ + { + name: "My-GP-01", + maximumCount: 12, + minimumCount: 3, + workloadProfileType: "GeneralPurpose" + }, + { + name: "My-MO-01", + maximumCount: 6, + minimumCount: 3, + workloadProfileType: "MemoryOptimized" + }, + { + name: "My-CO-01", + maximumCount: 6, + minimumCount: 3, + workloadProfileType: "ComputeOptimized" + }, + { name: "My-consumption-01", workloadProfileType: "Consumption" } + ], + zoneRedundant: true + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.beginCreateOrUpdateAndWait( + resourceGroupName, + environmentName, + environmentEnvelope + ); + console.log(result); +} + +async function main() { + createEnvironmentWithCustomInfrastructureResourceGroup(); + createEnvironments(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsDeleteSample.ts new file mode 100644 index 000000000000..91baf59ae190 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a Managed Environment if it does not have any container apps. + * + * @summary Delete a Managed Environment if it does not have any container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Delete.json + */ +async function deleteEnvironmentByName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "examplekenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.beginDeleteAndWait( + resourceGroupName, + environmentName + ); + console.log(result); +} + +async function main() { + deleteEnvironmentByName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsDiagnosticsGetRootSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsDiagnosticsGetRootSample.ts new file mode 100644 index 000000000000..19efcb9871ea --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsDiagnosticsGetRootSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the properties of a Managed Environment used to host container apps. + * + * @summary Get the properties of a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json + */ +async function getEnvironmentsByName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsDiagnostics.getRoot( + resourceGroupName, + environmentName + ); + console.log(result); +} + +async function main() { + getEnvironmentsByName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsGetAuthTokenSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsGetAuthTokenSample.ts new file mode 100644 index 000000000000..66a84b6d8f55 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsGetAuthTokenSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Checks if resource name is available. + * + * @summary Checks if resource name is available. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_GetAuthToken.json + */ +async function getManagedEnvironmentAuthToken() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "651f8027-33e8-4ec4-97b4-f6e9f3dc8744"; + const resourceGroupName = process.env["APPCONTAINERS_RESOURCE_GROUP"] || "rg"; + const environmentName = "testenv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.getAuthToken( + resourceGroupName, + environmentName + ); + console.log(result); +} + +async function main() { + getManagedEnvironmentAuthToken(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsGetSample.ts new file mode 100644 index 000000000000..335952fd4a20 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsGetSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get the properties of a Managed Environment used to host container apps. + * + * @summary Get the properties of a Managed Environment used to host container apps. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json + */ +async function getEnvironmentsByName() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.get( + resourceGroupName, + environmentName + ); + console.log(result); +} + +async function main() { + getEnvironmentsByName(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListByResourceGroupSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListByResourceGroupSample.ts new file mode 100644 index 000000000000..752b77faf978 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListByResourceGroupSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all the Managed Environments in a resource group. + * + * @summary Get all the Managed Environments in a resource group. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListByResourceGroup.json + */ +async function listEnvironmentsByResourceGroup() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedEnvironments.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEnvironmentsByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListBySubscriptionSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListBySubscriptionSample.ts new file mode 100644 index 000000000000..b99bc16e23c0 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListBySubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all Managed Environments for a subscription. + * + * @summary Get all Managed Environments for a subscription. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListBySubscription.json + */ +async function listEnvironmentsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedEnvironments.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEnvironmentsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListWorkloadProfileStatesSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListWorkloadProfileStatesSample.ts new file mode 100644 index 000000000000..25078e9fd7be --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsListWorkloadProfileStatesSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all workload Profile States for a Managed Environment. + * + * @summary Get all workload Profile States for a Managed Environment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json + */ +async function listEnvironmentsBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.managedEnvironments.listWorkloadProfileStates( + resourceGroupName, + environmentName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listEnvironmentsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesCreateOrUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..64d6d9cd868b --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesCreateOrUpdateSample.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ManagedEnvironmentStorage, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update storage for a managedEnvironment. + * + * @summary Create or update storage for a managedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json + */ +async function createOrUpdateEnvironmentsStorage() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "managedEnv"; + const storageName = "jlaw-demo1"; + const storageEnvelope: ManagedEnvironmentStorage = { + properties: { + azureFile: { + accessMode: "ReadOnly", + accountKey: "key", + accountName: "account1", + shareName: "share1" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsStorages.createOrUpdate( + resourceGroupName, + environmentName, + storageName, + storageEnvelope + ); + console.log(result); +} + +async function main() { + createOrUpdateEnvironmentsStorage(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesDeleteSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesDeleteSample.ts new file mode 100644 index 000000000000..36b14ca59574 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete storage for a managedEnvironment. + * + * @summary Delete storage for a managedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Delete.json + */ +async function listEnvironmentsStoragesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "managedEnv"; + const storageName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsStorages.delete( + resourceGroupName, + environmentName, + storageName + ); + console.log(result); +} + +async function main() { + listEnvironmentsStoragesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesGetSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesGetSample.ts new file mode 100644 index 000000000000..f12af5ad99b2 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get storage for a managedEnvironment. + * + * @summary Get storage for a managedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Get.json + */ +async function getAEnvironmentsStoragePropertiesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "managedEnv"; + const storageName = "jlaw-demo1"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsStorages.get( + resourceGroupName, + environmentName, + storageName + ); + console.log(result); +} + +async function main() { + getAEnvironmentsStoragePropertiesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesListSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesListSample.ts new file mode 100644 index 000000000000..746076000ec1 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsStoragesListSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get all storages for a managedEnvironment. + * + * @summary Get all storages for a managedEnvironment. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_List.json + */ +async function listEnvironmentsStoragesBySubscription() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "8efdecc5-919e-44eb-b179-915dca89ebf9"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "managedEnv"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironmentsStorages.list( + resourceGroupName, + environmentName + ); + console.log(result); +} + +async function main() { + listEnvironmentsStoragesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsUpdateSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsUpdateSample.ts new file mode 100644 index 000000000000..3ebafa62a0af --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/managedEnvironmentsUpdateSample.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ManagedEnvironment, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Patches a Managed Environment using JSON Merge Patch + * + * @summary Patches a Managed Environment using JSON Merge Patch + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Patch.json + */ +async function patchManagedEnvironment() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const environmentEnvelope: ManagedEnvironment = { + location: "East US", + tags: { tag1: "value1", tag2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.managedEnvironments.beginUpdateAndWait( + resourceGroupName, + environmentName, + environmentEnvelope + ); + console.log(result); +} + +async function main() { + patchManagedEnvironment(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/namespacesCheckNameAvailabilitySample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/namespacesCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..4e397a441bd3 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/namespacesCheckNameAvailabilitySample.ts @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CheckNameAvailabilityRequest, + ContainerAppsAPIClient +} from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Checks if resource name is available. + * + * @summary Checks if resource name is available. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_CheckNameAvailability.json + */ +async function certificatesCheckNameAvailability() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const checkNameAvailabilityRequest: CheckNameAvailabilityRequest = { + name: "testcertificatename", + type: "Microsoft.App/managedEnvironments/certificates" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.namespaces.checkNameAvailability( + resourceGroupName, + environmentName, + checkNameAvailabilityRequest + ); + console.log(result); +} + +/** + * This sample demonstrates how to Checks if resource name is available. + * + * @summary Checks if resource name is available. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CheckNameAvailability.json + */ +async function containerAppsCheckNameAvailability() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + const resourceGroupName = + process.env["APPCONTAINERS_RESOURCE_GROUP"] || "examplerg"; + const environmentName = "testcontainerenv"; + const checkNameAvailabilityRequest: CheckNameAvailabilityRequest = { + name: "testcappname", + type: "Microsoft.App/containerApps" + }; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const result = await client.namespaces.checkNameAvailability( + resourceGroupName, + environmentName, + checkNameAvailabilityRequest + ); + console.log(result); +} + +async function main() { + certificatesCheckNameAvailability(); + containerAppsCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/operationsListSample.ts b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..b82454a18eba --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/src/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { ContainerAppsAPIClient } from "@azure/arm-appcontainers"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all of the available RP operations. + * + * @summary Lists all of the available RP operations. + * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Operations_List.json + */ +async function listAllOperations() { + const subscriptionId = + process.env["APPCONTAINERS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new ContainerAppsAPIClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listAllOperations(); +} + +main().catch(console.error); diff --git a/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/tsconfig.json b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/appcontainers/arm-appcontainers/samples/v2-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +}