diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d0e6a7f9a87b..a0a60d681668 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22035,24 +22035,27 @@ importers: sdk/nginx/arm-nginx: dependencies: + '@azure-rest/core-client': + specifier: ^2.3.1 + version: link:../../core/core-client-rest '@azure/abort-controller': specifier: ^2.1.2 version: link:../../core/abort-controller '@azure/core-auth': specifier: ^1.9.0 version: link:../../core/core-auth - '@azure/core-client': - specifier: ^1.9.2 - version: link:../../core/core-client '@azure/core-lro': - specifier: ^2.5.4 - version: 2.7.2 - '@azure/core-paging': - specifier: ^1.6.2 - version: link:../../core/core-paging + specifier: ^3.1.0 + version: link:../../core/core-lro '@azure/core-rest-pipeline': - specifier: ^1.19.0 + specifier: ^1.20.0 version: link:../../core/core-rest-pipeline + '@azure/core-util': + specifier: ^1.12.0 + version: link:../../core/core-util + '@azure/logger': + specifier: ^1.2.0 + version: link:../../core/logger tslib: specifier: ^2.8.1 version: 2.8.1 @@ -22069,12 +22072,12 @@ importers: '@azure/dev-tool': specifier: workspace:^ version: link:../../../common/tools/dev-tool + '@azure/eslint-plugin-azure-sdk': + specifier: workspace:^ + version: link:../../../common/tools/eslint-plugin-azure-sdk '@azure/identity': specifier: catalog:internal version: 4.13.0 - '@azure/logger': - specifier: ^1.1.4 - version: link:../../core/logger '@types/node': specifier: 'catalog:' version: 20.19.33 @@ -22090,9 +22093,15 @@ importers: dotenv: specifier: catalog:testing version: 16.6.1 + eslint: + specifier: 'catalog:' + version: 9.39.2 playwright: specifier: catalog:testing version: 1.58.2 + prettier: + specifier: 'catalog:' + version: 3.8.1 rimraf: specifier: 'catalog:' version: 6.1.2 diff --git a/sdk/nginx/arm-nginx/CHANGELOG.md b/sdk/nginx/arm-nginx/CHANGELOG.md index 792d6b2813ea..64c3429538b1 100644 --- a/sdk/nginx/arm-nginx/CHANGELOG.md +++ b/sdk/nginx/arm-nginx/CHANGELOG.md @@ -1,4 +1,111 @@ # Release History + +## 4.0.0-beta.3 (2026-02-12) +Compared with version 3.0.0 + +### Features Added + - Added operation group ApiKeysOperations + - Added operation group DefaultWafPolicyOperations + - Added operation group WafPolicyOperations + - Added operation CertificatesOperations.createOrUpdate + - Added operation CertificatesOperations.delete + - Added operation ConfigurationsOperations.analysis + - Added operation ConfigurationsOperations.createOrUpdate + - Added operation ConfigurationsOperations.delete + - Added operation DeploymentsOperations.createOrUpdate + - Added operation DeploymentsOperations.delete + - Added operation DeploymentsOperations.update + - Added Interface AnalysisCreate + - Added Interface AnalysisCreateConfig + - Added Interface AnalysisDiagnostic + - Added Interface AnalysisResult + - Added Interface AnalysisResultData + - Added Interface ApiKeysCreateOrUpdateOptionalParams + - Added Interface ApiKeysDeleteOptionalParams + - Added Interface ApiKeysGetOptionalParams + - Added Interface ApiKeysListOptionalParams + - Added Interface AutoUpgradeProfile + - Added Interface ConfigurationsAnalysisOptionalParams + - Added Interface DefaultWafPolicyListOptionalParams + - Added Interface DiagnosticItem + - Added Interface ErrorAdditionalInfo + - Added Interface ErrorDetail + - Added Interface ErrorResponse + - Added Interface NginxCertificateErrorResponseBody + - Added Interface NginxConfigurationProtectedFileRequest + - Added Interface NginxConfigurationProtectedFileResponse + - Added Interface NginxConfigurationRequest + - Added Interface NginxConfigurationRequestProperties + - Added Interface NginxDeploymentApiKeyRequest + - Added Interface NginxDeploymentApiKeyRequestProperties + - Added Interface NginxDeploymentApiKeyResponse + - Added Interface NginxDeploymentApiKeyResponseProperties + - Added Interface NginxDeploymentDefaultWafPolicyListResponse + - Added Interface NginxDeploymentDefaultWafPolicyProperties + - Added Interface NginxDeploymentPropertiesNginxAppProtect + - Added Interface NginxDeploymentScalingPropertiesAutoScaleSettings + - Added Interface NginxDeploymentUpdatePropertiesNginxAppProtect + - Added Interface NginxDeploymentWafPolicy + - Added Interface NginxDeploymentWafPolicyApplyingStatus + - Added Interface NginxDeploymentWafPolicyCompilingStatus + - Added Interface NginxDeploymentWafPolicyMetadata + - Added Interface NginxDeploymentWafPolicyMetadataProperties + - Added Interface NginxDeploymentWafPolicyProperties + - Added Interface Operation + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface ProxyResource + - Added Interface Resource + - Added Interface RestorePollerOptions + - Added Interface ScaleProfile + - Added Interface ScaleProfileCapacity + - Added Interface SimplePollerLike + - Added Interface TrackedResource + - Added Interface WafPolicyCreateOptionalParams + - Added Interface WafPolicyDeleteOptionalParams + - Added Interface WafPolicyGetOptionalParams + - Added Interface WafPolicyListOptionalParams + - Added Interface WebApplicationFirewallComponentVersions + - Added Interface WebApplicationFirewallPackage + - Added Interface WebApplicationFirewallSettings + - Added Interface WebApplicationFirewallStatus + - Interface NginxCertificateProperties has a new optional parameter certificateError + - Interface NginxCertificateProperties has a new optional parameter keyVaultSecretCreated + - Interface NginxCertificateProperties has a new optional parameter keyVaultSecretVersion + - Interface NginxCertificateProperties has a new optional parameter sha1Thumbprint + - Interface NginxDeploymentProperties has a new optional parameter autoUpgradeProfile + - Interface NginxDeploymentProperties has a new optional parameter dataplaneApiEndpoint + - Interface NginxDeploymentProperties has a new optional parameter nginxAppProtect + - Interface NginxDeploymentScalingProperties has a new optional parameter profiles + - Interface NginxDeploymentUpdateProperties has a new optional parameter autoUpgradeProfile + - Interface NginxDeploymentUpdateProperties has a new optional parameter networkProfile + - Interface NginxDeploymentUpdateProperties has a new optional parameter webApplicationFirewallSettings + - Added Type Alias ActionType + - Added Type Alias ActivationState + - Added Type Alias AzureSupportedClouds + - Added Type Alias Level + - Added Type Alias NginxDeploymentWafPolicyApplyingStatusCode + - Added Type Alias NginxDeploymentWafPolicyCompilingStatusCode + - Added Type Alias Origin + - Added Enum AzureClouds + - Added Enum KnownActionType + - Added Enum KnownActivationState + - Added Enum KnownLevel + - Added Enum KnownNginxDeploymentWafPolicyApplyingStatusCode + - Added Enum KnownNginxDeploymentWafPolicyCompilingStatusCode + - Added Enum KnownOrigin + - Added Enum KnownVersions + +### Breaking Changes + - Removed Interface ErrorResponseBody + - Removed Interface NginxCertificateListResponse + - Removed Interface NginxConfigurationListResponse + - Removed Interface NginxDeploymentListResponse + - Removed Interface ResourceProviderDefaultErrorResponse + - Interface NginxConfiguration no longer has parameter location + - Interface NginxDeploymentProperties no longer has parameter managedResourceGroup + - Parameter location of interface NginxDeployment is now required + ## 4.0.0-beta.2 (2025-02-20) Compared with version 3.0.0 diff --git a/sdk/nginx/arm-nginx/LICENSE b/sdk/nginx/arm-nginx/LICENSE index b2f52a2bad4e..63447fd8bbbf 100644 --- a/sdk/nginx/arm-nginx/LICENSE +++ b/sdk/nginx/arm-nginx/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/sdk/nginx/arm-nginx/README.md b/sdk/nginx/arm-nginx/README.md index 80c5c5de5af0..4cc52813dd12 100644 --- a/sdk/nginx/arm-nginx/README.md +++ b/sdk/nginx/arm-nginx/README.md @@ -4,10 +4,12 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/nginx/arm-nginx) | -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-nginx) | -[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-nginx?view=azure-node-preview) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/nginx/arm-nginx) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-nginx) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-nginx?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/nginx/arm-nginx/samples) ## Getting started @@ -63,16 +65,16 @@ For browser environments, use the `InteractiveBrowserCredential` from the `@azur import { InteractiveBrowserCredential } from "@azure/identity"; import { NginxManagementClient } from "@azure/arm-nginx"; -const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); ``` -### JavaScript Bundle +### JavaScript Bundle To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). ## Key concepts @@ -97,7 +99,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## Next steps -Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/nginx/arm-nginx/samples) directory for detailed examples on how to use this library. ## Contributing @@ -107,9 +109,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - -[azure_cli]: https://learn.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ [azure_sub]: https://azure.microsoft.com/free/ [azure_portal]: https://portal.azure.com [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity diff --git a/sdk/nginx/arm-nginx/_meta.json b/sdk/nginx/arm-nginx/_meta.json deleted file mode 100644 index 74edf32a76eb..000000000000 --- a/sdk/nginx/arm-nginx/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "35ace1532807c025b39eb837a5198115e3488f61", - "readme": "specification/nginx/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\nginx\\resource-manager\\readme.md --use=@autorest/typescript@6.0.34 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.19", - "use": "@autorest/typescript@6.0.34" -} \ No newline at end of file diff --git a/sdk/nginx/arm-nginx/api-extractor.json b/sdk/nginx/arm-nginx/api-extractor.json index 16d81e2eb512..870d6d399477 100644 --- a/sdk/nginx/arm-nginx/api-extractor.json +++ b/sdk/nginx/arm-nginx/api-extractor.json @@ -1,3 +1 @@ -{ - "extends": "../../../api-extractor-base.json" -} +{ "extends": "../../../api-extractor-base.json" } diff --git a/sdk/nginx/arm-nginx/assets.json b/sdk/nginx/arm-nginx/assets.json index d72288ebd750..c1a8470ca0f4 100644 --- a/sdk/nginx/arm-nginx/assets.json +++ b/sdk/nginx/arm-nginx/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/nginx/arm-nginx", - "Tag": "js/nginx/arm-nginx_774e3202f3" + "Tag": "js/nginx/arm-nginx_dd4f4ef200" } diff --git a/sdk/nginx/arm-nginx/eslint.config.mjs b/sdk/nginx/arm-nginx/eslint.config.mjs new file mode 100644 index 000000000000..6d2f8a5914c3 --- /dev/null +++ b/sdk/nginx/arm-nginx/eslint.config.mjs @@ -0,0 +1,14 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, +]); diff --git a/sdk/nginx/arm-nginx/metadata.json b/sdk/nginx/arm-nginx/metadata.json new file mode 100644 index 000000000000..69015278a412 --- /dev/null +++ b/sdk/nginx/arm-nginx/metadata.json @@ -0,0 +1,117 @@ +{ + "apiVersion": "2025-03-01-preview", + "emitterVersion": "0.49.0", + "crossLanguageDefinitions": { + "CrossLanguagePackageId": "Nginx.NginxPlus", + "CrossLanguageDefinitionId": { + "@azure/arm-nginx!OperationListResult:interface": "Azure.ResourceManager.CommonTypes.OperationListResult", + "@azure/arm-nginx!Operation:interface": "Azure.ResourceManager.CommonTypes.Operation", + "@azure/arm-nginx!OperationDisplay:interface": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "@azure/arm-nginx!ErrorResponse:interface": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "@azure/arm-nginx!ErrorDetail:interface": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "@azure/arm-nginx!ErrorAdditionalInfo:interface": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "@azure/arm-nginx!NginxDeploymentApiKeyResponse:interface": "Nginx.NginxPlus.NginxDeploymentApiKeyResponse", + "@azure/arm-nginx!NginxDeploymentApiKeyResponseProperties:interface": "Nginx.NginxPlus.NginxDeploymentApiKeyResponseProperties", + "@azure/arm-nginx!ProxyResource:interface": "Azure.ResourceManager.CommonTypes.ProxyResource", + "@azure/arm-nginx!Resource:interface": "Azure.ResourceManager.CommonTypes.Resource", + "@azure/arm-nginx!SystemData:interface": "Azure.ResourceManager.CommonTypes.SystemData", + "@azure/arm-nginx!NginxDeploymentApiKeyRequest:interface": "Nginx.NginxPlus.NginxDeploymentApiKeyRequest", + "@azure/arm-nginx!NginxDeploymentApiKeyRequestProperties:interface": "Nginx.NginxPlus.NginxDeploymentApiKeyRequestProperties", + "@azure/arm-nginx!NginxDeploymentApiKeyListResponse:interface": "Nginx.NginxPlus.NginxDeploymentApiKeyListResponse", + "@azure/arm-nginx!NginxDeployment:interface": "Nginx.NginxPlus.NginxDeployment", + "@azure/arm-nginx!NginxDeploymentProperties:interface": "Nginx.NginxPlus.NginxDeploymentProperties", + "@azure/arm-nginx!NginxNetworkProfile:interface": "Nginx.NginxPlus.NginxNetworkProfile", + "@azure/arm-nginx!NginxFrontendIPConfiguration:interface": "Nginx.NginxPlus.NginxFrontendIPConfiguration", + "@azure/arm-nginx!NginxPublicIPAddress:interface": "Nginx.NginxPlus.NginxPublicIPAddress", + "@azure/arm-nginx!NginxPrivateIPAddress:interface": "Nginx.NginxPlus.NginxPrivateIPAddress", + "@azure/arm-nginx!NginxNetworkInterfaceConfiguration:interface": "Nginx.NginxPlus.NginxNetworkInterfaceConfiguration", + "@azure/arm-nginx!NginxLogging:interface": "Nginx.NginxPlus.NginxLogging", + "@azure/arm-nginx!NginxStorageAccount:interface": "Nginx.NginxPlus.NginxStorageAccount", + "@azure/arm-nginx!NginxDeploymentScalingProperties:interface": "Nginx.NginxPlus.NginxDeploymentScalingProperties", + "@azure/arm-nginx!NginxDeploymentScalingPropertiesAutoScaleSettings:interface": "Nginx.NginxPlus.NginxDeploymentScalingPropertiesAutoScaleSettings", + "@azure/arm-nginx!ScaleProfile:interface": "Nginx.NginxPlus.ScaleProfile", + "@azure/arm-nginx!ScaleProfileCapacity:interface": "Nginx.NginxPlus.ScaleProfileCapacity", + "@azure/arm-nginx!AutoUpgradeProfile:interface": "Nginx.NginxPlus.AutoUpgradeProfile", + "@azure/arm-nginx!NginxDeploymentUserProfile:interface": "Nginx.NginxPlus.NginxDeploymentUserProfile", + "@azure/arm-nginx!NginxDeploymentPropertiesNginxAppProtect:interface": "Nginx.NginxPlus.NginxDeploymentPropertiesNginxAppProtect", + "@azure/arm-nginx!WebApplicationFirewallSettings:interface": "Nginx.NginxPlus.WebApplicationFirewallSettings", + "@azure/arm-nginx!WebApplicationFirewallStatus:interface": "Nginx.NginxPlus.WebApplicationFirewallStatus", + "@azure/arm-nginx!WebApplicationFirewallPackage:interface": "Nginx.NginxPlus.WebApplicationFirewallPackage", + "@azure/arm-nginx!WebApplicationFirewallComponentVersions:interface": "Nginx.NginxPlus.WebApplicationFirewallComponentVersions", + "@azure/arm-nginx!IdentityProperties:interface": "Nginx.NginxPlus.IdentityProperties", + "@azure/arm-nginx!UserIdentityProperties:interface": "Nginx.NginxPlus.UserIdentityProperties", + "@azure/arm-nginx!ResourceSku:interface": "Nginx.NginxPlus.ResourceSku", + "@azure/arm-nginx!TrackedResource:interface": "Azure.ResourceManager.CommonTypes.TrackedResource", + "@azure/arm-nginx!ArmOperationStatusResourceProvisioningState:interface": "Azure.ResourceManager.ArmOperationStatus", + "@azure/arm-nginx!NginxDeploymentUpdateParameters:interface": "Nginx.NginxPlus.NginxDeploymentUpdateParameters", + "@azure/arm-nginx!NginxDeploymentUpdateProperties:interface": "Nginx.NginxPlus.NginxDeploymentUpdateProperties", + "@azure/arm-nginx!NginxDeploymentUpdatePropertiesNginxAppProtect:interface": "Nginx.NginxPlus.NginxDeploymentUpdatePropertiesNginxAppProtect", + "@azure/arm-nginx!NginxDeploymentListResponse:interface": "Nginx.NginxPlus.NginxDeploymentListResponse", + "@azure/arm-nginx!NginxDeploymentWafPolicyListResponse:interface": "Nginx.NginxPlus.NginxDeploymentWafPolicyListResponse", + "@azure/arm-nginx!NginxDeploymentWafPolicyMetadata:interface": "Nginx.NginxPlus.NginxDeploymentWafPolicyMetadata", + "@azure/arm-nginx!NginxDeploymentWafPolicyMetadataProperties:interface": "Nginx.NginxPlus.NginxDeploymentWafPolicyMetadataProperties", + "@azure/arm-nginx!NginxDeploymentWafPolicyCompilingStatus:interface": "Nginx.NginxPlus.NginxDeploymentWafPolicyCompilingStatus", + "@azure/arm-nginx!NginxDeploymentWafPolicyApplyingStatus:interface": "Nginx.NginxPlus.NginxDeploymentWafPolicyApplyingStatus", + "@azure/arm-nginx!NginxDeploymentWafPolicy:interface": "Nginx.NginxPlus.NginxDeploymentWafPolicy", + "@azure/arm-nginx!NginxDeploymentWafPolicyProperties:interface": "Nginx.NginxPlus.NginxDeploymentWafPolicyProperties", + "@azure/arm-nginx!NginxDeploymentDefaultWafPolicyListResponse:interface": "Nginx.NginxPlus.NginxDeploymentDefaultWafPolicyListResponse", + "@azure/arm-nginx!NginxDeploymentDefaultWafPolicyProperties:interface": "Nginx.NginxPlus.NginxDeploymentDefaultWafPolicyProperties", + "@azure/arm-nginx!NginxCertificate:interface": "Nginx.NginxPlus.NginxCertificate", + "@azure/arm-nginx!NginxCertificateProperties:interface": "Nginx.NginxPlus.NginxCertificateProperties", + "@azure/arm-nginx!NginxCertificateErrorResponseBody:interface": "Nginx.NginxPlus.NginxCertificateErrorResponseBody", + "@azure/arm-nginx!NginxCertificateListResponse:interface": "Nginx.NginxPlus.NginxCertificateListResponse", + "@azure/arm-nginx!NginxConfiguration:interface": "Nginx.NginxPlus.NginxConfigurationResponse", + "@azure/arm-nginx!NginxConfigurationProperties:interface": "Nginx.NginxPlus.NginxConfigurationResponseProperties", + "@azure/arm-nginx!NginxConfigurationFile:interface": "Nginx.NginxPlus.NginxConfigurationFile", + "@azure/arm-nginx!NginxConfigurationProtectedFileResponse:interface": "Nginx.NginxPlus.NginxConfigurationProtectedFileResponse", + "@azure/arm-nginx!NginxConfigurationPackage:interface": "Nginx.NginxPlus.NginxConfigurationPackage", + "@azure/arm-nginx!NginxConfigurationRequest:interface": "Nginx.NginxPlus.NginxConfigurationRequest", + "@azure/arm-nginx!NginxConfigurationRequestProperties:interface": "Nginx.NginxPlus.NginxConfigurationRequestProperties", + "@azure/arm-nginx!NginxConfigurationProtectedFileRequest:interface": "Nginx.NginxPlus.NginxConfigurationProtectedFileRequest", + "@azure/arm-nginx!NginxConfigurationListResponse:interface": "Nginx.NginxPlus.NginxConfigurationListResponse", + "@azure/arm-nginx!AnalysisCreate:interface": "Nginx.NginxPlus.AnalysisCreate", + "@azure/arm-nginx!AnalysisCreateConfig:interface": "Nginx.NginxPlus.AnalysisCreateConfig", + "@azure/arm-nginx!AnalysisResult:interface": "Nginx.NginxPlus.AnalysisResult", + "@azure/arm-nginx!AnalysisResultData:interface": "Nginx.NginxPlus.AnalysisResultData", + "@azure/arm-nginx!AnalysisDiagnostic:interface": "Nginx.NginxPlus.AnalysisDiagnostic", + "@azure/arm-nginx!DiagnosticItem:interface": "Nginx.NginxPlus.DiagnosticItem", + "@azure/arm-nginx!KnownOrigin:enum": "Azure.ResourceManager.CommonTypes.Origin", + "@azure/arm-nginx!KnownActionType:enum": "Azure.ResourceManager.CommonTypes.ActionType", + "@azure/arm-nginx!KnowncreatedByType:enum": "Azure.ResourceManager.CommonTypes.createdByType", + "@azure/arm-nginx!KnownProvisioningState:enum": "Nginx.NginxPlus.ProvisioningState", + "@azure/arm-nginx!KnownNginxPrivateIPAllocationMethod:enum": "Nginx.NginxPlus.NginxPrivateIPAllocationMethod", + "@azure/arm-nginx!KnownActivationState:enum": "Nginx.NginxPlus.ActivationState", + "@azure/arm-nginx!KnownIdentityType:enum": "Nginx.NginxPlus.IdentityType", + "@azure/arm-nginx!KnownResourceProvisioningState:enum": "Azure.ResourceManager.ResourceProvisioningState", + "@azure/arm-nginx!KnownNginxDeploymentWafPolicyCompilingStatusCode:enum": "Nginx.NginxPlus.NginxDeploymentWafPolicyCompilingStatusCode", + "@azure/arm-nginx!KnownNginxDeploymentWafPolicyApplyingStatusCode:enum": "Nginx.NginxPlus.NginxDeploymentWafPolicyApplyingStatusCode", + "@azure/arm-nginx!KnownLevel:enum": "Nginx.NginxPlus.Level", + "@azure/arm-nginx!KnownVersions:enum": "Nginx.NginxPlus.Versions", + "@azure/arm-nginx!ConfigurationsOperations#analysis:member": "Nginx.NginxPlus.NginxConfigurationResponses.analysis", + "@azure/arm-nginx!ConfigurationsOperations#list:member": "Nginx.NginxPlus.NginxConfigurationResponses.list", + "@azure/arm-nginx!ConfigurationsOperations#delete:member": "Nginx.NginxPlus.NginxConfigurationResponses.delete", + "@azure/arm-nginx!ConfigurationsOperations#createOrUpdate:member": "Nginx.NginxPlus.NginxConfigurationResponses.createOrUpdate", + "@azure/arm-nginx!ConfigurationsOperations#get:member": "Nginx.NginxPlus.NginxConfigurationResponses.get", + "@azure/arm-nginx!CertificatesOperations#list:member": "Nginx.NginxPlus.NginxCertificates.list", + "@azure/arm-nginx!CertificatesOperations#delete:member": "Nginx.NginxPlus.NginxCertificates.delete", + "@azure/arm-nginx!CertificatesOperations#createOrUpdate:member": "Nginx.NginxPlus.NginxCertificates.createOrUpdate", + "@azure/arm-nginx!CertificatesOperations#get:member": "Nginx.NginxPlus.NginxCertificates.get", + "@azure/arm-nginx!DefaultWafPolicyOperations#list:member": "Nginx.NginxPlus.NginxDeployments.defaultWafPolicyList", + "@azure/arm-nginx!WafPolicyOperations#delete:member": "Nginx.NginxPlus.NginxDeploymentWafPolicies.delete", + "@azure/arm-nginx!WafPolicyOperations#create:member": "Nginx.NginxPlus.NginxDeploymentWafPolicies.create", + "@azure/arm-nginx!WafPolicyOperations#get:member": "Nginx.NginxPlus.NginxDeploymentWafPolicies.get", + "@azure/arm-nginx!WafPolicyOperations#list:member": "Nginx.NginxPlus.NginxDeployments.wafPolicyList", + "@azure/arm-nginx!DeploymentsOperations#list:member": "Nginx.NginxPlus.NginxDeployments.list", + "@azure/arm-nginx!DeploymentsOperations#listByResourceGroup:member": "Nginx.NginxPlus.NginxDeployments.listByResourceGroup", + "@azure/arm-nginx!DeploymentsOperations#delete:member": "Nginx.NginxPlus.NginxDeployments.delete", + "@azure/arm-nginx!DeploymentsOperations#update:member": "Nginx.NginxPlus.NginxDeployments.update", + "@azure/arm-nginx!DeploymentsOperations#createOrUpdate:member": "Nginx.NginxPlus.NginxDeployments.createOrUpdate", + "@azure/arm-nginx!DeploymentsOperations#get:member": "Nginx.NginxPlus.NginxDeployments.get", + "@azure/arm-nginx!ApiKeysOperations#list:member": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.list", + "@azure/arm-nginx!ApiKeysOperations#delete:member": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.delete", + "@azure/arm-nginx!ApiKeysOperations#createOrUpdate:member": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.createOrUpdate", + "@azure/arm-nginx!ApiKeysOperations#get:member": "Nginx.NginxPlus.NginxDeploymentApiKeyResponses.get", + "@azure/arm-nginx!OperationsOperations#list:member": "Azure.ResourceManager.Operations.list" + } + } +} diff --git a/sdk/nginx/arm-nginx/package.json b/sdk/nginx/arm-nginx/package.json index 55eb61311d15..e0515531619f 100644 --- a/sdk/nginx/arm-nginx/package.json +++ b/sdk/nginx/arm-nginx/package.json @@ -1,117 +1,127 @@ { "name": "@azure/arm-nginx", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", + "version": "4.0.0-beta.3", "description": "A generated SDK for NginxManagementClient.", - "version": "4.0.0-beta.2", "engines": { "node": ">=20.0.0" }, - "dependencies": { - "@azure/abort-controller": "^2.1.2", - "@azure/core-auth": "^1.9.0", - "@azure/core-client": "^1.9.2", - "@azure/core-lro": "^2.5.4", - "@azure/core-paging": "^1.6.2", - "@azure/core-rest-pipeline": "^1.19.0", - "tslib": "^2.8.1" + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/configurations": "./src/api/configurations/index.ts", + "./api/certificates": "./src/api/certificates/index.ts", + "./api/defaultWafPolicy": "./src/api/defaultWafPolicy/index.ts", + "./api/wafPolicy": "./src/api/wafPolicy/index.ts", + "./api/deployments": "./src/api/deployments/index.ts", + "./api/apiKeys": "./src/api/apiKeys/index.ts", + "./api/operations": "./src/api/operations/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false, + "project": "../../../tsconfig.src.build.json" }, + "type": "module", + "browser": "./dist/browser/index.js", + "react-native": "./dist/react-native/index.js", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", + "files": [ + "dist/", + "!dist/**/*.d.*ts.map", + "README.md", + "LICENSE" + ], + "sdk-type": "mgmt", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/nginx/arm-nginx/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/nginxManagementContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure/core-util": "^1.12.0", + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.9.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/logger": "^1.2.0", + "tslib": "^2.8.1" + }, "devDependencies": { "@azure-tools/test-credential": "workspace:^", "@azure-tools/test-recorder": "workspace:^", "@azure-tools/test-utils-vitest": "workspace:^", "@azure/dev-tool": "workspace:^", + "tshy": "catalog:", + "@azure/eslint-plugin-azure-sdk": "workspace:^", "@azure/identity": "catalog:internal", - "@azure/logger": "^1.1.4", "@types/node": "catalog:", + "cross-env": "catalog:", + "eslint": "catalog:", + "prettier": "catalog:", + "rimraf": "catalog:", "@vitest/browser-playwright": "catalog:testing", "@vitest/coverage-istanbul": "catalog:testing", - "cross-env": "catalog:", "dotenv": "catalog:testing", "playwright": "catalog:testing", - "rimraf": "catalog:", - "tshy": "catalog:", "typescript": "catalog:", "vitest": "catalog:testing" }, - "repository": { - "type": "git", - "url": "https://github.com/Azure/azure-sdk-for-js.git" - }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "files": [ - "dist/", - "README.md", - "LICENSE", - "review/", - "CHANGELOG.md" - ], "scripts": { - "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", - "check-format": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", - "format": "echo skipped", - "lint": "echo skipped", + "extract-api": "rimraf review && dev-tool run extract-api", "pack": "pnpm pack 2>&1", - "test": "npm run test:node && npm run test:browser", + "lint": "echo skipped", + "lint:fix": "echo skipped", + "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "execute:samples": "dev-tool samples run samples-dev", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", "test:browser": "echo skipped", - "test:node": "dev-tool run build-test --no-browser-test && dev-tool run test:vitest", + "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", + "test:node": "dev-tool run test:vitest", + "test:node:esm": "dev-tool run test:vitest --esm", + "test": "npm run test:node && npm run test:browser", "update-snippets": "dev-tool run update-snippets" }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/nginxManagementClient.ts", - "prefix": "packageDetails" - } - ] - }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/nginx/arm-nginx", "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-nginx", "productSlugs": [ "azure" ], "disableDocsMs": true, "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-nginx?view=azure-node-preview" }, - "type": "module", - "tshy": { - "project": "../../../tsconfig.src.build.json", - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], - "selfLink": false - }, - "browser": "./dist/browser/index.js", - "react-native": "./dist/react-native/index.js", "exports": { "./package.json": "./package.json", ".": { @@ -131,6 +141,171 @@ "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/configurations": { + "browser": { + "types": "./dist/browser/api/configurations/index.d.ts", + "default": "./dist/browser/api/configurations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/configurations/index.d.ts", + "default": "./dist/react-native/api/configurations/index.js" + }, + "import": { + "types": "./dist/esm/api/configurations/index.d.ts", + "default": "./dist/esm/api/configurations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/configurations/index.d.ts", + "default": "./dist/commonjs/api/configurations/index.js" + } + }, + "./api/certificates": { + "browser": { + "types": "./dist/browser/api/certificates/index.d.ts", + "default": "./dist/browser/api/certificates/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/certificates/index.d.ts", + "default": "./dist/react-native/api/certificates/index.js" + }, + "import": { + "types": "./dist/esm/api/certificates/index.d.ts", + "default": "./dist/esm/api/certificates/index.js" + }, + "require": { + "types": "./dist/commonjs/api/certificates/index.d.ts", + "default": "./dist/commonjs/api/certificates/index.js" + } + }, + "./api/defaultWafPolicy": { + "browser": { + "types": "./dist/browser/api/defaultWafPolicy/index.d.ts", + "default": "./dist/browser/api/defaultWafPolicy/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/defaultWafPolicy/index.d.ts", + "default": "./dist/react-native/api/defaultWafPolicy/index.js" + }, + "import": { + "types": "./dist/esm/api/defaultWafPolicy/index.d.ts", + "default": "./dist/esm/api/defaultWafPolicy/index.js" + }, + "require": { + "types": "./dist/commonjs/api/defaultWafPolicy/index.d.ts", + "default": "./dist/commonjs/api/defaultWafPolicy/index.js" + } + }, + "./api/wafPolicy": { + "browser": { + "types": "./dist/browser/api/wafPolicy/index.d.ts", + "default": "./dist/browser/api/wafPolicy/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/wafPolicy/index.d.ts", + "default": "./dist/react-native/api/wafPolicy/index.js" + }, + "import": { + "types": "./dist/esm/api/wafPolicy/index.d.ts", + "default": "./dist/esm/api/wafPolicy/index.js" + }, + "require": { + "types": "./dist/commonjs/api/wafPolicy/index.d.ts", + "default": "./dist/commonjs/api/wafPolicy/index.js" + } + }, + "./api/deployments": { + "browser": { + "types": "./dist/browser/api/deployments/index.d.ts", + "default": "./dist/browser/api/deployments/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/deployments/index.d.ts", + "default": "./dist/react-native/api/deployments/index.js" + }, + "import": { + "types": "./dist/esm/api/deployments/index.d.ts", + "default": "./dist/esm/api/deployments/index.js" + }, + "require": { + "types": "./dist/commonjs/api/deployments/index.d.ts", + "default": "./dist/commonjs/api/deployments/index.js" + } + }, + "./api/apiKeys": { + "browser": { + "types": "./dist/browser/api/apiKeys/index.d.ts", + "default": "./dist/browser/api/apiKeys/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/apiKeys/index.d.ts", + "default": "./dist/react-native/api/apiKeys/index.js" + }, + "import": { + "types": "./dist/esm/api/apiKeys/index.d.ts", + "default": "./dist/esm/api/apiKeys/index.js" + }, + "require": { + "types": "./dist/commonjs/api/apiKeys/index.d.ts", + "default": "./dist/commonjs/api/apiKeys/index.js" + } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/operations/index.d.ts", + "default": "./dist/react-native/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } } - } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-api-apiKeys-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-api-apiKeys-node.api.md new file mode 100644 index 000000000000..ba1932d51de2 --- /dev/null +++ b/sdk/nginx/arm-nginx/review/arm-nginx-api-apiKeys-node.api.md @@ -0,0 +1,41 @@ +## API Report File for "@azure/arm-nginx" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function $delete(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, apiKeyName: string, options?: ApiKeysDeleteOptionalParams): Promise; + +// @public +export interface ApiKeysCreateOrUpdateOptionalParams extends OperationOptions { + body?: NginxDeploymentApiKeyRequest; +} + +// @public +export interface ApiKeysDeleteOptionalParams extends OperationOptions { +} + +// @public +export interface ApiKeysGetOptionalParams extends OperationOptions { +} + +// @public +export interface ApiKeysListOptionalParams extends OperationOptions { +} + +// @public +export function createOrUpdate(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, apiKeyName: string, options?: ApiKeysCreateOrUpdateOptionalParams): Promise; + +// @public +export function get(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, apiKeyName: string, options?: ApiKeysGetOptionalParams): Promise; + +// @public +export function list(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, options?: ApiKeysListOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-api-certificates-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-api-certificates-node.api.md new file mode 100644 index 000000000000..9c88c39916a6 --- /dev/null +++ b/sdk/nginx/arm-nginx/review/arm-nginx-api-certificates-node.api.md @@ -0,0 +1,45 @@ +## API Report File for "@azure/arm-nginx" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesDeleteOptionalParams): PollerLike, void>; + +// @public +export interface CertificatesCreateOrUpdateOptionalParams extends OperationOptions { + body?: NginxCertificate; + updateIntervalInMs?: number; +} + +// @public +export interface CertificatesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CertificatesGetOptionalParams extends OperationOptions { +} + +// @public +export interface CertificatesListOptionalParams extends OperationOptions { +} + +// @public +export function createOrUpdate(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesCreateOrUpdateOptionalParams): PollerLike, NginxCertificate>; + +// @public +export function get(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesGetOptionalParams): Promise; + +// @public +export function list(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, options?: CertificatesListOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-api-configurations-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-api-configurations-node.api.md new file mode 100644 index 000000000000..e1ca789052aa --- /dev/null +++ b/sdk/nginx/arm-nginx/review/arm-nginx-api-configurations-node.api.md @@ -0,0 +1,53 @@ +## API Report File for "@azure/arm-nginx" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsDeleteOptionalParams): PollerLike, void>; + +// @public +export function analysis(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsAnalysisOptionalParams): Promise; + +// @public +export interface ConfigurationsAnalysisOptionalParams extends OperationOptions { + body?: AnalysisCreate; +} + +// @public +export interface ConfigurationsCreateOrUpdateOptionalParams extends OperationOptions { + body?: NginxConfigurationRequest; + updateIntervalInMs?: number; +} + +// @public +export interface ConfigurationsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ConfigurationsGetOptionalParams extends OperationOptions { +} + +// @public +export interface ConfigurationsListOptionalParams extends OperationOptions { +} + +// @public +export function createOrUpdate(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsCreateOrUpdateOptionalParams): PollerLike, NginxConfiguration>; + +// @public +export function get(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsGetOptionalParams): Promise; + +// @public +export function list(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, options?: ConfigurationsListOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-api-defaultWafPolicy-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-api-defaultWafPolicy-node.api.md new file mode 100644 index 000000000000..843ee344a62b --- /dev/null +++ b/sdk/nginx/arm-nginx/review/arm-nginx-api-defaultWafPolicy-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-nginx" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export interface DefaultWafPolicyListOptionalParams extends OperationOptions { +} + +// @public +export function list(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, options?: DefaultWafPolicyListOptionalParams): Promise; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-api-deployments-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-api-deployments-node.api.md new file mode 100644 index 000000000000..36def7b9b1c4 --- /dev/null +++ b/sdk/nginx/arm-nginx/review/arm-nginx-api-deployments-node.api.md @@ -0,0 +1,61 @@ +## API Report File for "@azure/arm-nginx" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, options?: DeploymentsCreateOrUpdateOptionalParams): PollerLike, NginxDeployment>; + +// @public +export interface DeploymentsCreateOrUpdateOptionalParams extends OperationOptions { + body?: NginxDeployment; + updateIntervalInMs?: number; +} + +// @public +export interface DeploymentsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DeploymentsGetOptionalParams extends OperationOptions { +} + +// @public +export interface DeploymentsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface DeploymentsListOptionalParams extends OperationOptions { +} + +// @public +export interface DeploymentsUpdateOptionalParams extends OperationOptions { + body?: NginxDeploymentUpdateParameters; + updateIntervalInMs?: number; +} + +// @public +export function get(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, options?: DeploymentsGetOptionalParams): Promise; + +// @public +export function list(context: NginxManagementContext, options?: DeploymentsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listByResourceGroup(context: NginxManagementContext, resourceGroupName: string, options?: DeploymentsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function update(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, options?: DeploymentsUpdateOptionalParams): PollerLike, NginxDeployment>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-api-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-api-node.api.md new file mode 100644 index 000000000000..b593a2eb812d --- /dev/null +++ b/sdk/nginx/arm-nginx/review/arm-nginx-api-node.api.md @@ -0,0 +1,28 @@ +## API Report File for "@azure/arm-nginx" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { TokenCredential } from '@azure/core-auth'; + +// @public (undocumented) +export function createNginxManagement(credential: TokenCredential, subscriptionId: string, options?: NginxManagementClientOptionalParams): NginxManagementContext; + +// @public +export interface NginxManagementClientOptionalParams extends ClientOptions { + apiVersion?: string; + cloudSetting?: AzureSupportedClouds; +} + +// @public (undocumented) +export interface NginxManagementContext extends Client { + apiVersion?: string; + subscriptionId: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-api-operations-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-api-operations-node.api.md new file mode 100644 index 000000000000..5c6a9dad76cc --- /dev/null +++ b/sdk/nginx/arm-nginx/review/arm-nginx-api-operations-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-nginx" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function list(context: NginxManagementContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface OperationsListOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-api-wafPolicy-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-api-wafPolicy-node.api.md new file mode 100644 index 000000000000..0ca27a6460b1 --- /dev/null +++ b/sdk/nginx/arm-nginx/review/arm-nginx-api-wafPolicy-node.api.md @@ -0,0 +1,45 @@ +## API Report File for "@azure/arm-nginx" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyDeleteOptionalParams): PollerLike, void>; + +// @public +export function create(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyCreateOptionalParams): PollerLike, NginxDeploymentWafPolicy>; + +// @public +export function get(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyGetOptionalParams): Promise; + +// @public +export function list(context: NginxManagementContext, resourceGroupName: string, deploymentName: string, options?: WafPolicyListOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface WafPolicyCreateOptionalParams extends OperationOptions { + body?: NginxDeploymentWafPolicy; + updateIntervalInMs?: number; +} + +// @public +export interface WafPolicyDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface WafPolicyGetOptionalParams extends OperationOptions { +} + +// @public +export interface WafPolicyListOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-models-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-models-node.api.md new file mode 100644 index 000000000000..b114c7c6c11f --- /dev/null +++ b/sdk/nginx/arm-nginx/review/arm-nginx-models-node.api.md @@ -0,0 +1,636 @@ +## API Report File for "@azure/arm-nginx" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public +export type ActionType = string; + +// @public +export type ActivationState = string; + +// @public +export interface AnalysisCreate { + // (undocumented) + config: AnalysisCreateConfig; +} + +// @public +export interface AnalysisCreateConfig { + // (undocumented) + files?: NginxConfigurationFile[]; + package?: NginxConfigurationPackage; + // (undocumented) + protectedFiles?: NginxConfigurationProtectedFileRequest[]; + rootFile?: string; +} + +// @public +export interface AnalysisDiagnostic { + // (undocumented) + description: string; + // (undocumented) + directive: string; + file: string; + id?: string; + // (undocumented) + line: number; + // (undocumented) + message: string; + // (undocumented) + rule: string; +} + +// @public +export interface AnalysisResult { + // (undocumented) + data?: AnalysisResultData; + status: string; +} + +// @public +export interface AnalysisResultData { + // (undocumented) + diagnostics?: DiagnosticItem[]; + // (undocumented) + errors?: AnalysisDiagnostic[]; +} + +// @public +export interface AutoUpgradeProfile { + upgradeChannel: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface DiagnosticItem { + category?: string; + // (undocumented) + description: string; + // (undocumented) + directive: string; + file: string; + id?: string; + level: Level; + // (undocumented) + line: number; + // (undocumented) + message: string; + // (undocumented) + rule: string; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: any; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface IdentityProperties { + // (undocumented) + readonly principalId?: string; + // (undocumented) + readonly tenantId?: string; + type?: IdentityType; + userAssignedIdentities?: Record; +} + +// @public +export type IdentityType = string; + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownActivationState { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownLevel { + Info = "Info", + Warning = "Warning" +} + +// @public +export enum KnownNginxDeploymentWafPolicyApplyingStatusCode { + Applying = "Applying", + Failed = "Failed", + NotApplied = "NotApplied", + Removing = "Removing", + Succeeded = "Succeeded" +} + +// @public +export enum KnownNginxDeploymentWafPolicyCompilingStatusCode { + Failed = "Failed", + InProgress = "InProgress", + NotStarted = "NotStarted", + Succeeded = "Succeeded" +} + +// @public +export enum KnownNginxPrivateIPAllocationMethod { + Dynamic = "Dynamic", + Static = "Static" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Creating = "Creating", + Deleted = "Deleted", + Deleting = "Deleting", + Failed = "Failed", + NotSpecified = "NotSpecified", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownVersions { + V20250301Preview = "2025-03-01-preview" +} + +// @public +export type Level = string; + +// @public +export interface NginxCertificate extends ProxyResource { + location?: string; + properties?: NginxCertificateProperties; +} + +// @public +export interface NginxCertificateErrorResponseBody { + // (undocumented) + code?: string; + // (undocumented) + message?: string; +} + +// @public +export interface NginxCertificateProperties { + certificateError?: NginxCertificateErrorResponseBody; + // (undocumented) + certificateVirtualPath?: string; + // (undocumented) + readonly keyVaultSecretCreated?: Date; + // (undocumented) + keyVaultSecretId?: string; + // (undocumented) + readonly keyVaultSecretVersion?: string; + // (undocumented) + keyVirtualPath?: string; + readonly provisioningState?: ProvisioningState; + // (undocumented) + readonly sha1Thumbprint?: string; +} + +// @public +export interface NginxConfiguration extends ProxyResource { + properties?: NginxConfigurationProperties; +} + +// @public +export interface NginxConfigurationFile { + // (undocumented) + content?: string; + // (undocumented) + virtualPath?: string; +} + +// @public +export interface NginxConfigurationPackage { + // (undocumented) + data?: string; + // (undocumented) + protectedFiles?: string[]; +} + +// @public +export interface NginxConfigurationProperties { + // (undocumented) + files?: NginxConfigurationFile[]; + package?: NginxConfigurationPackage; + // (undocumented) + protectedFiles?: NginxConfigurationProtectedFileResponse[]; + readonly provisioningState?: ProvisioningState; + // (undocumented) + rootFile?: string; +} + +// @public +export interface NginxConfigurationProtectedFileRequest { + content?: string; + contentHash?: string; + virtualPath?: string; +} + +// @public +export interface NginxConfigurationProtectedFileResponse { + contentHash?: string; + virtualPath?: string; +} + +// @public +export interface NginxConfigurationRequest { + // (undocumented) + readonly id?: string; + // (undocumented) + readonly name?: string; + properties?: NginxConfigurationRequestProperties; + readonly systemData?: SystemData; + // (undocumented) + readonly type?: string; +} + +// @public +export interface NginxConfigurationRequestProperties { + // (undocumented) + files?: NginxConfigurationFile[]; + package?: NginxConfigurationPackage; + // (undocumented) + protectedFiles?: NginxConfigurationProtectedFileRequest[]; + readonly provisioningState?: ProvisioningState; + // (undocumented) + rootFile?: string; +} + +// @public +export interface NginxDeployment extends TrackedResource { + identity?: IdentityProperties; + properties?: NginxDeploymentProperties; + sku?: ResourceSku; +} + +// @public +export interface NginxDeploymentApiKeyRequest { + // (undocumented) + readonly id?: string; + // (undocumented) + readonly name?: string; + properties?: NginxDeploymentApiKeyRequestProperties; + readonly systemData?: SystemData; + // (undocumented) + readonly type?: string; +} + +// @public +export interface NginxDeploymentApiKeyRequestProperties { + endDateTime?: Date; + secretText?: string; +} + +// @public +export interface NginxDeploymentApiKeyResponse extends ProxyResource { + properties?: NginxDeploymentApiKeyResponseProperties; +} + +// @public +export interface NginxDeploymentApiKeyResponseProperties { + endDateTime?: Date; + readonly hint?: string; +} + +// @public +export interface NginxDeploymentDefaultWafPolicyListResponse { + // (undocumented) + nextLink?: string; + // (undocumented) + value?: NginxDeploymentDefaultWafPolicyProperties[]; +} + +// @public +export interface NginxDeploymentDefaultWafPolicyProperties { + // (undocumented) + readonly content?: Uint8Array; + // (undocumented) + readonly filepath?: string; +} + +// @public +export interface NginxDeploymentProperties { + autoUpgradeProfile?: AutoUpgradeProfile; + readonly dataplaneApiEndpoint?: string; + // (undocumented) + enableDiagnosticsSupport?: boolean; + readonly ipAddress?: string; + logging?: NginxLogging; + networkProfile?: NginxNetworkProfile; + nginxAppProtect?: NginxDeploymentPropertiesNginxAppProtect; + // (undocumented) + readonly nginxVersion?: string; + readonly provisioningState?: ProvisioningState; + scalingProperties?: NginxDeploymentScalingProperties; + userProfile?: NginxDeploymentUserProfile; +} + +// @public +export interface NginxDeploymentPropertiesNginxAppProtect { + webApplicationFirewallSettings: WebApplicationFirewallSettings; + readonly webApplicationFirewallStatus?: WebApplicationFirewallStatus; +} + +// @public +export interface NginxDeploymentScalingProperties { + // (undocumented) + capacity?: number; + // (undocumented) + profiles?: ScaleProfile[]; +} + +// @public +export interface NginxDeploymentScalingPropertiesAutoScaleSettings { + // (undocumented) + profiles: ScaleProfile[]; +} + +// @public +export interface NginxDeploymentUpdateParameters { + identity?: IdentityProperties; + location?: string; + properties?: NginxDeploymentUpdateProperties; + sku?: ResourceSku; + tags?: Record; +} + +// @public +export interface NginxDeploymentUpdateProperties { + autoUpgradeProfile?: AutoUpgradeProfile; + // (undocumented) + enableDiagnosticsSupport?: boolean; + logging?: NginxLogging; + networkProfile?: NginxNetworkProfile; + scalingProperties?: NginxDeploymentScalingProperties; + userProfile?: NginxDeploymentUserProfile; + webApplicationFirewallSettings?: WebApplicationFirewallSettings; +} + +// @public +export interface NginxDeploymentUpdatePropertiesNginxAppProtect { + webApplicationFirewallSettings?: WebApplicationFirewallSettings; +} + +// @public +export interface NginxDeploymentUserProfile { + preferredEmail?: string; +} + +// @public +export interface NginxDeploymentWafPolicy extends ProxyResource { + properties?: NginxDeploymentWafPolicyProperties; +} + +// @public +export interface NginxDeploymentWafPolicyApplyingStatus { + readonly code?: NginxDeploymentWafPolicyApplyingStatusCode; + readonly displayStatus?: string; + readonly time?: string; +} + +// @public +export type NginxDeploymentWafPolicyApplyingStatusCode = string; + +// @public +export interface NginxDeploymentWafPolicyCompilingStatus { + readonly code?: NginxDeploymentWafPolicyCompilingStatusCode; + readonly displayStatus?: string; + readonly time?: string; +} + +// @public +export type NginxDeploymentWafPolicyCompilingStatusCode = string; + +// @public +export interface NginxDeploymentWafPolicyMetadata { + // (undocumented) + readonly id?: string; + // (undocumented) + readonly name?: string; + properties?: NginxDeploymentWafPolicyMetadataProperties; + readonly systemData?: SystemData; + // (undocumented) + readonly type?: string; +} + +// @public +export interface NginxDeploymentWafPolicyMetadataProperties { + readonly applyingState?: NginxDeploymentWafPolicyApplyingStatus; + readonly compilingState?: NginxDeploymentWafPolicyCompilingStatus; + // (undocumented) + readonly filepath?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface NginxDeploymentWafPolicyProperties { + readonly applyingState?: NginxDeploymentWafPolicyApplyingStatus; + readonly compilingState?: NginxDeploymentWafPolicyCompilingStatus; + content?: Uint8Array; + filepath?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface NginxFrontendIPConfiguration { + // (undocumented) + privateIPAddresses?: NginxPrivateIPAddress[]; + // (undocumented) + publicIPAddresses?: NginxPublicIPAddress[]; +} + +// @public +export interface NginxLogging { + storageAccount?: NginxStorageAccount; +} + +// @public +export interface NginxNetworkInterfaceConfiguration { + // (undocumented) + subnetId?: string; +} + +// @public +export interface NginxNetworkProfile { + frontEndIPConfiguration?: NginxFrontendIPConfiguration; + networkInterfaceConfiguration?: NginxNetworkInterfaceConfiguration; +} + +// @public +export interface NginxPrivateIPAddress { + // (undocumented) + privateIPAddress?: string; + privateIPAllocationMethod?: NginxPrivateIPAllocationMethod; + // (undocumented) + subnetId?: string; +} + +// @public +export type NginxPrivateIPAllocationMethod = string; + +// @public +export interface NginxPublicIPAddress { + // (undocumented) + id?: string; +} + +// @public +export interface NginxStorageAccount { + // (undocumented) + accountName?: string; + // (undocumented) + containerName?: string; +} + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export type Origin = string; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface ResourceSku { + name: string; +} + +// @public +export interface ScaleProfile { + capacity: ScaleProfileCapacity; + // (undocumented) + name: string; +} + +// @public +export interface ScaleProfileCapacity { + max: number; + min: number; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export interface UserIdentityProperties { + // (undocumented) + readonly clientId?: string; + // (undocumented) + readonly principalId?: string; +} + +// @public +export interface WebApplicationFirewallComponentVersions { + wafEngineVersion: string; + wafNginxVersion: string; +} + +// @public +export interface WebApplicationFirewallPackage { + revisionDatetime: Date; + version: string; +} + +// @public +export interface WebApplicationFirewallSettings { + activationState?: ActivationState; +} + +// @public +export interface WebApplicationFirewallStatus { + readonly attackSignaturesPackage?: WebApplicationFirewallPackage; + readonly botSignaturesPackage?: WebApplicationFirewallPackage; + readonly componentVersions?: WebApplicationFirewallComponentVersions; + readonly threatCampaignsPackage?: WebApplicationFirewallPackage; + wafRelease?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/nginx/arm-nginx/review/arm-nginx-node.api.md b/sdk/nginx/arm-nginx/review/arm-nginx-node.api.md index a5f4b6200c04..1f3de96263db 100644 --- a/sdk/nginx/arm-nginx/review/arm-nginx-node.api.md +++ b/sdk/nginx/arm-nginx/review/arm-nginx-node.api.md @@ -4,11 +4,18 @@ ```ts -import * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; -import { OperationState } from '@azure/core-lro'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { SimplePollerLike } from '@azure/core-lro'; +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { CancelOnProgress } from '@azure/core-lro'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { Pipeline } from '@azure/core-rest-pipeline'; +import type { PollerLike } from '@azure/core-lro'; +import type { TokenCredential } from '@azure/core-auth'; + +// @public +export type ActionType = string; // @public export type ActivationState = string; @@ -19,11 +26,10 @@ export interface AnalysisCreate { config: AnalysisCreateConfig; } -// @public (undocumented) +// @public export interface AnalysisCreateConfig { // (undocumented) files?: NginxConfigurationFile[]; - // (undocumented) package?: NginxConfigurationPackage; // (undocumented) protectedFiles?: NginxConfigurationProtectedFileRequest[]; @@ -53,7 +59,7 @@ export interface AnalysisResult { status: string; } -// @public (undocumented) +// @public export interface AnalysisResultData { // (undocumented) diagnostics?: DiagnosticItem[]; @@ -62,233 +68,189 @@ export interface AnalysisResultData { } // @public -export interface ApiKeys { - createOrUpdate(resourceGroupName: string, deploymentName: string, apiKeyName: string, options?: ApiKeysCreateOrUpdateOptionalParams): Promise; - delete(resourceGroupName: string, deploymentName: string, apiKeyName: string, options?: ApiKeysDeleteOptionalParams): Promise; - get(resourceGroupName: string, deploymentName: string, apiKeyName: string, options?: ApiKeysGetOptionalParams): Promise; - list(resourceGroupName: string, deploymentName: string, options?: ApiKeysListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface ApiKeysCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +export interface ApiKeysCreateOrUpdateOptionalParams extends OperationOptions { body?: NginxDeploymentApiKeyRequest; } // @public -export type ApiKeysCreateOrUpdateResponse = NginxDeploymentApiKeyResponse; - -// @public -export interface ApiKeysDeleteOptionalParams extends coreClient.OperationOptions { +export interface ApiKeysDeleteOptionalParams extends OperationOptions { } // @public -export interface ApiKeysGetOptionalParams extends coreClient.OperationOptions { +export interface ApiKeysGetOptionalParams extends OperationOptions { } // @public -export type ApiKeysGetResponse = NginxDeploymentApiKeyResponse; - -// @public -export interface ApiKeysListNextOptionalParams extends coreClient.OperationOptions { +export interface ApiKeysListOptionalParams extends OperationOptions { } // @public -export type ApiKeysListNextResponse = NginxDeploymentApiKeyListResponse; - -// @public -export interface ApiKeysListOptionalParams extends coreClient.OperationOptions { +export interface ApiKeysOperations { + createOrUpdate: (resourceGroupName: string, deploymentName: string, apiKeyName: string, options?: ApiKeysCreateOrUpdateOptionalParams) => Promise; + delete: (resourceGroupName: string, deploymentName: string, apiKeyName: string, options?: ApiKeysDeleteOptionalParams) => Promise; + get: (resourceGroupName: string, deploymentName: string, apiKeyName: string, options?: ApiKeysGetOptionalParams) => Promise; + list: (resourceGroupName: string, deploymentName: string, options?: ApiKeysListOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type ApiKeysListResponse = NginxDeploymentApiKeyListResponse; - // @public export interface AutoUpgradeProfile { upgradeChannel: string; } // @public -export interface Certificates { - beginCreateOrUpdate(resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesCreateOrUpdateOptionalParams): Promise, CertificatesCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesDeleteOptionalParams): Promise; - get(resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesGetOptionalParams): Promise; - list(resourceGroupName: string, deploymentName: string, options?: CertificatesListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface CertificatesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - body?: NginxCertificate; - resumeFrom?: string; - updateIntervalInMs?: number; +export enum AzureClouds { + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" } // @public -export type CertificatesCreateOrUpdateResponse = NginxCertificate; +export type AzureSupportedClouds = `${AzureClouds}`; // @public -export interface CertificatesDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface CertificatesCreateOrUpdateOptionalParams extends OperationOptions { + body?: NginxCertificate; updateIntervalInMs?: number; } // @public -export interface CertificatesGetOptionalParams extends coreClient.OperationOptions { +export interface CertificatesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export type CertificatesGetResponse = NginxCertificate; - -// @public -export interface CertificatesListNextOptionalParams extends coreClient.OperationOptions { +export interface CertificatesGetOptionalParams extends OperationOptions { } // @public -export type CertificatesListNextResponse = NginxCertificateListResponse; - -// @public -export interface CertificatesListOptionalParams extends coreClient.OperationOptions { +export interface CertificatesListOptionalParams extends OperationOptions { } // @public -export type CertificatesListResponse = NginxCertificateListResponse; - -// @public -export interface Configurations { - analysis(resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsAnalysisOptionalParams): Promise; - beginCreateOrUpdate(resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsCreateOrUpdateOptionalParams): Promise, ConfigurationsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsDeleteOptionalParams): Promise; - get(resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsGetOptionalParams): Promise; - list(resourceGroupName: string, deploymentName: string, options?: ConfigurationsListOptionalParams): PagedAsyncIterableIterator; +export interface CertificatesOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesCreateOrUpdateOptionalParams) => Promise, NginxCertificate>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesDeleteOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesCreateOrUpdateOptionalParams) => PollerLike, NginxCertificate>; + delete: (resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, deploymentName: string, certificateName: string, options?: CertificatesGetOptionalParams) => Promise; + list: (resourceGroupName: string, deploymentName: string, options?: CertificatesListOptionalParams) => PagedAsyncIterableIterator; } // @public -export interface ConfigurationsAnalysisOptionalParams extends coreClient.OperationOptions { +export interface ConfigurationsAnalysisOptionalParams extends OperationOptions { body?: AnalysisCreate; } // @public -export type ConfigurationsAnalysisResponse = AnalysisResult; - -// @public -export interface ConfigurationsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +export interface ConfigurationsCreateOrUpdateOptionalParams extends OperationOptions { body?: NginxConfigurationRequest; - resumeFrom?: string; updateIntervalInMs?: number; } // @public -export type ConfigurationsCreateOrUpdateResponse = NginxConfigurationResponse; - -// @public -export interface ConfigurationsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ConfigurationsDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export interface ConfigurationsGetOptionalParams extends coreClient.OperationOptions { +export interface ConfigurationsGetOptionalParams extends OperationOptions { } // @public -export type ConfigurationsGetResponse = NginxConfigurationResponse; - -// @public -export interface ConfigurationsListNextOptionalParams extends coreClient.OperationOptions { +export interface ConfigurationsListOptionalParams extends OperationOptions { } // @public -export type ConfigurationsListNextResponse = NginxConfigurationListResponse; - -// @public -export interface ConfigurationsListOptionalParams extends coreClient.OperationOptions { +export interface ConfigurationsOperations { + analysis: (resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsAnalysisOptionalParams) => Promise; + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsCreateOrUpdateOptionalParams) => Promise, NginxConfiguration>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsDeleteOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsCreateOrUpdateOptionalParams) => PollerLike, NginxConfiguration>; + delete: (resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, deploymentName: string, configurationName: string, options?: ConfigurationsGetOptionalParams) => Promise; + list: (resourceGroupName: string, deploymentName: string, options?: ConfigurationsListOptionalParams) => PagedAsyncIterableIterator; } // @public -export type ConfigurationsListResponse = NginxConfigurationListResponse; +export type ContinuablePage = TPage & { + continuationToken?: string; +}; // @public export type CreatedByType = string; // @public -export interface Deployments { - beginCreateOrUpdate(resourceGroupName: string, deploymentName: string, options?: DeploymentsCreateOrUpdateOptionalParams): Promise, DeploymentsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, deploymentName: string, options?: DeploymentsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, deploymentName: string, options?: DeploymentsUpdateOptionalParams): Promise, DeploymentsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, deploymentName: string, options?: DeploymentsUpdateOptionalParams): Promise; - get(resourceGroupName: string, deploymentName: string, options?: DeploymentsGetOptionalParams): Promise; - list(options?: DeploymentsListOptionalParams): PagedAsyncIterableIterator; - listByResourceGroup(resourceGroupName: string, options?: DeploymentsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; +export interface DefaultWafPolicyListOptionalParams extends OperationOptions { } // @public -export interface DeploymentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - // (undocumented) - body?: NginxDeployment; - resumeFrom?: string; - updateIntervalInMs?: number; +export interface DefaultWafPolicyOperations { + list: (resourceGroupName: string, deploymentName: string, options?: DefaultWafPolicyListOptionalParams) => Promise; } // @public -export type DeploymentsCreateOrUpdateResponse = NginxDeployment; - -// @public -export interface DeploymentsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DeploymentsCreateOrUpdateOptionalParams extends OperationOptions { + body?: NginxDeployment; updateIntervalInMs?: number; } // @public -export interface DeploymentsGetOptionalParams extends coreClient.OperationOptions { +export interface DeploymentsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export type DeploymentsGetResponse = NginxDeployment; - -// @public -export interface DeploymentsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +export interface DeploymentsGetOptionalParams extends OperationOptions { } // @public -export type DeploymentsListByResourceGroupNextResponse = NginxDeploymentListResponse; - -// @public -export interface DeploymentsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +export interface DeploymentsListByResourceGroupOptionalParams extends OperationOptions { } // @public -export type DeploymentsListByResourceGroupResponse = NginxDeploymentListResponse; - -// @public -export interface DeploymentsListNextOptionalParams extends coreClient.OperationOptions { +export interface DeploymentsListOptionalParams extends OperationOptions { } // @public -export type DeploymentsListNextResponse = NginxDeploymentListResponse; - -// @public -export interface DeploymentsListOptionalParams extends coreClient.OperationOptions { +export interface DeploymentsOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, deploymentName: string, options?: DeploymentsCreateOrUpdateOptionalParams) => Promise, NginxDeployment>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, deploymentName: string, options?: DeploymentsCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, deploymentName: string, options?: DeploymentsUpdateOptionalParams) => Promise, NginxDeployment>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, deploymentName: string, options?: DeploymentsUpdateOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, deploymentName: string, options?: DeploymentsCreateOrUpdateOptionalParams) => PollerLike, NginxDeployment>; + delete: (resourceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, deploymentName: string, options?: DeploymentsGetOptionalParams) => Promise; + list: (options?: DeploymentsListOptionalParams) => PagedAsyncIterableIterator; + listByResourceGroup: (resourceGroupName: string, options?: DeploymentsListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, deploymentName: string, options?: DeploymentsUpdateOptionalParams) => PollerLike, NginxDeployment>; } // @public -export type DeploymentsListResponse = NginxDeploymentListResponse; - -// @public -export interface DeploymentsUpdateOptionalParams extends coreClient.OperationOptions { - // (undocumented) +export interface DeploymentsUpdateOptionalParams extends OperationOptions { body?: NginxDeploymentUpdateParameters; - resumeFrom?: string; updateIntervalInMs?: number; } -// @public -export type DeploymentsUpdateResponse = NginxDeployment; - // @public export interface DiagnosticItem { category?: string; @@ -309,7 +271,7 @@ export interface DiagnosticItem { // @public export interface ErrorAdditionalInfo { - readonly info?: Record; + readonly info?: any; readonly type?: string; } @@ -328,22 +290,23 @@ export interface ErrorResponse { } // @public -export function getContinuationToken(page: unknown): string | undefined; - -// @public (undocumented) export interface IdentityProperties { + // (undocumented) readonly principalId?: string; - readonly tenantId?: string; // (undocumented) + readonly tenantId?: string; type?: IdentityType; - userAssignedIdentities?: { - [propertyName: string]: UserIdentityProperties; - }; + userAssignedIdentities?: Record; } // @public export type IdentityType = string; +// @public +export enum KnownActionType { + Internal = "Internal" +} + // @public export enum KnownActivationState { Disabled = "Disabled", @@ -372,12 +335,36 @@ export enum KnownLevel { Warning = "Warning" } +// @public +export enum KnownNginxDeploymentWafPolicyApplyingStatusCode { + Applying = "Applying", + Failed = "Failed", + NotApplied = "NotApplied", + Removing = "Removing", + Succeeded = "Succeeded" +} + +// @public +export enum KnownNginxDeploymentWafPolicyCompilingStatusCode { + Failed = "Failed", + InProgress = "InProgress", + NotStarted = "NotStarted", + Succeeded = "Succeeded" +} + // @public export enum KnownNginxPrivateIPAllocationMethod { Dynamic = "Dynamic", Static = "Static" } +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + // @public export enum KnownProvisioningState { Accepted = "Accepted", @@ -391,22 +378,21 @@ export enum KnownProvisioningState { Updating = "Updating" } +// @public +export enum KnownVersions { + V20250301Preview = "2025-03-01-preview" +} + // @public export type Level = string; -// @public (undocumented) -export interface NginxCertificate { - readonly id?: string; - // (undocumented) +// @public +export interface NginxCertificate extends ProxyResource { location?: string; - readonly name?: string; - // (undocumented) properties?: NginxCertificateProperties; - readonly systemData?: SystemData; - readonly type?: string; } -// @public (undocumented) +// @public export interface NginxCertificateErrorResponseBody { // (undocumented) code?: string; @@ -414,31 +400,30 @@ export interface NginxCertificateErrorResponseBody { message?: string; } -// @public (undocumented) -export interface NginxCertificateListResponse { - // (undocumented) - nextLink?: string; - // (undocumented) - value?: NginxCertificate[]; -} - -// @public (undocumented) +// @public export interface NginxCertificateProperties { - // (undocumented) certificateError?: NginxCertificateErrorResponseBody; // (undocumented) certificateVirtualPath?: string; + // (undocumented) readonly keyVaultSecretCreated?: Date; // (undocumented) keyVaultSecretId?: string; + // (undocumented) readonly keyVaultSecretVersion?: string; // (undocumented) keyVirtualPath?: string; readonly provisioningState?: ProvisioningState; + // (undocumented) readonly sha1Thumbprint?: string; } -// @public (undocumented) +// @public +export interface NginxConfiguration extends ProxyResource { + properties?: NginxConfigurationProperties; +} + +// @public export interface NginxConfigurationFile { // (undocumented) content?: string; @@ -447,12 +432,6 @@ export interface NginxConfigurationFile { } // @public -export interface NginxConfigurationListResponse { - nextLink?: string; - value?: NginxConfigurationResponse[]; -} - -// @public (undocumented) export interface NginxConfigurationPackage { // (undocumented) data?: string; @@ -460,34 +439,47 @@ export interface NginxConfigurationPackage { protectedFiles?: string[]; } -// @public (undocumented) +// @public +export interface NginxConfigurationProperties { + // (undocumented) + files?: NginxConfigurationFile[]; + package?: NginxConfigurationPackage; + // (undocumented) + protectedFiles?: NginxConfigurationProtectedFileResponse[]; + readonly provisioningState?: ProvisioningState; + // (undocumented) + rootFile?: string; +} + +// @public export interface NginxConfigurationProtectedFileRequest { content?: string; contentHash?: string; virtualPath?: string; } -// @public (undocumented) +// @public export interface NginxConfigurationProtectedFileResponse { contentHash?: string; virtualPath?: string; } -// @public (undocumented) +// @public export interface NginxConfigurationRequest { + // (undocumented) readonly id?: string; - readonly name?: string; // (undocumented) + readonly name?: string; properties?: NginxConfigurationRequestProperties; readonly systemData?: SystemData; + // (undocumented) readonly type?: string; } -// @public (undocumented) +// @public export interface NginxConfigurationRequestProperties { // (undocumented) files?: NginxConfigurationFile[]; - // (undocumented) package?: NginxConfigurationPackage; // (undocumented) protectedFiles?: NginxConfigurationProtectedFileRequest[]; @@ -496,110 +488,72 @@ export interface NginxConfigurationRequestProperties { rootFile?: string; } -// @public (undocumented) -export interface NginxConfigurationResponse { - readonly id?: string; - readonly name?: string; - // (undocumented) - properties?: NginxConfigurationResponseProperties; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public (undocumented) -export interface NginxConfigurationResponseProperties { - // (undocumented) - files?: NginxConfigurationFile[]; - // (undocumented) - package?: NginxConfigurationPackage; - // (undocumented) - protectedFiles?: NginxConfigurationProtectedFileResponse[]; - readonly provisioningState?: ProvisioningState; - // (undocumented) - rootFile?: string; -} - -// @public (undocumented) -export interface NginxDeployment { - readonly id?: string; - // (undocumented) +// @public +export interface NginxDeployment extends TrackedResource { identity?: IdentityProperties; - // (undocumented) - location?: string; - readonly name?: string; - // (undocumented) properties?: NginxDeploymentProperties; - // (undocumented) sku?: ResourceSku; - readonly systemData?: SystemData; - tags?: { - [propertyName: string]: string; - }; - readonly type?: string; } -// @public (undocumented) -export interface NginxDeploymentApiKeyListResponse { - // (undocumented) - nextLink?: string; - // (undocumented) - value?: NginxDeploymentApiKeyResponse[]; -} - -// @public (undocumented) +// @public export interface NginxDeploymentApiKeyRequest { + // (undocumented) readonly id?: string; - readonly name?: string; // (undocumented) + readonly name?: string; properties?: NginxDeploymentApiKeyRequestProperties; + readonly systemData?: SystemData; + // (undocumented) readonly type?: string; } -// @public (undocumented) +// @public export interface NginxDeploymentApiKeyRequestProperties { endDateTime?: Date; secretText?: string; } -// @public (undocumented) -export interface NginxDeploymentApiKeyResponse { - readonly id?: string; - readonly name?: string; - // (undocumented) +// @public +export interface NginxDeploymentApiKeyResponse extends ProxyResource { properties?: NginxDeploymentApiKeyResponseProperties; - readonly type?: string; } -// @public (undocumented) +// @public export interface NginxDeploymentApiKeyResponseProperties { endDateTime?: Date; readonly hint?: string; } -// @public (undocumented) -export interface NginxDeploymentListResponse { +// @public +export interface NginxDeploymentDefaultWafPolicyListResponse { // (undocumented) nextLink?: string; // (undocumented) - value?: NginxDeployment[]; + value?: NginxDeploymentDefaultWafPolicyProperties[]; } -// @public (undocumented) +// @public +export interface NginxDeploymentDefaultWafPolicyProperties { + // (undocumented) + readonly content?: Uint8Array; + // (undocumented) + readonly filepath?: string; +} + +// @public export interface NginxDeploymentProperties { autoUpgradeProfile?: AutoUpgradeProfile; readonly dataplaneApiEndpoint?: string; // (undocumented) enableDiagnosticsSupport?: boolean; readonly ipAddress?: string; - // (undocumented) logging?: NginxLogging; - // (undocumented) networkProfile?: NginxNetworkProfile; nginxAppProtect?: NginxDeploymentPropertiesNginxAppProtect; + // (undocumented) readonly nginxVersion?: string; readonly provisioningState?: ProvisioningState; scalingProperties?: NginxDeploymentScalingProperties; - // (undocumented) userProfile?: NginxDeploymentUserProfile; } @@ -617,34 +571,31 @@ export interface NginxDeploymentScalingProperties { profiles?: ScaleProfile[]; } -// @public (undocumented) -export interface NginxDeploymentUpdateParameters { +// @public +export interface NginxDeploymentScalingPropertiesAutoScaleSettings { // (undocumented) + profiles: ScaleProfile[]; +} + +// @public +export interface NginxDeploymentUpdateParameters { identity?: IdentityProperties; - // (undocumented) location?: string; - // (undocumented) properties?: NginxDeploymentUpdateProperties; - // (undocumented) sku?: ResourceSku; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } -// @public (undocumented) +// @public export interface NginxDeploymentUpdateProperties { autoUpgradeProfile?: AutoUpgradeProfile; // (undocumented) enableDiagnosticsSupport?: boolean; - // (undocumented) logging?: NginxLogging; - // (undocumented) networkProfile?: NginxNetworkProfile; - nginxAppProtect?: NginxDeploymentUpdatePropertiesNginxAppProtect; scalingProperties?: NginxDeploymentScalingProperties; - // (undocumented) userProfile?: NginxDeploymentUserProfile; + webApplicationFirewallSettings?: WebApplicationFirewallSettings; } // @public @@ -652,12 +603,67 @@ export interface NginxDeploymentUpdatePropertiesNginxAppProtect { webApplicationFirewallSettings?: WebApplicationFirewallSettings; } -// @public (undocumented) +// @public export interface NginxDeploymentUserProfile { preferredEmail?: string; } -// @public (undocumented) +// @public +export interface NginxDeploymentWafPolicy extends ProxyResource { + properties?: NginxDeploymentWafPolicyProperties; +} + +// @public +export interface NginxDeploymentWafPolicyApplyingStatus { + readonly code?: NginxDeploymentWafPolicyApplyingStatusCode; + readonly displayStatus?: string; + readonly time?: string; +} + +// @public +export type NginxDeploymentWafPolicyApplyingStatusCode = string; + +// @public +export interface NginxDeploymentWafPolicyCompilingStatus { + readonly code?: NginxDeploymentWafPolicyCompilingStatusCode; + readonly displayStatus?: string; + readonly time?: string; +} + +// @public +export type NginxDeploymentWafPolicyCompilingStatusCode = string; + +// @public +export interface NginxDeploymentWafPolicyMetadata { + // (undocumented) + readonly id?: string; + // (undocumented) + readonly name?: string; + properties?: NginxDeploymentWafPolicyMetadataProperties; + readonly systemData?: SystemData; + // (undocumented) + readonly type?: string; +} + +// @public +export interface NginxDeploymentWafPolicyMetadataProperties { + readonly applyingState?: NginxDeploymentWafPolicyApplyingStatus; + readonly compilingState?: NginxDeploymentWafPolicyCompilingStatus; + // (undocumented) + readonly filepath?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface NginxDeploymentWafPolicyProperties { + readonly applyingState?: NginxDeploymentWafPolicyApplyingStatus; + readonly compilingState?: NginxDeploymentWafPolicyCompilingStatus; + content?: Uint8Array; + filepath?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public export interface NginxFrontendIPConfiguration { // (undocumented) privateIPAddresses?: NginxPrivateIPAddress[]; @@ -665,59 +671,46 @@ export interface NginxFrontendIPConfiguration { publicIPAddresses?: NginxPublicIPAddress[]; } -// @public (undocumented) +// @public export interface NginxLogging { - // (undocumented) storageAccount?: NginxStorageAccount; } // @public (undocumented) -export class NginxManagementClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: NginxManagementClientOptionalParams); - // (undocumented) - apiKeys: ApiKeys; - // (undocumented) - apiVersion: string; - // (undocumented) - certificates: Certificates; - // (undocumented) - configurations: Configurations; - // (undocumented) - deployments: Deployments; - // (undocumented) - operations: Operations; - // (undocumented) - subscriptionId: string; +export class NginxManagementClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: NginxManagementClientOptionalParams); + readonly apiKeys: ApiKeysOperations; + readonly certificates: CertificatesOperations; + readonly configurations: ConfigurationsOperations; + readonly defaultWafPolicy: DefaultWafPolicyOperations; + readonly deployments: DeploymentsOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly wafPolicy: WafPolicyOperations; } // @public -export interface NginxManagementClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; +export interface NginxManagementClientOptionalParams extends ClientOptions { apiVersion?: string; - endpoint?: string; + cloudSetting?: AzureSupportedClouds; } -// @public (undocumented) +// @public export interface NginxNetworkInterfaceConfiguration { // (undocumented) subnetId?: string; } -// @public (undocumented) +// @public export interface NginxNetworkProfile { - // (undocumented) frontEndIPConfiguration?: NginxFrontendIPConfiguration; - // (undocumented) networkInterfaceConfiguration?: NginxNetworkInterfaceConfiguration; } -// @public (undocumented) +// @public export interface NginxPrivateIPAddress { // (undocumented) privateIPAddress?: string; - // (undocumented) privateIPAllocationMethod?: NginxPrivateIPAllocationMethod; // (undocumented) subnetId?: string; @@ -726,13 +719,13 @@ export interface NginxPrivateIPAddress { // @public export type NginxPrivateIPAllocationMethod = string; -// @public (undocumented) +// @public export interface NginxPublicIPAddress { // (undocumented) id?: string; } -// @public (undocumented) +// @public export interface NginxStorageAccount { // (undocumented) accountName?: string; @@ -740,52 +733,75 @@ export interface NginxStorageAccount { containerName?: string; } +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + // @public export interface OperationDisplay { - description?: string; - operation?: string; - provider?: string; - resource?: string; + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; } // @public -export interface OperationListResult { - nextLink?: string; - value?: OperationResult[]; +export interface OperationsListOptionalParams extends OperationOptions { } // @public -export interface OperationResult { - display?: OperationDisplay; - isDataAction?: boolean; - name?: string; +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; } // @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +export type Origin = string; + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; } // @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +export interface PageSettings { + continuationToken?: string; } // @public -export type OperationsListNextResponse = OperationListResult; +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} // @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; } // @public -export type OperationsListResponse = OperationListResult; +export interface ResourceSku { + name: string; +} // @public -export type ProvisioningState = string; +export function restorePoller(client: NginxManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; // @public (undocumented) -export interface ResourceSku { - name: string; +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; } // @public @@ -801,6 +817,28 @@ export interface ScaleProfileCapacity { min: number; } +// @public +export interface SimplePollerLike, TResult> { + getOperationState(): TState; + getResult(): TResult | undefined; + isDone(): boolean; + // @deprecated + isStopped(): boolean; + onProgress(callback: (state: TState) => void): CancelOnProgress; + poll(options?: { + abortSignal?: AbortSignalLike; + }): Promise; + pollUntilDone(pollOptions?: { + abortSignal?: AbortSignalLike; + }): Promise; + serialize(): Promise; + // @deprecated + stopPolling(): void; + submitted(): Promise; + // @deprecated + toString(): string; +} + // @public export interface SystemData { createdAt?: Date; @@ -811,12 +849,55 @@ export interface SystemData { lastModifiedByType?: CreatedByType; } -// @public (undocumented) +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public export interface UserIdentityProperties { + // (undocumented) readonly clientId?: string; + // (undocumented) readonly principalId?: string; } +// @public +export interface WafPolicyCreateOptionalParams extends OperationOptions { + body?: NginxDeploymentWafPolicy; + updateIntervalInMs?: number; +} + +// @public +export interface WafPolicyDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface WafPolicyGetOptionalParams extends OperationOptions { +} + +// @public +export interface WafPolicyListOptionalParams extends OperationOptions { +} + +// @public +export interface WafPolicyOperations { + // @deprecated (undocumented) + beginCreate: (resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyCreateOptionalParams) => Promise, NginxDeploymentWafPolicy>>; + // @deprecated (undocumented) + beginCreateAndWait: (resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyCreateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyDeleteOptionalParams) => Promise; + create: (resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyCreateOptionalParams) => PollerLike, NginxDeploymentWafPolicy>; + delete: (resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, deploymentName: string, wafPolicyName: string, options?: WafPolicyGetOptionalParams) => Promise; + list: (resourceGroupName: string, deploymentName: string, options?: WafPolicyListOptionalParams) => PagedAsyncIterableIterator; +} + // @public export interface WebApplicationFirewallComponentVersions { wafEngineVersion: string; @@ -840,6 +921,7 @@ export interface WebApplicationFirewallStatus { readonly botSignaturesPackage?: WebApplicationFirewallPackage; readonly componentVersions?: WebApplicationFirewallComponentVersions; readonly threatCampaignsPackage?: WebApplicationFirewallPackage; + wafRelease?: string; } // (No @packageDocumentation comment for this package) diff --git a/sdk/nginx/arm-nginx/samples-dev/apiKeysCreateOrUpdateSample.ts b/sdk/nginx/arm-nginx/samples-dev/apiKeysCreateOrUpdateSample.ts index 2be061987b97..eaeb6d26984e 100644 --- a/sdk/nginx/arm-nginx/samples-dev/apiKeysCreateOrUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/apiKeysCreateOrUpdateSample.ts @@ -1,32 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint - * - * @summary Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_CreateOrUpdate.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint + * + * @summary create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint + * x-ms-original-file: 2025-03-01-preview/ApiKeys_CreateOrUpdate.json + */ async function apiKeysCreateOrUpdate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const apiKeyName = "myApiKey"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.apiKeys.createOrUpdate( - resourceGroupName, - deploymentName, - apiKeyName, - ); + const result = await client.apiKeys.createOrUpdate("myResourceGroup", "myDeployment", "myApiKey"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/apiKeysDeleteSample.ts b/sdk/nginx/arm-nginx/samples-dev/apiKeysDeleteSample.ts index 2642ab3bf430..3463c80b20c2 100644 --- a/sdk/nginx/arm-nginx/samples-dev/apiKeysDeleteSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/apiKeysDeleteSample.ts @@ -1,33 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Delete API key for Nginx deployment - * - * @summary Delete API key for Nginx deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Delete.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to delete API key for Nginx deployment + * + * @summary delete API key for Nginx deployment + * x-ms-original-file: 2025-03-01-preview/ApiKeys_Delete.json + */ async function apiKeysDelete(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const apiKeyName = "myApiKey"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.apiKeys.delete( - resourceGroupName, - deploymentName, - apiKeyName, - ); - console.log(result); + await client.apiKeys.delete("myResourceGroup", "myDeployment", "myApiKey"); } async function main(): Promise { diff --git a/sdk/nginx/arm-nginx/samples-dev/apiKeysGetSample.ts b/sdk/nginx/arm-nginx/samples-dev/apiKeysGetSample.ts index 5badced10617..105e2ef6b2e2 100644 --- a/sdk/nginx/arm-nginx/samples-dev/apiKeysGetSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/apiKeysGetSample.ts @@ -1,32 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the specified API Key of the given Nginx deployment - * - * @summary Get the specified API Key of the given Nginx deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Get.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the specified API Key of the given Nginx deployment + * + * @summary get the specified API Key of the given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/ApiKeys_Get.json + */ async function apiKeysGet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const apiKeyName = "myApiKey"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.apiKeys.get( - resourceGroupName, - deploymentName, - apiKeyName, - ); + const result = await client.apiKeys.get("myResourceGroup", "myDeployment", "myApiKey"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/apiKeysListSample.ts b/sdk/nginx/arm-nginx/samples-dev/apiKeysListSample.ts index 9f1c8a24ba73..46ab4fdef45e 100644 --- a/sdk/nginx/arm-nginx/samples-dev/apiKeysListSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/apiKeysListSample.ts @@ -1,33 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List all API Keys of the given Nginx deployment - * - * @summary List all API Keys of the given Nginx deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_List.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list all API Keys of the given Nginx deployment + * + * @summary list all API Keys of the given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/ApiKeys_List.json + */ async function apiKeysList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.apiKeys.list( - resourceGroupName, - deploymentName, - )) { + for await (const item of client.apiKeys.list("myResourceGroup", "myDeployment")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples-dev/certificatesCreateOrUpdateSample.ts b/sdk/nginx/arm-nginx/samples-dev/certificatesCreateOrUpdateSample.ts index b287b98fd4c5..95169639d4b3 100644 --- a/sdk/nginx/arm-nginx/samples-dev/certificatesCreateOrUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/certificatesCreateOrUpdateSample.ts @@ -1,31 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Create or update the NGINX certificates for given NGINX deployment - * - * @summary Create or update the NGINX certificates for given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_CreateOrUpdate.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to create or update the NGINX certificates for given NGINX deployment + * + * @summary create or update the NGINX certificates for given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_CreateOrUpdate.json + */ async function certificatesCreateOrUpdate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const certificateName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.certificates.beginCreateOrUpdateAndWait( - resourceGroupName, - deploymentName, - certificateName, + const result = await client.certificates.createOrUpdate( + "myResourceGroup", + "myDeployment", + "default", ); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/certificatesDeleteSample.ts b/sdk/nginx/arm-nginx/samples-dev/certificatesDeleteSample.ts index 27679a1f3d96..36eaced27699 100644 --- a/sdk/nginx/arm-nginx/samples-dev/certificatesDeleteSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/certificatesDeleteSample.ts @@ -1,33 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Deletes a certificate from the NGINX deployment - * - * @summary Deletes a certificate from the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Delete.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to deletes a certificate from the NGINX deployment + * + * @summary deletes a certificate from the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_Delete.json + */ async function certificatesDelete(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const certificateName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.certificates.beginDeleteAndWait( - resourceGroupName, - deploymentName, - certificateName, - ); - console.log(result); + await client.certificates.delete("myResourceGroup", "myDeployment", "default"); } async function main(): Promise { diff --git a/sdk/nginx/arm-nginx/samples-dev/certificatesGetSample.ts b/sdk/nginx/arm-nginx/samples-dev/certificatesGetSample.ts index d6ca60f51879..186d95ccda8b 100644 --- a/sdk/nginx/arm-nginx/samples-dev/certificatesGetSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/certificatesGetSample.ts @@ -1,32 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get a certificate of given NGINX deployment - * - * @summary Get a certificate of given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Get.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get a certificate of given NGINX deployment + * + * @summary get a certificate of given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_Get.json + */ async function certificatesGet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const certificateName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.certificates.get( - resourceGroupName, - deploymentName, - certificateName, - ); + const result = await client.certificates.get("myResourceGroup", "myDeployment", "default"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/certificatesListSample.ts b/sdk/nginx/arm-nginx/samples-dev/certificatesListSample.ts index 53e8011f3d45..7cbf4a6dda78 100644 --- a/sdk/nginx/arm-nginx/samples-dev/certificatesListSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/certificatesListSample.ts @@ -1,33 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List all certificates of given NGINX deployment - * - * @summary List all certificates of given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_List.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list all certificates of given NGINX deployment + * + * @summary list all certificates of given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_List.json + */ async function certificatesList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.certificates.list( - resourceGroupName, - deploymentName, - )) { + for await (const item of client.certificates.list("myResourceGroup", "myDeployment")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples-dev/configurationsAnalysisSample.ts b/sdk/nginx/arm-nginx/samples-dev/configurationsAnalysisSample.ts index 8602a3a3ba5a..56e7a12abe8d 100644 --- a/sdk/nginx/arm-nginx/samples-dev/configurationsAnalysisSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/configurationsAnalysisSample.ts @@ -1,32 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Analyze an NGINX configuration without applying it to the NGINXaaS deployment - * - * @summary Analyze an NGINX configuration without applying it to the NGINXaaS deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Analysis.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to analyze an NGINX configuration without applying it to the NGINXaaS deployment + * + * @summary analyze an NGINX configuration without applying it to the NGINXaaS deployment + * x-ms-original-file: 2025-03-01-preview/Configurations_Analysis.json + */ async function configurationsAnalysis(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.analysis( - resourceGroupName, - deploymentName, - configurationName, - ); + const result = await client.configurations.analysis("myResourceGroup", "myDeployment", "default"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/configurationsCreateOrUpdateSample.ts b/sdk/nginx/arm-nginx/samples-dev/configurationsCreateOrUpdateSample.ts index 773e6dda281b..67ae9602a6f8 100644 --- a/sdk/nginx/arm-nginx/samples-dev/configurationsCreateOrUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/configurationsCreateOrUpdateSample.ts @@ -1,31 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Create or update the NGINX configuration for given NGINX deployment - * - * @summary Create or update the NGINX configuration for given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_CreateOrUpdate.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to create or update the NGINX configuration for given NGINX deployment + * + * @summary create or update the NGINX configuration for given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Configurations_CreateOrUpdate.json + */ async function configurationsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.beginCreateOrUpdateAndWait( - resourceGroupName, - deploymentName, - configurationName, + const result = await client.configurations.createOrUpdate( + "myResourceGroup", + "myDeployment", + "default", ); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/configurationsDeleteSample.ts b/sdk/nginx/arm-nginx/samples-dev/configurationsDeleteSample.ts index 013392a4108b..6f4029df85db 100644 --- a/sdk/nginx/arm-nginx/samples-dev/configurationsDeleteSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/configurationsDeleteSample.ts @@ -1,33 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Reset the NGINX configuration of given NGINX deployment to default - * - * @summary Reset the NGINX configuration of given NGINX deployment to default - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Delete.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to reset the NGINX configuration of given NGINX deployment to default + * + * @summary reset the NGINX configuration of given NGINX deployment to default + * x-ms-original-file: 2025-03-01-preview/Configurations_Delete.json + */ async function configurationsDelete(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.beginDeleteAndWait( - resourceGroupName, - deploymentName, - configurationName, - ); - console.log(result); + await client.configurations.delete("myResourceGroup", "myDeployment", "default"); } async function main(): Promise { diff --git a/sdk/nginx/arm-nginx/samples-dev/configurationsGetSample.ts b/sdk/nginx/arm-nginx/samples-dev/configurationsGetSample.ts index f41104e6a1f7..b48bc856224c 100644 --- a/sdk/nginx/arm-nginx/samples-dev/configurationsGetSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/configurationsGetSample.ts @@ -1,32 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the NGINX configuration of given NGINX deployment - * - * @summary Get the NGINX configuration of given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Get.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the NGINX configuration of given NGINX deployment + * + * @summary get the NGINX configuration of given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Configurations_Get.json + */ async function configurationsGet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.get( - resourceGroupName, - deploymentName, - configurationName, - ); + const result = await client.configurations.get("myResourceGroup", "myDeployment", "default"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/configurationsListSample.ts b/sdk/nginx/arm-nginx/samples-dev/configurationsListSample.ts index 5c3ce883aa43..285785b6299e 100644 --- a/sdk/nginx/arm-nginx/samples-dev/configurationsListSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/configurationsListSample.ts @@ -1,33 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List the NGINX configuration of given NGINX deployment. - * - * @summary List the NGINX configuration of given NGINX deployment. - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_List.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list the NGINX configuration of given NGINX deployment. + * + * @summary list the NGINX configuration of given NGINX deployment. + * x-ms-original-file: 2025-03-01-preview/Configurations_List.json + */ async function configurationsList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.configurations.list( - resourceGroupName, - deploymentName, - )) { + for await (const item of client.configurations.list("myResourceGroup", "myDeployment")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples-dev/defaultWafPolicyListSample.ts b/sdk/nginx/arm-nginx/samples-dev/defaultWafPolicyListSample.ts new file mode 100644 index 000000000000..cc3de3cb0c31 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples-dev/defaultWafPolicyListSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the Nginx Waf Policy of given Nginx deployment + * + * @summary get the Nginx Waf Policy of given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/DefaultWafPolicy_List.json + */ +async function defaultWafPolicyList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const result = await client.defaultWafPolicy.list("myResourceGroup", "myDeployment"); + console.log(result); +} + +async function main(): Promise { + await defaultWafPolicyList(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples-dev/deploymentsCreateOrUpdateSample.ts b/sdk/nginx/arm-nginx/samples-dev/deploymentsCreateOrUpdateSample.ts index 8cd7ff66bacd..0958a948ad2e 100644 --- a/sdk/nginx/arm-nginx/samples-dev/deploymentsCreateOrUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/deploymentsCreateOrUpdateSample.ts @@ -1,30 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Create or update the NGINX deployment - * - * @summary Create or update the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Create.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to create or update the NGINX deployment + * + * @summary create or update the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Create.json + */ async function deploymentsCreate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginCreateOrUpdateAndWait( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.createOrUpdate("myResourceGroup", "myDeployment"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/deploymentsDeleteSample.ts b/sdk/nginx/arm-nginx/samples-dev/deploymentsDeleteSample.ts index de7017b976d4..82c05781d784 100644 --- a/sdk/nginx/arm-nginx/samples-dev/deploymentsDeleteSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/deploymentsDeleteSample.ts @@ -1,31 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Delete the NGINX deployment resource - * - * @summary Delete the NGINX deployment resource - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Delete.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to delete the NGINX deployment resource + * + * @summary delete the NGINX deployment resource + * x-ms-original-file: 2025-03-01-preview/Deployments_Delete.json + */ async function deploymentsDelete(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginDeleteAndWait( - resourceGroupName, - deploymentName, - ); - console.log(result); + await client.deployments.delete("myResourceGroup", "myDeployment"); } async function main(): Promise { diff --git a/sdk/nginx/arm-nginx/samples-dev/deploymentsGetSample.ts b/sdk/nginx/arm-nginx/samples-dev/deploymentsGetSample.ts index f8644fa2e163..efa2c8aaf9c5 100644 --- a/sdk/nginx/arm-nginx/samples-dev/deploymentsGetSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/deploymentsGetSample.ts @@ -1,52 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the NGINX deployment - * - * @summary Get the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the NGINX deployment + * + * @summary get the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Get.json + */ async function deploymentsGet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.get( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.get("myResourceGroup", "myDeployment"); console.log(result); } /** - * This sample demonstrates how to Get the NGINX deployment + * This sample demonstrates how to get the NGINX deployment * - * @summary Get the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get_AutoScale.json + * @summary get the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Get_AutoScale.json */ async function deploymentsGetAutoScale(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.get( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.get("myResourceGroup", "myDeployment"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/deploymentsListByResourceGroupSample.ts b/sdk/nginx/arm-nginx/samples-dev/deploymentsListByResourceGroupSample.ts index c7c01c0ecb62..e862a24e66cb 100644 --- a/sdk/nginx/arm-nginx/samples-dev/deploymentsListByResourceGroupSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/deploymentsListByResourceGroupSample.ts @@ -1,31 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List all NGINX deployments under the specified resource group. - * - * @summary List all NGINX deployments under the specified resource group. - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_ListByResourceGroup.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list all NGINX deployments under the specified resource group. + * + * @summary list all NGINX deployments under the specified resource group. + * x-ms-original-file: 2025-03-01-preview/Deployments_ListByResourceGroup.json + */ async function deploymentsListByResourceGroup(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.deployments.listByResourceGroup( - resourceGroupName, - )) { + for await (const item of client.deployments.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples-dev/deploymentsListSample.ts b/sdk/nginx/arm-nginx/samples-dev/deploymentsListSample.ts index 07bda96dad59..b77da15b2136 100644 --- a/sdk/nginx/arm-nginx/samples-dev/deploymentsListSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/deploymentsListSample.ts @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List the NGINX deployments resources - * - * @summary List the NGINX deployments resources - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_List.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list the NGINX deployments resources + * + * @summary list the NGINX deployments resources + * x-ms-original-file: 2025-03-01-preview/Deployments_List.json + */ async function deploymentsList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.deployments.list()) { + for await (const item of client.deployments.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples-dev/deploymentsUpdateSample.ts b/sdk/nginx/arm-nginx/samples-dev/deploymentsUpdateSample.ts index 7a8e8bb93e98..52f1ac5db796 100644 --- a/sdk/nginx/arm-nginx/samples-dev/deploymentsUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/deploymentsUpdateSample.ts @@ -1,52 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Update the NGINX deployment - * - * @summary Update the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Update.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to update the NGINX deployment + * + * @summary update the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Update.json + */ async function deploymentsUpdate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginUpdateAndWait( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.update("myResourceGroup", "myDeployment"); console.log(result); } /** - * This sample demonstrates how to Update the NGINX deployment + * This sample demonstrates how to update the NGINX deployment * - * @summary Update the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_UpdateSubnet.json + * @summary update the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_UpdateSubnet.json */ async function deploymentsUpdateSubnet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginUpdateAndWait( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.update("myResourceGroup", "myDeployment"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples-dev/operationsListSample.ts b/sdk/nginx/arm-nginx/samples-dev/operationsListSample.ts index 3adcc4f31fb3..ce0fb78b913f 100644 --- a/sdk/nginx/arm-nginx/samples-dev/operationsListSample.ts +++ b/sdk/nginx/arm-nginx/samples-dev/operationsListSample.ts @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. - * - * @summary List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Operations_List.json - */ - import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-03-01-preview/Operations_List.json + */ async function operationsList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.operations.list()) { + for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples-dev/wafPolicyCreateSample.ts b/sdk/nginx/arm-nginx/samples-dev/wafPolicyCreateSample.ts new file mode 100644 index 000000000000..f5d57ceb6c33 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples-dev/wafPolicyCreateSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create or update the Nginx Waf Policy for given Nginx deployment + * + * @summary create or update the Nginx Waf Policy for given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/WafPolicy_Create.json + */ +async function wafPolicyCreate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const result = await client.wafPolicy.create("myResourceGroup", "myDeployment", "myWafPolicy"); + console.log(result); +} + +async function main(): Promise { + await wafPolicyCreate(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples-dev/wafPolicyDeleteSample.ts b/sdk/nginx/arm-nginx/samples-dev/wafPolicyDeleteSample.ts new file mode 100644 index 000000000000..721ee9b2a3d5 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples-dev/wafPolicyDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to reset the Nginx Waf Policy of given Nginx deployment to default + * + * @summary reset the Nginx Waf Policy of given Nginx deployment to default + * x-ms-original-file: 2025-03-01-preview/WafPolicy_Delete.json + */ +async function wafPolicyDelete(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + await client.wafPolicy.delete("myResourceGroup", "myDeployment", "myWafPolicy"); +} + +async function main(): Promise { + await wafPolicyDelete(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples-dev/wafPolicyGetSample.ts b/sdk/nginx/arm-nginx/samples-dev/wafPolicyGetSample.ts new file mode 100644 index 000000000000..218a7bce8da3 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples-dev/wafPolicyGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the Nginx Waf Policy of given Nginx deployment + * + * @summary get the Nginx Waf Policy of given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/WafPolicy_Get.json + */ +async function wafPolicyGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const result = await client.wafPolicy.get("myResourceGroup", "myDeployment", "myWafPolicy"); + console.log(result); +} + +async function main(): Promise { + await wafPolicyGet(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples-dev/wafPolicyListSample.ts b/sdk/nginx/arm-nginx/samples-dev/wafPolicyListSample.ts new file mode 100644 index 000000000000..e8cc2407088c --- /dev/null +++ b/sdk/nginx/arm-nginx/samples-dev/wafPolicyListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list Waf Policies of given Nginx deployment + * + * @summary list Waf Policies of given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/WafPolicy_List.json + */ +async function wafPolicyList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.wafPolicy.list("myResourceGroup", "myDeployment")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await wafPolicyList(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/README.md b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/README.md index 8207ca3a418b..41fbb3ff4a23 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/README.md +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/README.md @@ -1,29 +1,34 @@ -# 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** | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [apiKeysCreateOrUpdateSample.js][apikeyscreateorupdatesample] | Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_CreateOrUpdate.json | -| [apiKeysDeleteSample.js][apikeysdeletesample] | Delete API key for Nginx deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Delete.json | -| [apiKeysGetSample.js][apikeysgetsample] | Get the specified API Key of the given Nginx deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Get.json | -| [apiKeysListSample.js][apikeyslistsample] | List all API Keys of the given Nginx deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_List.json | -| [certificatesCreateOrUpdateSample.js][certificatescreateorupdatesample] | Create or update the NGINX certificates for given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_CreateOrUpdate.json | -| [certificatesDeleteSample.js][certificatesdeletesample] | Deletes a certificate from the NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Delete.json | -| [certificatesGetSample.js][certificatesgetsample] | Get a certificate of given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Get.json | -| [certificatesListSample.js][certificateslistsample] | List all certificates of given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_List.json | -| [configurationsAnalysisSample.js][configurationsanalysissample] | Analyze an NGINX configuration without applying it to the NGINXaaS deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Analysis.json | -| [configurationsCreateOrUpdateSample.js][configurationscreateorupdatesample] | Create or update the NGINX configuration for given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_CreateOrUpdate.json | -| [configurationsDeleteSample.js][configurationsdeletesample] | Reset the NGINX configuration of given NGINX deployment to default x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Delete.json | -| [configurationsGetSample.js][configurationsgetsample] | Get the NGINX configuration of given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Get.json | -| [configurationsListSample.js][configurationslistsample] | List the NGINX configuration of given NGINX deployment. x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_List.json | -| [deploymentsCreateOrUpdateSample.js][deploymentscreateorupdatesample] | Create or update the NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Create.json | -| [deploymentsDeleteSample.js][deploymentsdeletesample] | Delete the NGINX deployment resource x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Delete.json | -| [deploymentsGetSample.js][deploymentsgetsample] | Get the NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get.json | -| [deploymentsListByResourceGroupSample.js][deploymentslistbyresourcegroupsample] | List all NGINX deployments under the specified resource group. x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_ListByResourceGroup.json | -| [deploymentsListSample.js][deploymentslistsample] | List the NGINX deployments resources x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_List.json | -| [deploymentsUpdateSample.js][deploymentsupdatesample] | Update the NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Update.json | -| [operationsListSample.js][operationslistsample] | List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Operations_List.json | +# @azure/arm-nginx client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for @azure/arm-nginx in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [apiKeysCreateOrUpdateSample.js][apikeyscreateorupdatesample] | create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint x-ms-original-file: 2025-03-01-preview/ApiKeys_CreateOrUpdate.json | +| [apiKeysDeleteSample.js][apikeysdeletesample] | delete API key for Nginx deployment x-ms-original-file: 2025-03-01-preview/ApiKeys_Delete.json | +| [apiKeysGetSample.js][apikeysgetsample] | get the specified API Key of the given Nginx deployment x-ms-original-file: 2025-03-01-preview/ApiKeys_Get.json | +| [apiKeysListSample.js][apikeyslistsample] | list all API Keys of the given Nginx deployment x-ms-original-file: 2025-03-01-preview/ApiKeys_List.json | +| [certificatesCreateOrUpdateSample.js][certificatescreateorupdatesample] | create or update the NGINX certificates for given NGINX deployment x-ms-original-file: 2025-03-01-preview/Certificates_CreateOrUpdate.json | +| [certificatesDeleteSample.js][certificatesdeletesample] | deletes a certificate from the NGINX deployment x-ms-original-file: 2025-03-01-preview/Certificates_Delete.json | +| [certificatesGetSample.js][certificatesgetsample] | get a certificate of given NGINX deployment x-ms-original-file: 2025-03-01-preview/Certificates_Get.json | +| [certificatesListSample.js][certificateslistsample] | list all certificates of given NGINX deployment x-ms-original-file: 2025-03-01-preview/Certificates_List.json | +| [configurationsAnalysisSample.js][configurationsanalysissample] | analyze an NGINX configuration without applying it to the NGINXaaS deployment x-ms-original-file: 2025-03-01-preview/Configurations_Analysis.json | +| [configurationsCreateOrUpdateSample.js][configurationscreateorupdatesample] | create or update the NGINX configuration for given NGINX deployment x-ms-original-file: 2025-03-01-preview/Configurations_CreateOrUpdate.json | +| [configurationsDeleteSample.js][configurationsdeletesample] | reset the NGINX configuration of given NGINX deployment to default x-ms-original-file: 2025-03-01-preview/Configurations_Delete.json | +| [configurationsGetSample.js][configurationsgetsample] | get the NGINX configuration of given NGINX deployment x-ms-original-file: 2025-03-01-preview/Configurations_Get.json | +| [configurationsListSample.js][configurationslistsample] | list the NGINX configuration of given NGINX deployment. x-ms-original-file: 2025-03-01-preview/Configurations_List.json | +| [defaultWafPolicyListSample.js][defaultwafpolicylistsample] | get the Nginx Waf Policy of given Nginx deployment x-ms-original-file: 2025-03-01-preview/DefaultWafPolicy_List.json | +| [deploymentsCreateOrUpdateSample.js][deploymentscreateorupdatesample] | create or update the NGINX deployment x-ms-original-file: 2025-03-01-preview/Deployments_Create.json | +| [deploymentsDeleteSample.js][deploymentsdeletesample] | delete the NGINX deployment resource x-ms-original-file: 2025-03-01-preview/Deployments_Delete.json | +| [deploymentsGetSample.js][deploymentsgetsample] | get the NGINX deployment x-ms-original-file: 2025-03-01-preview/Deployments_Get.json | +| [deploymentsListByResourceGroupSample.js][deploymentslistbyresourcegroupsample] | list all NGINX deployments under the specified resource group. x-ms-original-file: 2025-03-01-preview/Deployments_ListByResourceGroup.json | +| [deploymentsListSample.js][deploymentslistsample] | list the NGINX deployments resources x-ms-original-file: 2025-03-01-preview/Deployments_List.json | +| [deploymentsUpdateSample.js][deploymentsupdatesample] | update the NGINX deployment x-ms-original-file: 2025-03-01-preview/Deployments_Update.json | +| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2025-03-01-preview/Operations_List.json | +| [wafPolicyCreateSample.js][wafpolicycreatesample] | create or update the Nginx Waf Policy for given Nginx deployment x-ms-original-file: 2025-03-01-preview/WafPolicy_Create.json | +| [wafPolicyDeleteSample.js][wafpolicydeletesample] | reset the Nginx Waf Policy of given Nginx deployment to default x-ms-original-file: 2025-03-01-preview/WafPolicy_Delete.json | +| [wafPolicyGetSample.js][wafpolicygetsample] | get the Nginx Waf Policy of given Nginx deployment x-ms-original-file: 2025-03-01-preview/WafPolicy_Get.json | +| [wafPolicyListSample.js][wafpolicylistsample] | list Waf Policies of given Nginx deployment x-ms-original-file: 2025-03-01-preview/WafPolicy_List.json | ## Prerequisites @@ -53,10 +58,10 @@ npm install node apiKeysCreateOrUpdateSample.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): +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -cross-env NGINX_SUBSCRIPTION_ID="" NGINX_RESOURCE_GROUP="" node apiKeysCreateOrUpdateSample.js +node apiKeysCreateOrUpdateSample.js ``` ## Next Steps @@ -76,6 +81,7 @@ Take a look at our [API Documentation][apiref] for more information about the AP [configurationsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsDeleteSample.js [configurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsGetSample.js [configurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsListSample.js +[defaultwafpolicylistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/defaultWafPolicyListSample.js [deploymentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsCreateOrUpdateSample.js [deploymentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsDeleteSample.js [deploymentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsGetSample.js @@ -83,6 +89,10 @@ Take a look at our [API Documentation][apiref] for more information about the AP [deploymentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsListSample.js [deploymentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsUpdateSample.js [operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/operationsListSample.js +[wafpolicycreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyCreateSample.js +[wafpolicydeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyDeleteSample.js +[wafpolicygetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyGetSample.js +[wafpolicylistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyListSample.js [apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-nginx?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/nginx/arm-nginx/README.md diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysCreateOrUpdateSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysCreateOrUpdateSample.js index cedddcba2ee3..aac9911dfb81 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysCreateOrUpdateSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysCreateOrUpdateSample.js @@ -1,30 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint + * This sample demonstrates how to create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint * - * @summary Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_CreateOrUpdate.json + * @summary create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint + * x-ms-original-file: 2025-03-01-preview/ApiKeys_CreateOrUpdate.json */ async function apiKeysCreateOrUpdate() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const apiKeyName = "myApiKey"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.apiKeys.createOrUpdate(resourceGroupName, deploymentName, apiKeyName); + const result = await client.apiKeys.createOrUpdate("myResourceGroup", "myDeployment", "myApiKey"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysDeleteSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysDeleteSample.js index 9e693de6a8c3..cd6991c11e37 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysDeleteSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysDeleteSample.js @@ -1,31 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Delete API key for Nginx deployment + * This sample demonstrates how to delete API key for Nginx deployment * - * @summary Delete API key for Nginx deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Delete.json + * @summary delete API key for Nginx deployment + * x-ms-original-file: 2025-03-01-preview/ApiKeys_Delete.json */ async function apiKeysDelete() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const apiKeyName = "myApiKey"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.apiKeys.delete(resourceGroupName, deploymentName, apiKeyName); - console.log(result); + await client.apiKeys.delete("myResourceGroup", "myDeployment", "myApiKey"); } async function main() { diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysGetSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysGetSample.js index 1d9c58128aa7..64d8b2b9e172 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysGetSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysGetSample.js @@ -1,30 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Get the specified API Key of the given Nginx deployment + * This sample demonstrates how to get the specified API Key of the given Nginx deployment * - * @summary Get the specified API Key of the given Nginx deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Get.json + * @summary get the specified API Key of the given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/ApiKeys_Get.json */ async function apiKeysGet() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const apiKeyName = "myApiKey"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.apiKeys.get(resourceGroupName, deploymentName, apiKeyName); + const result = await client.apiKeys.get("myResourceGroup", "myDeployment", "myApiKey"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysListSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysListSample.js index abd3885f1484..b0861cd975d2 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysListSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/apiKeysListSample.js @@ -1,32 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to List all API Keys of the given Nginx deployment + * This sample demonstrates how to list all API Keys of the given Nginx deployment * - * @summary List all API Keys of the given Nginx deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_List.json + * @summary list all API Keys of the given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/ApiKeys_List.json */ async function apiKeysList() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.apiKeys.list(resourceGroupName, deploymentName)) { + for await (const item of client.apiKeys.list("myResourceGroup", "myDeployment")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesCreateOrUpdateSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesCreateOrUpdateSample.js index 47c7f4ba720b..a30bfeb003e8 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesCreateOrUpdateSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesCreateOrUpdateSample.js @@ -1,33 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Create or update the NGINX certificates for given NGINX deployment + * This sample demonstrates how to create or update the NGINX certificates for given NGINX deployment * - * @summary Create or update the NGINX certificates for given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_CreateOrUpdate.json + * @summary create or update the NGINX certificates for given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_CreateOrUpdate.json */ async function certificatesCreateOrUpdate() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const certificateName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.certificates.beginCreateOrUpdateAndWait( - resourceGroupName, - deploymentName, - certificateName, + const result = await client.certificates.createOrUpdate( + "myResourceGroup", + "myDeployment", + "default", ); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesDeleteSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesDeleteSample.js index dfc694e6d4fb..9f15801d696a 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesDeleteSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesDeleteSample.js @@ -1,35 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Deletes a certificate from the NGINX deployment + * This sample demonstrates how to deletes a certificate from the NGINX deployment * - * @summary Deletes a certificate from the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Delete.json + * @summary deletes a certificate from the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_Delete.json */ async function certificatesDelete() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const certificateName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.certificates.beginDeleteAndWait( - resourceGroupName, - deploymentName, - certificateName, - ); - console.log(result); + await client.certificates.delete("myResourceGroup", "myDeployment", "default"); } async function main() { diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesGetSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesGetSample.js index 0218734a18cf..5149de2a2c42 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesGetSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesGetSample.js @@ -1,30 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Get a certificate of given NGINX deployment + * This sample demonstrates how to get a certificate of given NGINX deployment * - * @summary Get a certificate of given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Get.json + * @summary get a certificate of given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_Get.json */ async function certificatesGet() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const certificateName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.certificates.get(resourceGroupName, deploymentName, certificateName); + const result = await client.certificates.get("myResourceGroup", "myDeployment", "default"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesListSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesListSample.js index f1846cc8dbe9..0e6900475db3 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesListSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/certificatesListSample.js @@ -1,32 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to List all certificates of given NGINX deployment + * This sample demonstrates how to list all certificates of given NGINX deployment * - * @summary List all certificates of given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_List.json + * @summary list all certificates of given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_List.json */ async function certificatesList() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.certificates.list(resourceGroupName, deploymentName)) { + for await (const item of client.certificates.list("myResourceGroup", "myDeployment")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsAnalysisSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsAnalysisSample.js index bd7a702ea957..bb089b0ef2de 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsAnalysisSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsAnalysisSample.js @@ -1,34 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Analyze an NGINX configuration without applying it to the NGINXaaS deployment + * This sample demonstrates how to analyze an NGINX configuration without applying it to the NGINXaaS deployment * - * @summary Analyze an NGINX configuration without applying it to the NGINXaaS deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Analysis.json + * @summary analyze an NGINX configuration without applying it to the NGINXaaS deployment + * x-ms-original-file: 2025-03-01-preview/Configurations_Analysis.json */ async function configurationsAnalysis() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.analysis( - resourceGroupName, - deploymentName, - configurationName, - ); + const result = await client.configurations.analysis("myResourceGroup", "myDeployment", "default"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsCreateOrUpdateSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsCreateOrUpdateSample.js index 921507978975..f505a392b2d2 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsCreateOrUpdateSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsCreateOrUpdateSample.js @@ -1,33 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Create or update the NGINX configuration for given NGINX deployment + * This sample demonstrates how to create or update the NGINX configuration for given NGINX deployment * - * @summary Create or update the NGINX configuration for given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_CreateOrUpdate.json + * @summary create or update the NGINX configuration for given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Configurations_CreateOrUpdate.json */ async function configurationsCreateOrUpdate() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.beginCreateOrUpdateAndWait( - resourceGroupName, - deploymentName, - configurationName, + const result = await client.configurations.createOrUpdate( + "myResourceGroup", + "myDeployment", + "default", ); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsDeleteSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsDeleteSample.js index 3b4ea9042b9d..f202abaee3ee 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsDeleteSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsDeleteSample.js @@ -1,35 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Reset the NGINX configuration of given NGINX deployment to default + * This sample demonstrates how to reset the NGINX configuration of given NGINX deployment to default * - * @summary Reset the NGINX configuration of given NGINX deployment to default - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Delete.json + * @summary reset the NGINX configuration of given NGINX deployment to default + * x-ms-original-file: 2025-03-01-preview/Configurations_Delete.json */ async function configurationsDelete() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.beginDeleteAndWait( - resourceGroupName, - deploymentName, - configurationName, - ); - console.log(result); + await client.configurations.delete("myResourceGroup", "myDeployment", "default"); } async function main() { diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsGetSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsGetSample.js index 6d1978abeb18..90d428b1b6de 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsGetSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsGetSample.js @@ -1,34 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Get the NGINX configuration of given NGINX deployment + * This sample demonstrates how to get the NGINX configuration of given NGINX deployment * - * @summary Get the NGINX configuration of given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Get.json + * @summary get the NGINX configuration of given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Configurations_Get.json */ async function configurationsGet() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.get( - resourceGroupName, - deploymentName, - configurationName, - ); + const result = await client.configurations.get("myResourceGroup", "myDeployment", "default"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsListSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsListSample.js index b77d666f1f03..fdbbf9488945 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsListSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/configurationsListSample.js @@ -1,32 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to List the NGINX configuration of given NGINX deployment. + * This sample demonstrates how to list the NGINX configuration of given NGINX deployment. * - * @summary List the NGINX configuration of given NGINX deployment. - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_List.json + * @summary list the NGINX configuration of given NGINX deployment. + * x-ms-original-file: 2025-03-01-preview/Configurations_List.json */ async function configurationsList() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.configurations.list(resourceGroupName, deploymentName)) { + for await (const item of client.configurations.list("myResourceGroup", "myDeployment")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/defaultWafPolicyListSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/defaultWafPolicyListSample.js new file mode 100644 index 000000000000..00c646ac78e0 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/defaultWafPolicyListSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { NginxManagementClient } = require("@azure/arm-nginx"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the Nginx Waf Policy of given Nginx deployment + * + * @summary get the Nginx Waf Policy of given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/DefaultWafPolicy_List.json + */ +async function defaultWafPolicyList() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const result = await client.defaultWafPolicy.list("myResourceGroup", "myDeployment"); + console.log(result); +} + +async function main() { + await defaultWafPolicyList(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsCreateOrUpdateSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsCreateOrUpdateSample.js index e94c2d64e4b5..0bada390a2af 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsCreateOrUpdateSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsCreateOrUpdateSample.js @@ -1,32 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Create or update the NGINX deployment + * This sample demonstrates how to create or update the NGINX deployment * - * @summary Create or update the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Create.json + * @summary create or update the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Create.json */ async function deploymentsCreate() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginCreateOrUpdateAndWait( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.createOrUpdate("myResourceGroup", "myDeployment"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsDeleteSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsDeleteSample.js index e9052e812c5e..37572df37390 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsDeleteSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsDeleteSample.js @@ -1,30 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Delete the NGINX deployment resource + * This sample demonstrates how to delete the NGINX deployment resource * - * @summary Delete the NGINX deployment resource - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Delete.json + * @summary delete the NGINX deployment resource + * x-ms-original-file: 2025-03-01-preview/Deployments_Delete.json */ async function deploymentsDelete() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginDeleteAndWait(resourceGroupName, deploymentName); - console.log(result); + await client.deployments.delete("myResourceGroup", "myDeployment"); } async function main() { diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsGetSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsGetSample.js index 15ad31cff839..283409665e9c 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsGetSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsGetSample.js @@ -1,46 +1,34 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. const { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Get the NGINX deployment + * This sample demonstrates how to get the NGINX deployment * - * @summary Get the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get.json + * @summary get the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Get.json */ async function deploymentsGet() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.get(resourceGroupName, deploymentName); + const result = await client.deployments.get("myResourceGroup", "myDeployment"); console.log(result); } /** - * This sample demonstrates how to Get the NGINX deployment + * This sample demonstrates how to get the NGINX deployment * - * @summary Get the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get_AutoScale.json + * @summary get the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Get_AutoScale.json */ async function deploymentsGetAutoScale() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.get(resourceGroupName, deploymentName); + const result = await client.deployments.get("myResourceGroup", "myDeployment"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsListByResourceGroupSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsListByResourceGroupSample.js index 4e89af1c3de0..4e85b8a6a9b3 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsListByResourceGroupSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsListByResourceGroupSample.js @@ -1,31 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to List all NGINX deployments under the specified resource group. + * This sample demonstrates how to list all NGINX deployments under the specified resource group. * - * @summary List all NGINX deployments under the specified resource group. - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_ListByResourceGroup.json + * @summary list all NGINX deployments under the specified resource group. + * x-ms-original-file: 2025-03-01-preview/Deployments_ListByResourceGroup.json */ async function deploymentsListByResourceGroup() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.deployments.listByResourceGroup(resourceGroupName)) { + for await (const item of client.deployments.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsListSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsListSample.js index affe9ec0a80c..999c97f60b3e 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsListSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsListSample.js @@ -1,30 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to List the NGINX deployments resources + * This sample demonstrates how to list the NGINX deployments resources * - * @summary List the NGINX deployments resources - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_List.json + * @summary list the NGINX deployments resources + * x-ms-original-file: 2025-03-01-preview/Deployments_List.json */ async function deploymentsList() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.deployments.list()) { + for await (const item of client.deployments.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsUpdateSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsUpdateSample.js index bd648f45447c..905d35ab3de1 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsUpdateSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/deploymentsUpdateSample.js @@ -1,46 +1,34 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. const { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Update the NGINX deployment + * This sample demonstrates how to update the NGINX deployment * - * @summary Update the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Update.json + * @summary update the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Update.json */ async function deploymentsUpdate() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginUpdateAndWait(resourceGroupName, deploymentName); + const result = await client.deployments.update("myResourceGroup", "myDeployment"); console.log(result); } /** - * This sample demonstrates how to Update the NGINX deployment + * This sample demonstrates how to update the NGINX deployment * - * @summary Update the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_UpdateSubnet.json + * @summary update the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_UpdateSubnet.json */ async function deploymentsUpdateSubnet() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginUpdateAndWait(resourceGroupName, deploymentName); + const result = await client.deployments.update("myResourceGroup", "myDeployment"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/operationsListSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/operationsListSample.js index 4c3f80d139ab..857209422b92 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/operationsListSample.js +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/operationsListSample.js @@ -1,30 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } = require("@azure/arm-nginx"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. + * This sample demonstrates how to list the operations for the provider * - * @summary List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Operations_List.json + * @summary list the operations for the provider + * x-ms-original-file: 2025-03-01-preview/Operations_List.json */ async function operationsList() { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.operations.list()) { + for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/package.json b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/package.json index 47b5d3e06107..2547338998f0 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/package.json +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/package.json @@ -2,7 +2,7 @@ "name": "@azure-samples/arm-nginx-js-beta", "private": true, "version": "1.0.0", - "description": " client library samples for JavaScript (Beta)", + "description": "@azure/arm-nginx client library samples for JavaScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -14,6 +14,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -27,6 +28,9 @@ "dependencies": { "@azure/arm-nginx": "next", "dotenv": "latest", - "@azure/identity": "^4.7.0" + "@azure/identity": "^4.13.0" + }, + "devDependencies": { + "cross-env": "latest" } } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyCreateSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyCreateSample.js new file mode 100644 index 000000000000..0f945d881555 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyCreateSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { NginxManagementClient } = require("@azure/arm-nginx"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create or update the Nginx Waf Policy for given Nginx deployment + * + * @summary create or update the Nginx Waf Policy for given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/WafPolicy_Create.json + */ +async function wafPolicyCreate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const result = await client.wafPolicy.create("myResourceGroup", "myDeployment", "myWafPolicy"); + console.log(result); +} + +async function main() { + await wafPolicyCreate(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyDeleteSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyDeleteSample.js new file mode 100644 index 000000000000..d8a85a09b01d --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { NginxManagementClient } = require("@azure/arm-nginx"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to reset the Nginx Waf Policy of given Nginx deployment to default + * + * @summary reset the Nginx Waf Policy of given Nginx deployment to default + * x-ms-original-file: 2025-03-01-preview/WafPolicy_Delete.json + */ +async function wafPolicyDelete() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + await client.wafPolicy.delete("myResourceGroup", "myDeployment", "myWafPolicy"); +} + +async function main() { + await wafPolicyDelete(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyGetSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyGetSample.js new file mode 100644 index 000000000000..110cda673a56 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { NginxManagementClient } = require("@azure/arm-nginx"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the Nginx Waf Policy of given Nginx deployment + * + * @summary get the Nginx Waf Policy of given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/WafPolicy_Get.json + */ +async function wafPolicyGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const result = await client.wafPolicy.get("myResourceGroup", "myDeployment", "myWafPolicy"); + console.log(result); +} + +async function main() { + await wafPolicyGet(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyListSample.js b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyListSample.js new file mode 100644 index 000000000000..fe659b8a0100 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/javascript/wafPolicyListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { NginxManagementClient } = require("@azure/arm-nginx"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list Waf Policies of given Nginx deployment + * + * @summary list Waf Policies of given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/WafPolicy_List.json + */ +async function wafPolicyList() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.wafPolicy.list("myResourceGroup", "myDeployment")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await wafPolicyList(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/README.md b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/README.md index 7943c3e04b4c..e44d46ffe751 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/README.md +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/README.md @@ -1,29 +1,34 @@ -# 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** | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [apiKeysCreateOrUpdateSample.ts][apikeyscreateorupdatesample] | Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_CreateOrUpdate.json | -| [apiKeysDeleteSample.ts][apikeysdeletesample] | Delete API key for Nginx deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Delete.json | -| [apiKeysGetSample.ts][apikeysgetsample] | Get the specified API Key of the given Nginx deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Get.json | -| [apiKeysListSample.ts][apikeyslistsample] | List all API Keys of the given Nginx deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_List.json | -| [certificatesCreateOrUpdateSample.ts][certificatescreateorupdatesample] | Create or update the NGINX certificates for given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_CreateOrUpdate.json | -| [certificatesDeleteSample.ts][certificatesdeletesample] | Deletes a certificate from the NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Delete.json | -| [certificatesGetSample.ts][certificatesgetsample] | Get a certificate of given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Get.json | -| [certificatesListSample.ts][certificateslistsample] | List all certificates of given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_List.json | -| [configurationsAnalysisSample.ts][configurationsanalysissample] | Analyze an NGINX configuration without applying it to the NGINXaaS deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Analysis.json | -| [configurationsCreateOrUpdateSample.ts][configurationscreateorupdatesample] | Create or update the NGINX configuration for given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_CreateOrUpdate.json | -| [configurationsDeleteSample.ts][configurationsdeletesample] | Reset the NGINX configuration of given NGINX deployment to default x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Delete.json | -| [configurationsGetSample.ts][configurationsgetsample] | Get the NGINX configuration of given NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Get.json | -| [configurationsListSample.ts][configurationslistsample] | List the NGINX configuration of given NGINX deployment. x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_List.json | -| [deploymentsCreateOrUpdateSample.ts][deploymentscreateorupdatesample] | Create or update the NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Create.json | -| [deploymentsDeleteSample.ts][deploymentsdeletesample] | Delete the NGINX deployment resource x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Delete.json | -| [deploymentsGetSample.ts][deploymentsgetsample] | Get the NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get.json | -| [deploymentsListByResourceGroupSample.ts][deploymentslistbyresourcegroupsample] | List all NGINX deployments under the specified resource group. x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_ListByResourceGroup.json | -| [deploymentsListSample.ts][deploymentslistsample] | List the NGINX deployments resources x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_List.json | -| [deploymentsUpdateSample.ts][deploymentsupdatesample] | Update the NGINX deployment x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Update.json | -| [operationsListSample.ts][operationslistsample] | List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Operations_List.json | +# @azure/arm-nginx client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for @azure/arm-nginx in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [apiKeysCreateOrUpdateSample.ts][apikeyscreateorupdatesample] | create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint x-ms-original-file: 2025-03-01-preview/ApiKeys_CreateOrUpdate.json | +| [apiKeysDeleteSample.ts][apikeysdeletesample] | delete API key for Nginx deployment x-ms-original-file: 2025-03-01-preview/ApiKeys_Delete.json | +| [apiKeysGetSample.ts][apikeysgetsample] | get the specified API Key of the given Nginx deployment x-ms-original-file: 2025-03-01-preview/ApiKeys_Get.json | +| [apiKeysListSample.ts][apikeyslistsample] | list all API Keys of the given Nginx deployment x-ms-original-file: 2025-03-01-preview/ApiKeys_List.json | +| [certificatesCreateOrUpdateSample.ts][certificatescreateorupdatesample] | create or update the NGINX certificates for given NGINX deployment x-ms-original-file: 2025-03-01-preview/Certificates_CreateOrUpdate.json | +| [certificatesDeleteSample.ts][certificatesdeletesample] | deletes a certificate from the NGINX deployment x-ms-original-file: 2025-03-01-preview/Certificates_Delete.json | +| [certificatesGetSample.ts][certificatesgetsample] | get a certificate of given NGINX deployment x-ms-original-file: 2025-03-01-preview/Certificates_Get.json | +| [certificatesListSample.ts][certificateslistsample] | list all certificates of given NGINX deployment x-ms-original-file: 2025-03-01-preview/Certificates_List.json | +| [configurationsAnalysisSample.ts][configurationsanalysissample] | analyze an NGINX configuration without applying it to the NGINXaaS deployment x-ms-original-file: 2025-03-01-preview/Configurations_Analysis.json | +| [configurationsCreateOrUpdateSample.ts][configurationscreateorupdatesample] | create or update the NGINX configuration for given NGINX deployment x-ms-original-file: 2025-03-01-preview/Configurations_CreateOrUpdate.json | +| [configurationsDeleteSample.ts][configurationsdeletesample] | reset the NGINX configuration of given NGINX deployment to default x-ms-original-file: 2025-03-01-preview/Configurations_Delete.json | +| [configurationsGetSample.ts][configurationsgetsample] | get the NGINX configuration of given NGINX deployment x-ms-original-file: 2025-03-01-preview/Configurations_Get.json | +| [configurationsListSample.ts][configurationslistsample] | list the NGINX configuration of given NGINX deployment. x-ms-original-file: 2025-03-01-preview/Configurations_List.json | +| [defaultWafPolicyListSample.ts][defaultwafpolicylistsample] | get the Nginx Waf Policy of given Nginx deployment x-ms-original-file: 2025-03-01-preview/DefaultWafPolicy_List.json | +| [deploymentsCreateOrUpdateSample.ts][deploymentscreateorupdatesample] | create or update the NGINX deployment x-ms-original-file: 2025-03-01-preview/Deployments_Create.json | +| [deploymentsDeleteSample.ts][deploymentsdeletesample] | delete the NGINX deployment resource x-ms-original-file: 2025-03-01-preview/Deployments_Delete.json | +| [deploymentsGetSample.ts][deploymentsgetsample] | get the NGINX deployment x-ms-original-file: 2025-03-01-preview/Deployments_Get.json | +| [deploymentsListByResourceGroupSample.ts][deploymentslistbyresourcegroupsample] | list all NGINX deployments under the specified resource group. x-ms-original-file: 2025-03-01-preview/Deployments_ListByResourceGroup.json | +| [deploymentsListSample.ts][deploymentslistsample] | list the NGINX deployments resources x-ms-original-file: 2025-03-01-preview/Deployments_List.json | +| [deploymentsUpdateSample.ts][deploymentsupdatesample] | update the NGINX deployment x-ms-original-file: 2025-03-01-preview/Deployments_Update.json | +| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2025-03-01-preview/Operations_List.json | +| [wafPolicyCreateSample.ts][wafpolicycreatesample] | create or update the Nginx Waf Policy for given Nginx deployment x-ms-original-file: 2025-03-01-preview/WafPolicy_Create.json | +| [wafPolicyDeleteSample.ts][wafpolicydeletesample] | reset the Nginx Waf Policy of given Nginx deployment to default x-ms-original-file: 2025-03-01-preview/WafPolicy_Delete.json | +| [wafPolicyGetSample.ts][wafpolicygetsample] | get the Nginx Waf Policy of given Nginx deployment x-ms-original-file: 2025-03-01-preview/WafPolicy_Get.json | +| [wafPolicyListSample.ts][wafpolicylistsample] | list Waf Policies of given Nginx deployment x-ms-original-file: 2025-03-01-preview/WafPolicy_List.json | ## Prerequisites @@ -65,10 +70,10 @@ npm run build node dist/apiKeysCreateOrUpdateSample.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): +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -cross-env NGINX_SUBSCRIPTION_ID="" NGINX_RESOURCE_GROUP="" node dist/apiKeysCreateOrUpdateSample.js +node dist/apiKeysCreateOrUpdateSample.js ``` ## Next Steps @@ -88,6 +93,7 @@ Take a look at our [API Documentation][apiref] for more information about the AP [configurationsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsDeleteSample.ts [configurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsGetSample.ts [configurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsListSample.ts +[defaultwafpolicylistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/defaultWafPolicyListSample.ts [deploymentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsCreateOrUpdateSample.ts [deploymentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsDeleteSample.ts [deploymentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsGetSample.ts @@ -95,6 +101,10 @@ Take a look at our [API Documentation][apiref] for more information about the AP [deploymentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsListSample.ts [deploymentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsUpdateSample.ts [operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/operationsListSample.ts +[wafpolicycreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyCreateSample.ts +[wafpolicydeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyDeleteSample.ts +[wafpolicygetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyGetSample.ts +[wafpolicylistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyListSample.ts [apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-nginx?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/nginx/arm-nginx/README.md diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/package.json b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/package.json index 965b9cfe7046..687469d9c1a5 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/package.json +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/package.json @@ -2,7 +2,7 @@ "name": "@azure-samples/arm-nginx-ts-beta", "private": true, "version": "1.0.0", - "description": " client library samples for TypeScript (Beta)", + "description": "@azure/arm-nginx client library samples for TypeScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -18,6 +18,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -31,11 +32,12 @@ "dependencies": { "@azure/arm-nginx": "next", "dotenv": "latest", - "@azure/identity": "^4.7.0" + "@azure/identity": "^4.13.0" }, "devDependencies": { "@types/node": "^20.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" + "cross-env": "latest", + "rimraf": "latest", + "typescript": "~5.9.3" } } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysCreateOrUpdateSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysCreateOrUpdateSample.ts index 4d43466e5e4f..eaeb6d26984e 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysCreateOrUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysCreateOrUpdateSample.ts @@ -1,36 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint + * This sample demonstrates how to create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint * - * @summary Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_CreateOrUpdate.json + * @summary create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint + * x-ms-original-file: 2025-03-01-preview/ApiKeys_CreateOrUpdate.json */ async function apiKeysCreateOrUpdate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const apiKeyName = "myApiKey"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.apiKeys.createOrUpdate( - resourceGroupName, - deploymentName, - apiKeyName, - ); + const result = await client.apiKeys.createOrUpdate("myResourceGroup", "myDeployment", "myApiKey"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysDeleteSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysDeleteSample.ts index cee752e27978..3463c80b20c2 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysDeleteSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysDeleteSample.ts @@ -1,37 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete API key for Nginx deployment + * This sample demonstrates how to delete API key for Nginx deployment * - * @summary Delete API key for Nginx deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Delete.json + * @summary delete API key for Nginx deployment + * x-ms-original-file: 2025-03-01-preview/ApiKeys_Delete.json */ async function apiKeysDelete(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const apiKeyName = "myApiKey"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.apiKeys.delete( - resourceGroupName, - deploymentName, - apiKeyName, - ); - console.log(result); + await client.apiKeys.delete("myResourceGroup", "myDeployment", "myApiKey"); } async function main(): Promise { diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysGetSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysGetSample.ts index 6e19960bed55..105e2ef6b2e2 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysGetSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysGetSample.ts @@ -1,36 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the specified API Key of the given Nginx deployment + * This sample demonstrates how to get the specified API Key of the given Nginx deployment * - * @summary Get the specified API Key of the given Nginx deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_Get.json + * @summary get the specified API Key of the given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/ApiKeys_Get.json */ async function apiKeysGet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const apiKeyName = "myApiKey"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.apiKeys.get( - resourceGroupName, - deploymentName, - apiKeyName, - ); + const result = await client.apiKeys.get("myResourceGroup", "myDeployment", "myApiKey"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysListSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysListSample.ts index a3fd9932de94..46ab4fdef45e 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysListSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/apiKeysListSample.ts @@ -1,37 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List all API Keys of the given Nginx deployment + * This sample demonstrates how to list all API Keys of the given Nginx deployment * - * @summary List all API Keys of the given Nginx deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/ApiKeys_List.json + * @summary list all API Keys of the given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/ApiKeys_List.json */ async function apiKeysList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.apiKeys.list( - resourceGroupName, - deploymentName, - )) { + for await (const item of client.apiKeys.list("myResourceGroup", "myDeployment")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesCreateOrUpdateSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesCreateOrUpdateSample.ts index ca5fce722680..95169639d4b3 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesCreateOrUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesCreateOrUpdateSample.ts @@ -1,35 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create or update the NGINX certificates for given NGINX deployment + * This sample demonstrates how to create or update the NGINX certificates for given NGINX deployment * - * @summary Create or update the NGINX certificates for given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_CreateOrUpdate.json + * @summary create or update the NGINX certificates for given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_CreateOrUpdate.json */ async function certificatesCreateOrUpdate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const certificateName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.certificates.beginCreateOrUpdateAndWait( - resourceGroupName, - deploymentName, - certificateName, + const result = await client.certificates.createOrUpdate( + "myResourceGroup", + "myDeployment", + "default", ); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesDeleteSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesDeleteSample.ts index 40071dc3717c..36eaced27699 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesDeleteSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesDeleteSample.ts @@ -1,37 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Deletes a certificate from the NGINX deployment + * This sample demonstrates how to deletes a certificate from the NGINX deployment * - * @summary Deletes a certificate from the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Delete.json + * @summary deletes a certificate from the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_Delete.json */ async function certificatesDelete(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const certificateName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.certificates.beginDeleteAndWait( - resourceGroupName, - deploymentName, - certificateName, - ); - console.log(result); + await client.certificates.delete("myResourceGroup", "myDeployment", "default"); } async function main(): Promise { diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesGetSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesGetSample.ts index 58a21d9019f1..186d95ccda8b 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesGetSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesGetSample.ts @@ -1,36 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a certificate of given NGINX deployment + * This sample demonstrates how to get a certificate of given NGINX deployment * - * @summary Get a certificate of given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_Get.json + * @summary get a certificate of given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_Get.json */ async function certificatesGet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const certificateName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.certificates.get( - resourceGroupName, - deploymentName, - certificateName, - ); + const result = await client.certificates.get("myResourceGroup", "myDeployment", "default"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesListSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesListSample.ts index 60d2c4455e45..7cbf4a6dda78 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesListSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/certificatesListSample.ts @@ -1,37 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List all certificates of given NGINX deployment + * This sample demonstrates how to list all certificates of given NGINX deployment * - * @summary List all certificates of given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Certificates_List.json + * @summary list all certificates of given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Certificates_List.json */ async function certificatesList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.certificates.list( - resourceGroupName, - deploymentName, - )) { + for await (const item of client.certificates.list("myResourceGroup", "myDeployment")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsAnalysisSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsAnalysisSample.ts index 9147ba0d6dc5..56e7a12abe8d 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsAnalysisSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsAnalysisSample.ts @@ -1,36 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Analyze an NGINX configuration without applying it to the NGINXaaS deployment + * This sample demonstrates how to analyze an NGINX configuration without applying it to the NGINXaaS deployment * - * @summary Analyze an NGINX configuration without applying it to the NGINXaaS deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Analysis.json + * @summary analyze an NGINX configuration without applying it to the NGINXaaS deployment + * x-ms-original-file: 2025-03-01-preview/Configurations_Analysis.json */ async function configurationsAnalysis(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.analysis( - resourceGroupName, - deploymentName, - configurationName, - ); + const result = await client.configurations.analysis("myResourceGroup", "myDeployment", "default"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsCreateOrUpdateSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsCreateOrUpdateSample.ts index c5a7c4d689d8..67ae9602a6f8 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsCreateOrUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsCreateOrUpdateSample.ts @@ -1,35 +1,23 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create or update the NGINX configuration for given NGINX deployment + * This sample demonstrates how to create or update the NGINX configuration for given NGINX deployment * - * @summary Create or update the NGINX configuration for given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_CreateOrUpdate.json + * @summary create or update the NGINX configuration for given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Configurations_CreateOrUpdate.json */ async function configurationsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.beginCreateOrUpdateAndWait( - resourceGroupName, - deploymentName, - configurationName, + const result = await client.configurations.createOrUpdate( + "myResourceGroup", + "myDeployment", + "default", ); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsDeleteSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsDeleteSample.ts index d05f0539fe9b..6f4029df85db 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsDeleteSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsDeleteSample.ts @@ -1,37 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Reset the NGINX configuration of given NGINX deployment to default + * This sample demonstrates how to reset the NGINX configuration of given NGINX deployment to default * - * @summary Reset the NGINX configuration of given NGINX deployment to default - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Delete.json + * @summary reset the NGINX configuration of given NGINX deployment to default + * x-ms-original-file: 2025-03-01-preview/Configurations_Delete.json */ async function configurationsDelete(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.beginDeleteAndWait( - resourceGroupName, - deploymentName, - configurationName, - ); - console.log(result); + await client.configurations.delete("myResourceGroup", "myDeployment", "default"); } async function main(): Promise { diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsGetSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsGetSample.ts index 2c69a2c69b2d..b48bc856224c 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsGetSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsGetSample.ts @@ -1,36 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the NGINX configuration of given NGINX deployment + * This sample demonstrates how to get the NGINX configuration of given NGINX deployment * - * @summary Get the NGINX configuration of given NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_Get.json + * @summary get the NGINX configuration of given NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Configurations_Get.json */ async function configurationsGet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.configurations.get( - resourceGroupName, - deploymentName, - configurationName, - ); + const result = await client.configurations.get("myResourceGroup", "myDeployment", "default"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsListSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsListSample.ts index b9ee4fbbbc67..285785b6299e 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsListSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/configurationsListSample.ts @@ -1,37 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List the NGINX configuration of given NGINX deployment. + * This sample demonstrates how to list the NGINX configuration of given NGINX deployment. * - * @summary List the NGINX configuration of given NGINX deployment. - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Configurations_List.json + * @summary list the NGINX configuration of given NGINX deployment. + * x-ms-original-file: 2025-03-01-preview/Configurations_List.json */ async function configurationsList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.configurations.list( - resourceGroupName, - deploymentName, - )) { + for await (const item of client.configurations.list("myResourceGroup", "myDeployment")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/defaultWafPolicyListSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/defaultWafPolicyListSample.ts new file mode 100644 index 000000000000..cc3de3cb0c31 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/defaultWafPolicyListSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the Nginx Waf Policy of given Nginx deployment + * + * @summary get the Nginx Waf Policy of given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/DefaultWafPolicy_List.json + */ +async function defaultWafPolicyList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const result = await client.defaultWafPolicy.list("myResourceGroup", "myDeployment"); + console.log(result); +} + +async function main(): Promise { + await defaultWafPolicyList(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsCreateOrUpdateSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsCreateOrUpdateSample.ts index f1866ae6ebbb..0958a948ad2e 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsCreateOrUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsCreateOrUpdateSample.ts @@ -1,34 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create or update the NGINX deployment + * This sample demonstrates how to create or update the NGINX deployment * - * @summary Create or update the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Create.json + * @summary create or update the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Create.json */ async function deploymentsCreate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginCreateOrUpdateAndWait( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.createOrUpdate("myResourceGroup", "myDeployment"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsDeleteSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsDeleteSample.ts index 8dd1f7b4830e..82c05781d784 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsDeleteSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsDeleteSample.ts @@ -1,35 +1,20 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete the NGINX deployment resource + * This sample demonstrates how to delete the NGINX deployment resource * - * @summary Delete the NGINX deployment resource - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Delete.json + * @summary delete the NGINX deployment resource + * x-ms-original-file: 2025-03-01-preview/Deployments_Delete.json */ async function deploymentsDelete(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginDeleteAndWait( - resourceGroupName, - deploymentName, - ); - console.log(result); + await client.deployments.delete("myResourceGroup", "myDeployment"); } async function main(): Promise { diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsGetSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsGetSample.ts index 02f086d4fcc5..efa2c8aaf9c5 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsGetSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsGetSample.ts @@ -1,56 +1,34 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get the NGINX deployment + * This sample demonstrates how to get the NGINX deployment * - * @summary Get the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get.json + * @summary get the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Get.json */ async function deploymentsGet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.get( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.get("myResourceGroup", "myDeployment"); console.log(result); } /** - * This sample demonstrates how to Get the NGINX deployment + * This sample demonstrates how to get the NGINX deployment * - * @summary Get the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Get_AutoScale.json + * @summary get the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Get_AutoScale.json */ async function deploymentsGetAutoScale(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.get( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.get("myResourceGroup", "myDeployment"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsListByResourceGroupSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsListByResourceGroupSample.ts index 731f9fb381c5..e862a24e66cb 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsListByResourceGroupSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsListByResourceGroupSample.ts @@ -1,35 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List all NGINX deployments under the specified resource group. + * This sample demonstrates how to list all NGINX deployments under the specified resource group. * - * @summary List all NGINX deployments under the specified resource group. - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_ListByResourceGroup.json + * @summary list all NGINX deployments under the specified resource group. + * x-ms-original-file: 2025-03-01-preview/Deployments_ListByResourceGroup.json */ async function deploymentsListByResourceGroup(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.deployments.listByResourceGroup( - resourceGroupName, - )) { + for await (const item of client.deployments.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsListSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsListSample.ts index 176fd4e0c97b..b77da15b2136 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsListSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsListSample.ts @@ -1,31 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List the NGINX deployments resources + * This sample demonstrates how to list the NGINX deployments resources * - * @summary List the NGINX deployments resources - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_List.json + * @summary list the NGINX deployments resources + * x-ms-original-file: 2025-03-01-preview/Deployments_List.json */ async function deploymentsList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.deployments.list()) { + for await (const item of client.deployments.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsUpdateSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsUpdateSample.ts index 637482c639b2..52f1ac5db796 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsUpdateSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/deploymentsUpdateSample.ts @@ -1,56 +1,34 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. import { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Update the NGINX deployment + * This sample demonstrates how to update the NGINX deployment * - * @summary Update the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_Update.json + * @summary update the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_Update.json */ async function deploymentsUpdate(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginUpdateAndWait( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.update("myResourceGroup", "myDeployment"); console.log(result); } /** - * This sample demonstrates how to Update the NGINX deployment + * This sample demonstrates how to update the NGINX deployment * - * @summary Update the NGINX deployment - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Deployments_UpdateSubnet.json + * @summary update the NGINX deployment + * x-ms-original-file: 2025-03-01-preview/Deployments_UpdateSubnet.json */ async function deploymentsUpdateSubnet(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["NGINX_RESOURCE_GROUP"] || "myResourceGroup"; - const deploymentName = "myDeployment"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); - const result = await client.deployments.beginUpdateAndWait( - resourceGroupName, - deploymentName, - ); + const result = await client.deployments.update("myResourceGroup", "myDeployment"); console.log(result); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/operationsListSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/operationsListSample.ts index 15c1a3bc4c11..ce0fb78b913f 100644 --- a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/operationsListSample.ts +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/operationsListSample.ts @@ -1,31 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { NginxManagementClient } from "@azure/arm-nginx"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. + * This sample demonstrates how to list the operations for the provider * - * @summary List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. - * x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-11-01-preview/examples/Operations_List.json + * @summary list the operations for the provider + * x-ms-original-file: 2025-03-01-preview/Operations_List.json */ async function operationsList(): Promise { - const subscriptionId = - process.env["NGINX_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.operations.list()) { + for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyCreateSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyCreateSample.ts new file mode 100644 index 000000000000..f5d57ceb6c33 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyCreateSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create or update the Nginx Waf Policy for given Nginx deployment + * + * @summary create or update the Nginx Waf Policy for given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/WafPolicy_Create.json + */ +async function wafPolicyCreate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const result = await client.wafPolicy.create("myResourceGroup", "myDeployment", "myWafPolicy"); + console.log(result); +} + +async function main(): Promise { + await wafPolicyCreate(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyDeleteSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyDeleteSample.ts new file mode 100644 index 000000000000..721ee9b2a3d5 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to reset the Nginx Waf Policy of given Nginx deployment to default + * + * @summary reset the Nginx Waf Policy of given Nginx deployment to default + * x-ms-original-file: 2025-03-01-preview/WafPolicy_Delete.json + */ +async function wafPolicyDelete(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + await client.wafPolicy.delete("myResourceGroup", "myDeployment", "myWafPolicy"); +} + +async function main(): Promise { + await wafPolicyDelete(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyGetSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyGetSample.ts new file mode 100644 index 000000000000..218a7bce8da3 --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the Nginx Waf Policy of given Nginx deployment + * + * @summary get the Nginx Waf Policy of given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/WafPolicy_Get.json + */ +async function wafPolicyGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const result = await client.wafPolicy.get("myResourceGroup", "myDeployment", "myWafPolicy"); + console.log(result); +} + +async function main(): Promise { + await wafPolicyGet(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyListSample.ts b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyListSample.ts new file mode 100644 index 000000000000..e8cc2407088c --- /dev/null +++ b/sdk/nginx/arm-nginx/samples/v4-beta/typescript/src/wafPolicyListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { NginxManagementClient } from "@azure/arm-nginx"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list Waf Policies of given Nginx deployment + * + * @summary list Waf Policies of given Nginx deployment + * x-ms-original-file: 2025-03-01-preview/WafPolicy_List.json + */ +async function wafPolicyList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new NginxManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.wafPolicy.list("myResourceGroup", "myDeployment")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await wafPolicyList(); +} + +main().catch(console.error); diff --git a/sdk/nginx/arm-nginx/src/api/apiKeys/index.ts b/sdk/nginx/arm-nginx/src/api/apiKeys/index.ts new file mode 100644 index 000000000000..c1981e21dda4 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/apiKeys/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, $delete, createOrUpdate, get } from "./operations.js"; +export { + ApiKeysListOptionalParams, + ApiKeysDeleteOptionalParams, + ApiKeysCreateOrUpdateOptionalParams, + ApiKeysGetOptionalParams, +} from "./options.js"; diff --git a/sdk/nginx/arm-nginx/src/api/apiKeys/operations.ts b/sdk/nginx/arm-nginx/src/api/apiKeys/operations.ts new file mode 100644 index 000000000000..1e6c8fc39fb3 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/apiKeys/operations.ts @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext as Client } from "../index.js"; +import type { + NginxDeploymentApiKeyResponse, + _NginxDeploymentApiKeyListResponse, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + nginxDeploymentApiKeyResponseDeserializer, + nginxDeploymentApiKeyRequestSerializer, + _nginxDeploymentApiKeyListResponseDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + ApiKeysListOptionalParams, + ApiKeysDeleteOptionalParams, + ApiKeysCreateOrUpdateOptionalParams, + ApiKeysGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: ApiKeysListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_NginxDeploymentApiKeyListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _nginxDeploymentApiKeyListResponseDeserializer(result.body); +} + +/** List all API Keys of the given Nginx deployment */ +export function list( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: ApiKeysListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, resourceGroupName, deploymentName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options: ApiKeysDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + apiKeyName: apiKeyName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete API key for Nginx deployment */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( + context: Client, + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options: ApiKeysDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend( + context, + resourceGroupName, + deploymentName, + apiKeyName, + options, + ); + return _$deleteDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options: ApiKeysCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + apiKeyName: apiKeyName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: !options["body"] + ? options["body"] + : nginxDeploymentApiKeyRequestSerializer(options["body"]), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxDeploymentApiKeyResponseDeserializer(result.body); +} + +/** Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint */ +export async function createOrUpdate( + context: Client, + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options: ApiKeysCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend( + context, + resourceGroupName, + deploymentName, + apiKeyName, + options, + ); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options: ApiKeysGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + apiKeyName: apiKeyName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxDeploymentApiKeyResponseDeserializer(result.body); +} + +/** Get the specified API Key of the given Nginx deployment */ +export async function get( + context: Client, + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options: ApiKeysGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, deploymentName, apiKeyName, options); + return _getDeserialize(result); +} diff --git a/sdk/nginx/arm-nginx/src/api/apiKeys/options.ts b/sdk/nginx/arm-nginx/src/api/apiKeys/options.ts new file mode 100644 index 000000000000..bda003978e99 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/apiKeys/options.ts @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxDeploymentApiKeyRequest } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ApiKeysListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ApiKeysDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ApiKeysCreateOrUpdateOptionalParams extends OperationOptions { + /** The API Key object containing fields (e.g. secret text, expiration date) to upsert the key. */ + body?: NginxDeploymentApiKeyRequest; +} + +/** Optional parameters. */ +export interface ApiKeysGetOptionalParams extends OperationOptions {} diff --git a/sdk/nginx/arm-nginx/src/api/certificates/index.ts b/sdk/nginx/arm-nginx/src/api/certificates/index.ts new file mode 100644 index 000000000000..fc86fc5328df --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/certificates/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, $delete, createOrUpdate, get } from "./operations.js"; +export { + CertificatesListOptionalParams, + CertificatesDeleteOptionalParams, + CertificatesCreateOrUpdateOptionalParams, + CertificatesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/nginx/arm-nginx/src/api/certificates/operations.ts b/sdk/nginx/arm-nginx/src/api/certificates/operations.ts new file mode 100644 index 000000000000..35a38d3d52e7 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/certificates/operations.ts @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext as Client } from "../index.js"; +import type { NginxCertificate, _NginxCertificateListResponse } from "../../models/models.js"; +import { + errorResponseDeserializer, + nginxCertificateSerializer, + nginxCertificateDeserializer, + _nginxCertificateListResponseDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + CertificatesListOptionalParams, + CertificatesDeleteOptionalParams, + CertificatesCreateOrUpdateOptionalParams, + CertificatesGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: CertificatesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_NginxCertificateListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _nginxCertificateListResponseDeserializer(result.body); +} + +/** List all certificates of given NGINX deployment */ +export function list( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: CertificatesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, resourceGroupName, deploymentName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options: CertificatesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + certificateName: certificateName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Deletes a certificate from the NGINX deployment */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options: CertificatesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, deploymentName, certificateName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }) as PollerLike, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options: CertificatesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + certificateName: certificateName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: !options["body"] ? options["body"] : nginxCertificateSerializer(options["body"]), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxCertificateDeserializer(result.body); +} + +/** Create or update the NGINX certificates for given NGINX deployment */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options: CertificatesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, NginxCertificate> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, deploymentName, certificateName, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }) as PollerLike, NginxCertificate>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options: CertificatesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + certificateName: certificateName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxCertificateDeserializer(result.body); +} + +/** Get a certificate of given NGINX deployment */ +export async function get( + context: Client, + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options: CertificatesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + deploymentName, + certificateName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/nginx/arm-nginx/src/api/certificates/options.ts b/sdk/nginx/arm-nginx/src/api/certificates/options.ts new file mode 100644 index 000000000000..5d4f5cde3366 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/certificates/options.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxCertificate } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CertificatesListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CertificatesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface CertificatesCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The certificate */ + body?: NginxCertificate; +} + +/** Optional parameters. */ +export interface CertificatesGetOptionalParams extends OperationOptions {} diff --git a/sdk/nginx/arm-nginx/src/api/configurations/index.ts b/sdk/nginx/arm-nginx/src/api/configurations/index.ts new file mode 100644 index 000000000000..1f5dc1a3f208 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/configurations/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { analysis, list, $delete, createOrUpdate, get } from "./operations.js"; +export { + ConfigurationsAnalysisOptionalParams, + ConfigurationsListOptionalParams, + ConfigurationsDeleteOptionalParams, + ConfigurationsCreateOrUpdateOptionalParams, + ConfigurationsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/nginx/arm-nginx/src/api/configurations/operations.ts b/sdk/nginx/arm-nginx/src/api/configurations/operations.ts new file mode 100644 index 000000000000..90b7f7e15e21 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/configurations/operations.ts @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext as Client } from "../index.js"; +import type { + NginxConfiguration, + _NginxConfigurationListResponse, + AnalysisResult, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + nginxConfigurationDeserializer, + nginxConfigurationRequestSerializer, + _nginxConfigurationListResponseDeserializer, + analysisCreateSerializer, + analysisResultDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + ConfigurationsAnalysisOptionalParams, + ConfigurationsListOptionalParams, + ConfigurationsDeleteOptionalParams, + ConfigurationsCreateOrUpdateOptionalParams, + ConfigurationsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _analysisSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options: ConfigurationsAnalysisOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: !options["body"] ? options["body"] : analysisCreateSerializer(options["body"]), + }); +} + +export async function _analysisDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return analysisResultDeserializer(result.body); +} + +/** Analyze an NGINX configuration without applying it to the NGINXaaS deployment */ +export async function analysis( + context: Client, + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options: ConfigurationsAnalysisOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _analysisSend( + context, + resourceGroupName, + deploymentName, + configurationName, + options, + ); + return _analysisDeserialize(result); +} + +export function _listSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: ConfigurationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_NginxConfigurationListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _nginxConfigurationListResponseDeserializer(result.body); +} + +/** List the NGINX configuration of given NGINX deployment. */ +export function list( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: ConfigurationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, resourceGroupName, deploymentName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options: ConfigurationsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Reset the NGINX configuration of given NGINX deployment to default */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options: ConfigurationsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, deploymentName, configurationName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }) as PollerLike, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options: ConfigurationsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: !options["body"] ? options["body"] : nginxConfigurationRequestSerializer(options["body"]), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxConfigurationDeserializer(result.body); +} + +/** Create or update the NGINX configuration for given NGINX deployment */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options: ConfigurationsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, NginxConfiguration> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, deploymentName, configurationName, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }) as PollerLike, NginxConfiguration>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options: ConfigurationsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxConfigurationDeserializer(result.body); +} + +/** Get the NGINX configuration of given NGINX deployment */ +export async function get( + context: Client, + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options: ConfigurationsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + deploymentName, + configurationName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/nginx/arm-nginx/src/api/configurations/options.ts b/sdk/nginx/arm-nginx/src/api/configurations/options.ts new file mode 100644 index 000000000000..71da0a74334b --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/configurations/options.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxConfigurationRequest, AnalysisCreate } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ConfigurationsAnalysisOptionalParams extends OperationOptions { + /** The NGINX configuration to analyze */ + body?: AnalysisCreate; +} + +/** Optional parameters. */ +export interface ConfigurationsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ConfigurationsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ConfigurationsCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The NGINX configuration */ + body?: NginxConfigurationRequest; +} + +/** Optional parameters. */ +export interface ConfigurationsGetOptionalParams extends OperationOptions {} diff --git a/sdk/nginx/arm-nginx/src/api/defaultWafPolicy/index.ts b/sdk/nginx/arm-nginx/src/api/defaultWafPolicy/index.ts new file mode 100644 index 000000000000..ef37d2981f23 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/defaultWafPolicy/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export { DefaultWafPolicyListOptionalParams } from "./options.js"; diff --git a/sdk/nginx/arm-nginx/src/api/defaultWafPolicy/operations.ts b/sdk/nginx/arm-nginx/src/api/defaultWafPolicy/operations.ts new file mode 100644 index 000000000000..a89c6b69cff4 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/defaultWafPolicy/operations.ts @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext as Client } from "../index.js"; +import type { NginxDeploymentDefaultWafPolicyListResponse } from "../../models/models.js"; +import { + errorResponseDeserializer, + nginxDeploymentDefaultWafPolicyListResponseDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { DefaultWafPolicyListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DefaultWafPolicyListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/listDefaultWafPolicies{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxDeploymentDefaultWafPolicyListResponseDeserializer(result.body); +} + +/** Get the Nginx Waf Policy of given Nginx deployment */ +export async function list( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DefaultWafPolicyListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, resourceGroupName, deploymentName, options); + return _listDeserialize(result); +} diff --git a/sdk/nginx/arm-nginx/src/api/defaultWafPolicy/options.ts b/sdk/nginx/arm-nginx/src/api/defaultWafPolicy/options.ts new file mode 100644 index 000000000000..8f7682afdc26 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/defaultWafPolicy/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DefaultWafPolicyListOptionalParams extends OperationOptions {} diff --git a/sdk/nginx/arm-nginx/src/api/deployments/index.ts b/sdk/nginx/arm-nginx/src/api/deployments/index.ts new file mode 100644 index 000000000000..cb7fe58e7e51 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/deployments/index.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, listByResourceGroup, $delete, update, createOrUpdate, get } from "./operations.js"; +export { + DeploymentsListOptionalParams, + DeploymentsListByResourceGroupOptionalParams, + DeploymentsDeleteOptionalParams, + DeploymentsUpdateOptionalParams, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/nginx/arm-nginx/src/api/deployments/operations.ts b/sdk/nginx/arm-nginx/src/api/deployments/operations.ts new file mode 100644 index 000000000000..bf5e010560a1 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/deployments/operations.ts @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext as Client } from "../index.js"; +import type { NginxDeployment, _NginxDeploymentListResponse } from "../../models/models.js"; +import { + errorResponseDeserializer, + nginxDeploymentSerializer, + nginxDeploymentDeserializer, + nginxDeploymentUpdateParametersSerializer, + _nginxDeploymentListResponseDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + DeploymentsListOptionalParams, + DeploymentsListByResourceGroupOptionalParams, + DeploymentsDeleteOptionalParams, + DeploymentsUpdateOptionalParams, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listSend( + context: Client, + options: DeploymentsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_NginxDeploymentListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _nginxDeploymentListResponseDeserializer(result.body); +} + +/** List the NGINX deployments resources */ +export function list( + context: Client, + options: DeploymentsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: DeploymentsListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_NginxDeploymentListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _nginxDeploymentListResponseDeserializer(result.body); +} + +/** List all NGINX deployments under the specified resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: DeploymentsListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DeploymentsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete the NGINX deployment resource */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DeploymentsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _$deleteSend(context, resourceGroupName, deploymentName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DeploymentsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: !options["body"] + ? options["body"] + : nginxDeploymentUpdateParametersSerializer(options["body"]), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxDeploymentDeserializer(result.body); +} + +/** Update the NGINX deployment */ +export function update( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DeploymentsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, NginxDeployment> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _updateSend(context, resourceGroupName, deploymentName, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }) as PollerLike, NginxDeployment>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DeploymentsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: !options["body"] ? options["body"] : nginxDeploymentSerializer(options["body"]), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxDeploymentDeserializer(result.body); +} + +/** Create or update the NGINX deployment */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DeploymentsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, NginxDeployment> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, deploymentName, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }) as PollerLike, NginxDeployment>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DeploymentsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxDeploymentDeserializer(result.body); +} + +/** Get the NGINX deployment */ +export async function get( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: DeploymentsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, deploymentName, options); + return _getDeserialize(result); +} diff --git a/sdk/nginx/arm-nginx/src/api/deployments/options.ts b/sdk/nginx/arm-nginx/src/api/deployments/options.ts new file mode 100644 index 000000000000..fe68de135c03 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/deployments/options.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxDeployment, NginxDeploymentUpdateParameters } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DeploymentsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DeploymentsListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DeploymentsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DeploymentsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The Nginx deployment update parameters */ + body?: NginxDeploymentUpdateParameters; +} + +/** Optional parameters. */ +export interface DeploymentsCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** The Nginx deployment */ + body?: NginxDeployment; +} + +/** Optional parameters. */ +export interface DeploymentsGetOptionalParams extends OperationOptions {} diff --git a/sdk/nginx/arm-nginx/src/api/index.ts b/sdk/nginx/arm-nginx/src/api/index.ts new file mode 100644 index 000000000000..6f32d5e7f7ec --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createNginxManagement, + NginxManagementContext, + NginxManagementClientOptionalParams, +} from "./nginxManagementContext.js"; diff --git a/sdk/nginx/arm-nginx/src/api/nginxManagementContext.ts b/sdk/nginx/arm-nginx/src/api/nginxManagementContext.ts new file mode 100644 index 000000000000..46fdab534fc8 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/nginxManagementContext.ts @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import type { AzureSupportedClouds } from "../static-helpers/cloudSettingHelpers.js"; +import { getArmEndpoint } from "../static-helpers/cloudSettingHelpers.js"; +import type { Client, ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import type { TokenCredential } from "@azure/core-auth"; + +export interface NginxManagementContext extends Client { + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Optional parameters for the client. */ +export interface NginxManagementClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; + /** Specifies the Azure cloud environment for the client. */ + cloudSetting?: AzureSupportedClouds; +} + +export function createNginxManagement( + credential: TokenCredential, + subscriptionId: string, + options: NginxManagementClientOptionalParams = {}, +): NginxManagementContext { + const endpointUrl = + options.endpoint ?? getArmEndpoint(options.cloudSetting) ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-nginx/1.0.0-beta.1`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`] }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + const apiVersion = options.apiVersion; + return { ...clientContext, apiVersion, subscriptionId } as NginxManagementContext; +} diff --git a/sdk/nginx/arm-nginx/src/api/operations/index.ts b/sdk/nginx/arm-nginx/src/api/operations/index.ts new file mode 100644 index 000000000000..24a804d14fcf --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/operations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/nginx/arm-nginx/src/api/operations/operations.ts b/sdk/nginx/arm-nginx/src/api/operations/operations.ts new file mode 100644 index 000000000000..de86c811e827 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/operations/operations.ts @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext as Client } from "../index.js"; +import type { _OperationListResult, Operation } from "../../models/models.js"; +import { + _operationListResultDeserializer, + errorResponseDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { OperationsListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Nginx.NginxPlus/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }, + ); +} diff --git a/sdk/nginx/arm-nginx/src/api/operations/options.ts b/sdk/nginx/arm-nginx/src/api/operations/options.ts new file mode 100644 index 000000000000..b9a3fd9758a3 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/operations/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/nginx/arm-nginx/src/api/wafPolicy/index.ts b/sdk/nginx/arm-nginx/src/api/wafPolicy/index.ts new file mode 100644 index 000000000000..50b52b99d6cd --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/wafPolicy/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { $delete, create, get, list } from "./operations.js"; +export { + WafPolicyDeleteOptionalParams, + WafPolicyCreateOptionalParams, + WafPolicyGetOptionalParams, + WafPolicyListOptionalParams, +} from "./options.js"; diff --git a/sdk/nginx/arm-nginx/src/api/wafPolicy/operations.ts b/sdk/nginx/arm-nginx/src/api/wafPolicy/operations.ts new file mode 100644 index 000000000000..a5c9a8c82496 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/wafPolicy/operations.ts @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext as Client } from "../index.js"; +import type { + _NginxDeploymentWafPolicyListResponse, + NginxDeploymentWafPolicyMetadata, + NginxDeploymentWafPolicy, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + _nginxDeploymentWafPolicyListResponseDeserializer, + nginxDeploymentWafPolicySerializer, + nginxDeploymentWafPolicyDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + WafPolicyDeleteOptionalParams, + WafPolicyCreateOptionalParams, + WafPolicyGetOptionalParams, + WafPolicyListOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options: WafPolicyDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + wafPolicyName: wafPolicyName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Reset the Nginx Waf Policy of given Nginx deployment to default */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options: WafPolicyDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, deploymentName, wafPolicyName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }) as PollerLike, void>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options: WafPolicyCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + wafPolicyName: wafPolicyName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: !options["body"] ? options["body"] : nginxDeploymentWafPolicySerializer(options["body"]), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxDeploymentWafPolicyDeserializer(result.body); +} + +/** Create or update the Nginx Waf Policy for given Nginx deployment */ +export function create( + context: Client, + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options: WafPolicyCreateOptionalParams = { requestOptions: {} }, +): PollerLike, NginxDeploymentWafPolicy> { + return getLongRunningPoller(context, _createDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend(context, resourceGroupName, deploymentName, wafPolicyName, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }) as PollerLike, NginxDeploymentWafPolicy>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options: WafPolicyGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + wafPolicyName: wafPolicyName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return nginxDeploymentWafPolicyDeserializer(result.body); +} + +/** Get the Nginx Waf Policy of given Nginx deployment */ +export async function get( + context: Client, + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options: WafPolicyGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, deploymentName, wafPolicyName, options); + return _getDeserialize(result); +} + +export function _listSend( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: WafPolicyListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion ?? "2025-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_NginxDeploymentWafPolicyListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _nginxDeploymentWafPolicyListResponseDeserializer(result.body); +} + +/** List Waf Policies of given Nginx deployment */ +export function list( + context: Client, + resourceGroupName: string, + deploymentName: string, + options: WafPolicyListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, resourceGroupName, deploymentName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2025-03-01-preview", + }, + ); +} diff --git a/sdk/nginx/arm-nginx/src/api/wafPolicy/options.ts b/sdk/nginx/arm-nginx/src/api/wafPolicy/options.ts new file mode 100644 index 000000000000..a77bc4f3af4b --- /dev/null +++ b/sdk/nginx/arm-nginx/src/api/wafPolicy/options.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxDeploymentWafPolicy } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface WafPolicyDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface WafPolicyCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** Resource create parameters. */ + body?: NginxDeploymentWafPolicy; +} + +/** Optional parameters. */ +export interface WafPolicyGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface WafPolicyListOptionalParams extends OperationOptions {} diff --git a/sdk/nginx/arm-nginx/src/classic/apiKeys/index.ts b/sdk/nginx/arm-nginx/src/classic/apiKeys/index.ts new file mode 100644 index 000000000000..9430a7e84df1 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/classic/apiKeys/index.ts @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext } from "../../api/nginxManagementContext.js"; +import { list, $delete, createOrUpdate, get } from "../../api/apiKeys/operations.js"; +import type { + ApiKeysListOptionalParams, + ApiKeysDeleteOptionalParams, + ApiKeysCreateOrUpdateOptionalParams, + ApiKeysGetOptionalParams, +} from "../../api/apiKeys/options.js"; +import type { NginxDeploymentApiKeyResponse } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a ApiKeys operations. */ +export interface ApiKeysOperations { + /** List all API Keys of the given Nginx deployment */ + list: ( + resourceGroupName: string, + deploymentName: string, + options?: ApiKeysListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete API key for Nginx deployment */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options?: ApiKeysDeleteOptionalParams, + ) => Promise; + /** Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint */ + createOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options?: ApiKeysCreateOrUpdateOptionalParams, + ) => Promise; + /** Get the specified API Key of the given Nginx deployment */ + get: ( + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options?: ApiKeysGetOptionalParams, + ) => Promise; +} + +function _getApiKeys(context: NginxManagementContext) { + return { + list: ( + resourceGroupName: string, + deploymentName: string, + options?: ApiKeysListOptionalParams, + ) => list(context, resourceGroupName, deploymentName, options), + delete: ( + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options?: ApiKeysDeleteOptionalParams, + ) => $delete(context, resourceGroupName, deploymentName, apiKeyName, options), + createOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options?: ApiKeysCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, deploymentName, apiKeyName, options), + get: ( + resourceGroupName: string, + deploymentName: string, + apiKeyName: string, + options?: ApiKeysGetOptionalParams, + ) => get(context, resourceGroupName, deploymentName, apiKeyName, options), + }; +} + +export function _getApiKeysOperations(context: NginxManagementContext): ApiKeysOperations { + return { + ..._getApiKeys(context), + }; +} diff --git a/sdk/nginx/arm-nginx/src/classic/certificates/index.ts b/sdk/nginx/arm-nginx/src/classic/certificates/index.ts new file mode 100644 index 000000000000..8298c34de594 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/classic/certificates/index.ts @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext } from "../../api/nginxManagementContext.js"; +import { list, $delete, createOrUpdate, get } from "../../api/certificates/operations.js"; +import type { + CertificatesListOptionalParams, + CertificatesDeleteOptionalParams, + CertificatesCreateOrUpdateOptionalParams, + CertificatesGetOptionalParams, +} from "../../api/certificates/options.js"; +import type { NginxCertificate } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Certificates operations. */ +export interface CertificatesOperations { + /** List all certificates of given NGINX deployment */ + list: ( + resourceGroupName: string, + deploymentName: string, + options?: CertificatesListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes a certificate from the NGINX deployment */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesDeleteOptionalParams, + ) => Promise; + /** Create or update the NGINX certificates for given NGINX deployment */ + createOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesCreateOrUpdateOptionalParams, + ) => PollerLike, NginxCertificate>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesCreateOrUpdateOptionalParams, + ) => Promise, NginxCertificate>>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesCreateOrUpdateOptionalParams, + ) => Promise; + /** Get a certificate of given NGINX deployment */ + get: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesGetOptionalParams, + ) => Promise; +} + +function _getCertificates(context: NginxManagementContext) { + return { + list: ( + resourceGroupName: string, + deploymentName: string, + options?: CertificatesListOptionalParams, + ) => list(context, resourceGroupName, deploymentName, options), + delete: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesDeleteOptionalParams, + ) => $delete(context, resourceGroupName, deploymentName, certificateName, options), + beginDelete: async ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, deploymentName, certificateName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, deploymentName, certificateName, options); + }, + createOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, deploymentName, certificateName, options), + beginCreateOrUpdate: async ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + deploymentName, + certificateName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + deploymentName, + certificateName, + options, + ); + }, + get: ( + resourceGroupName: string, + deploymentName: string, + certificateName: string, + options?: CertificatesGetOptionalParams, + ) => get(context, resourceGroupName, deploymentName, certificateName, options), + }; +} + +export function _getCertificatesOperations( + context: NginxManagementContext, +): CertificatesOperations { + return { + ..._getCertificates(context), + }; +} diff --git a/sdk/nginx/arm-nginx/src/classic/configurations/index.ts b/sdk/nginx/arm-nginx/src/classic/configurations/index.ts new file mode 100644 index 000000000000..471d4a48d576 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/classic/configurations/index.ts @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext } from "../../api/nginxManagementContext.js"; +import { + analysis, + list, + $delete, + createOrUpdate, + get, +} from "../../api/configurations/operations.js"; +import type { + ConfigurationsAnalysisOptionalParams, + ConfigurationsListOptionalParams, + ConfigurationsDeleteOptionalParams, + ConfigurationsCreateOrUpdateOptionalParams, + ConfigurationsGetOptionalParams, +} from "../../api/configurations/options.js"; +import type { NginxConfiguration, AnalysisResult } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Configurations operations. */ +export interface ConfigurationsOperations { + /** Analyze an NGINX configuration without applying it to the NGINXaaS deployment */ + analysis: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsAnalysisOptionalParams, + ) => Promise; + /** List the NGINX configuration of given NGINX deployment. */ + list: ( + resourceGroupName: string, + deploymentName: string, + options?: ConfigurationsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Reset the NGINX configuration of given NGINX deployment to default */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsDeleteOptionalParams, + ) => Promise; + /** Create or update the NGINX configuration for given NGINX deployment */ + createOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsCreateOrUpdateOptionalParams, + ) => PollerLike, NginxConfiguration>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsCreateOrUpdateOptionalParams, + ) => Promise, NginxConfiguration>>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsCreateOrUpdateOptionalParams, + ) => Promise; + /** Get the NGINX configuration of given NGINX deployment */ + get: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsGetOptionalParams, + ) => Promise; +} + +function _getConfigurations(context: NginxManagementContext) { + return { + analysis: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsAnalysisOptionalParams, + ) => analysis(context, resourceGroupName, deploymentName, configurationName, options), + list: ( + resourceGroupName: string, + deploymentName: string, + options?: ConfigurationsListOptionalParams, + ) => list(context, resourceGroupName, deploymentName, options), + delete: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, deploymentName, configurationName, options), + beginDelete: async ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsDeleteOptionalParams, + ) => { + const poller = $delete( + context, + resourceGroupName, + deploymentName, + configurationName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, deploymentName, configurationName, options); + }, + createOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, deploymentName, configurationName, options), + beginCreateOrUpdate: async ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + deploymentName, + configurationName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + deploymentName, + configurationName, + options, + ); + }, + get: ( + resourceGroupName: string, + deploymentName: string, + configurationName: string, + options?: ConfigurationsGetOptionalParams, + ) => get(context, resourceGroupName, deploymentName, configurationName, options), + }; +} + +export function _getConfigurationsOperations( + context: NginxManagementContext, +): ConfigurationsOperations { + return { + ..._getConfigurations(context), + }; +} diff --git a/sdk/nginx/arm-nginx/src/classic/defaultWafPolicy/index.ts b/sdk/nginx/arm-nginx/src/classic/defaultWafPolicy/index.ts new file mode 100644 index 000000000000..29b04ad55577 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/classic/defaultWafPolicy/index.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext } from "../../api/nginxManagementContext.js"; +import { list } from "../../api/defaultWafPolicy/operations.js"; +import type { DefaultWafPolicyListOptionalParams } from "../../api/defaultWafPolicy/options.js"; +import type { NginxDeploymentDefaultWafPolicyListResponse } from "../../models/models.js"; + +/** Interface representing a DefaultWafPolicy operations. */ +export interface DefaultWafPolicyOperations { + /** Get the Nginx Waf Policy of given Nginx deployment */ + list: ( + resourceGroupName: string, + deploymentName: string, + options?: DefaultWafPolicyListOptionalParams, + ) => Promise; +} + +function _getDefaultWafPolicy(context: NginxManagementContext) { + return { + list: ( + resourceGroupName: string, + deploymentName: string, + options?: DefaultWafPolicyListOptionalParams, + ) => list(context, resourceGroupName, deploymentName, options), + }; +} + +export function _getDefaultWafPolicyOperations( + context: NginxManagementContext, +): DefaultWafPolicyOperations { + return { + ..._getDefaultWafPolicy(context), + }; +} diff --git a/sdk/nginx/arm-nginx/src/classic/deployments/index.ts b/sdk/nginx/arm-nginx/src/classic/deployments/index.ts new file mode 100644 index 000000000000..f58ea82744c1 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/classic/deployments/index.ts @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext } from "../../api/nginxManagementContext.js"; +import { + list, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/deployments/operations.js"; +import type { + DeploymentsListOptionalParams, + DeploymentsListByResourceGroupOptionalParams, + DeploymentsDeleteOptionalParams, + DeploymentsUpdateOptionalParams, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsGetOptionalParams, +} from "../../api/deployments/options.js"; +import type { NginxDeployment } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Deployments operations. */ +export interface DeploymentsOperations { + /** List the NGINX deployments resources */ + list: (options?: DeploymentsListOptionalParams) => PagedAsyncIterableIterator; + /** List all NGINX deployments under the specified resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: DeploymentsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete the NGINX deployment resource */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams, + ) => Promise; + /** Update the NGINX deployment */ + update: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsUpdateOptionalParams, + ) => PollerLike, NginxDeployment>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsUpdateOptionalParams, + ) => Promise, NginxDeployment>>; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsUpdateOptionalParams, + ) => Promise; + /** Create or update the NGINX deployment */ + createOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsCreateOrUpdateOptionalParams, + ) => PollerLike, NginxDeployment>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsCreateOrUpdateOptionalParams, + ) => Promise, NginxDeployment>>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsCreateOrUpdateOptionalParams, + ) => Promise; + /** Get the NGINX deployment */ + get: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsGetOptionalParams, + ) => Promise; +} + +function _getDeployments(context: NginxManagementContext) { + return { + list: (options?: DeploymentsListOptionalParams) => list(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: DeploymentsListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, deploymentName, options), + beginDelete: async ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, deploymentName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, deploymentName, options); + }, + update: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsUpdateOptionalParams, + ) => update(context, resourceGroupName, deploymentName, options), + beginUpdate: async ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsUpdateOptionalParams, + ) => { + const poller = update(context, resourceGroupName, deploymentName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsUpdateOptionalParams, + ) => { + return await update(context, resourceGroupName, deploymentName, options); + }, + createOrUpdate: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, deploymentName, options), + beginCreateOrUpdate: async ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate(context, resourceGroupName, deploymentName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate(context, resourceGroupName, deploymentName, options); + }, + get: ( + resourceGroupName: string, + deploymentName: string, + options?: DeploymentsGetOptionalParams, + ) => get(context, resourceGroupName, deploymentName, options), + }; +} + +export function _getDeploymentsOperations(context: NginxManagementContext): DeploymentsOperations { + return { + ..._getDeployments(context), + }; +} diff --git a/sdk/nginx/arm-nginx/src/classic/index.ts b/sdk/nginx/arm-nginx/src/classic/index.ts new file mode 100644 index 000000000000..8747a6e70c3d --- /dev/null +++ b/sdk/nginx/arm-nginx/src/classic/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { ApiKeysOperations } from "./apiKeys/index.js"; +export { CertificatesOperations } from "./certificates/index.js"; +export { ConfigurationsOperations } from "./configurations/index.js"; +export { DefaultWafPolicyOperations } from "./defaultWafPolicy/index.js"; +export { DeploymentsOperations } from "./deployments/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { WafPolicyOperations } from "./wafPolicy/index.js"; diff --git a/sdk/nginx/arm-nginx/src/classic/operations/index.ts b/sdk/nginx/arm-nginx/src/classic/operations/index.ts new file mode 100644 index 000000000000..52199089d5bf --- /dev/null +++ b/sdk/nginx/arm-nginx/src/classic/operations/index.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext } from "../../api/nginxManagementContext.js"; +import { list } from "../../api/operations/operations.js"; +import type { OperationsListOptionalParams } from "../../api/operations/options.js"; +import type { Operation } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +function _getOperations(context: NginxManagementContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations(context: NginxManagementContext): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/nginx/arm-nginx/src/classic/wafPolicy/index.ts b/sdk/nginx/arm-nginx/src/classic/wafPolicy/index.ts new file mode 100644 index 000000000000..210806a5bff7 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/classic/wafPolicy/index.ts @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementContext } from "../../api/nginxManagementContext.js"; +import { $delete, create, get, list } from "../../api/wafPolicy/operations.js"; +import type { + WafPolicyDeleteOptionalParams, + WafPolicyCreateOptionalParams, + WafPolicyGetOptionalParams, + WafPolicyListOptionalParams, +} from "../../api/wafPolicy/options.js"; +import type { + NginxDeploymentWafPolicyMetadata, + NginxDeploymentWafPolicy, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a WafPolicy operations. */ +export interface WafPolicyOperations { + /** Reset the Nginx Waf Policy of given Nginx deployment to default */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyDeleteOptionalParams, + ) => Promise; + /** Create or update the Nginx Waf Policy for given Nginx deployment */ + create: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyCreateOptionalParams, + ) => PollerLike, NginxDeploymentWafPolicy>; + /** @deprecated use create instead */ + beginCreate: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyCreateOptionalParams, + ) => Promise< + SimplePollerLike, NginxDeploymentWafPolicy> + >; + /** @deprecated use create instead */ + beginCreateAndWait: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyCreateOptionalParams, + ) => Promise; + /** Get the Nginx Waf Policy of given Nginx deployment */ + get: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyGetOptionalParams, + ) => Promise; + /** List Waf Policies of given Nginx deployment */ + list: ( + resourceGroupName: string, + deploymentName: string, + options?: WafPolicyListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getWafPolicy(context: NginxManagementContext) { + return { + delete: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyDeleteOptionalParams, + ) => $delete(context, resourceGroupName, deploymentName, wafPolicyName, options), + beginDelete: async ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, deploymentName, wafPolicyName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, deploymentName, wafPolicyName, options); + }, + create: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyCreateOptionalParams, + ) => create(context, resourceGroupName, deploymentName, wafPolicyName, options), + beginCreate: async ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyCreateOptionalParams, + ) => { + const poller = create(context, resourceGroupName, deploymentName, wafPolicyName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateAndWait: async ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyCreateOptionalParams, + ) => { + return await create(context, resourceGroupName, deploymentName, wafPolicyName, options); + }, + get: ( + resourceGroupName: string, + deploymentName: string, + wafPolicyName: string, + options?: WafPolicyGetOptionalParams, + ) => get(context, resourceGroupName, deploymentName, wafPolicyName, options), + list: ( + resourceGroupName: string, + deploymentName: string, + options?: WafPolicyListOptionalParams, + ) => list(context, resourceGroupName, deploymentName, options), + }; +} + +export function _getWafPolicyOperations(context: NginxManagementContext): WafPolicyOperations { + return { + ..._getWafPolicy(context), + }; +} diff --git a/sdk/nginx/arm-nginx/src/index.ts b/sdk/nginx/arm-nginx/src/index.ts index 137abc23cf4a..f379d2453df9 100644 --- a/sdk/nginx/arm-nginx/src/index.ts +++ b/sdk/nginx/arm-nginx/src/index.ts @@ -1,13 +1,147 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code 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 { AzureClouds, AzureSupportedClouds } from "./static-helpers/cloudSettingHelpers.js"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; -/// -export { getContinuationToken } from "./pagingHelper.js"; -export * from "./models/index.js"; export { NginxManagementClient } from "./nginxManagementClient.js"; -export * from "./operationsInterfaces/index.js"; +export { SimplePollerLike } from "./static-helpers/simplePollerHelpers.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + NginxDeploymentApiKeyResponse, + NginxDeploymentApiKeyResponseProperties, + ProxyResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + NginxDeploymentApiKeyRequest, + NginxDeploymentApiKeyRequestProperties, + NginxDeployment, + NginxDeploymentProperties, + KnownProvisioningState, + ProvisioningState, + NginxNetworkProfile, + NginxFrontendIPConfiguration, + NginxPublicIPAddress, + NginxPrivateIPAddress, + KnownNginxPrivateIPAllocationMethod, + NginxPrivateIPAllocationMethod, + NginxNetworkInterfaceConfiguration, + NginxLogging, + NginxStorageAccount, + NginxDeploymentScalingProperties, + NginxDeploymentScalingPropertiesAutoScaleSettings, + ScaleProfile, + ScaleProfileCapacity, + AutoUpgradeProfile, + NginxDeploymentUserProfile, + NginxDeploymentPropertiesNginxAppProtect, + WebApplicationFirewallSettings, + KnownActivationState, + ActivationState, + WebApplicationFirewallStatus, + WebApplicationFirewallPackage, + WebApplicationFirewallComponentVersions, + IdentityProperties, + KnownIdentityType, + IdentityType, + UserIdentityProperties, + ResourceSku, + TrackedResource, + NginxDeploymentUpdateParameters, + NginxDeploymentUpdateProperties, + NginxDeploymentUpdatePropertiesNginxAppProtect, + NginxDeploymentWafPolicyMetadata, + NginxDeploymentWafPolicyMetadataProperties, + NginxDeploymentWafPolicyCompilingStatus, + KnownNginxDeploymentWafPolicyCompilingStatusCode, + NginxDeploymentWafPolicyCompilingStatusCode, + NginxDeploymentWafPolicyApplyingStatus, + KnownNginxDeploymentWafPolicyApplyingStatusCode, + NginxDeploymentWafPolicyApplyingStatusCode, + NginxDeploymentWafPolicy, + NginxDeploymentWafPolicyProperties, + NginxDeploymentDefaultWafPolicyListResponse, + NginxDeploymentDefaultWafPolicyProperties, + NginxCertificate, + NginxCertificateProperties, + NginxCertificateErrorResponseBody, + NginxConfiguration, + NginxConfigurationProperties, + NginxConfigurationFile, + NginxConfigurationProtectedFileResponse, + NginxConfigurationPackage, + NginxConfigurationRequest, + NginxConfigurationRequestProperties, + NginxConfigurationProtectedFileRequest, + AnalysisCreate, + AnalysisCreateConfig, + AnalysisResult, + AnalysisResultData, + AnalysisDiagnostic, + DiagnosticItem, + KnownLevel, + Level, + KnownVersions, +} from "./models/index.js"; +export { NginxManagementClientOptionalParams } from "./api/index.js"; +export { + ApiKeysListOptionalParams, + ApiKeysDeleteOptionalParams, + ApiKeysCreateOrUpdateOptionalParams, + ApiKeysGetOptionalParams, +} from "./api/apiKeys/index.js"; +export { + CertificatesListOptionalParams, + CertificatesDeleteOptionalParams, + CertificatesCreateOrUpdateOptionalParams, + CertificatesGetOptionalParams, +} from "./api/certificates/index.js"; +export { + ConfigurationsAnalysisOptionalParams, + ConfigurationsListOptionalParams, + ConfigurationsDeleteOptionalParams, + ConfigurationsCreateOrUpdateOptionalParams, + ConfigurationsGetOptionalParams, +} from "./api/configurations/index.js"; +export { DefaultWafPolicyListOptionalParams } from "./api/defaultWafPolicy/index.js"; +export { + DeploymentsListOptionalParams, + DeploymentsListByResourceGroupOptionalParams, + DeploymentsDeleteOptionalParams, + DeploymentsUpdateOptionalParams, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsGetOptionalParams, +} from "./api/deployments/index.js"; +export { OperationsListOptionalParams } from "./api/operations/index.js"; +export { + WafPolicyDeleteOptionalParams, + WafPolicyCreateOptionalParams, + WafPolicyGetOptionalParams, + WafPolicyListOptionalParams, +} from "./api/wafPolicy/index.js"; +export { + ApiKeysOperations, + CertificatesOperations, + ConfigurationsOperations, + DefaultWafPolicyOperations, + DeploymentsOperations, + OperationsOperations, + WafPolicyOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; +export { AzureClouds, AzureSupportedClouds }; diff --git a/sdk/nginx/arm-nginx/src/logger.ts b/sdk/nginx/arm-nginx/src/logger.ts new file mode 100644 index 000000000000..59302a916ec6 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-nginx"); diff --git a/sdk/nginx/arm-nginx/src/lroImpl.ts b/sdk/nginx/arm-nginx/src/lroImpl.ts deleted file mode 100644 index 5f88efab981b..000000000000 --- a/sdk/nginx/arm-nginx/src/lroImpl.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { AbortSignalLike } from "@azure/abort-controller"; -import { LongRunningOperation, LroResponse } from "@azure/core-lro"; - -export function createLroSpec(inputs: { - sendOperationFn: (args: any, spec: any) => Promise>; - args: Record; - spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record; -}): LongRunningOperation { - const { args, spec, sendOperationFn } = inputs; - return { - requestMethod: spec.httpMethod, - requestPath: spec.path!, - sendInitialRequest: () => sendOperationFn(args, spec), - sendPollRequest: ( - path: string, - options?: { abortSignal?: AbortSignalLike }, - ) => { - const { requestBody, ...restSpec } = spec; - return sendOperationFn(args, { - ...restSpec, - httpMethod: "GET", - path, - abortSignal: options?.abortSignal, - }); - }, - }; -} diff --git a/sdk/nginx/arm-nginx/src/models/index.ts b/sdk/nginx/arm-nginx/src/models/index.ts index ebb2b44481be..fa094d84028b 100644 --- a/sdk/nginx/arm-nginx/src/models/index.ts +++ b/sdk/nginx/arm-nginx/src/models/index.ts @@ -1,921 +1,90 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -export interface NginxDeploymentApiKeyRequest { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly id?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly type?: string; - properties?: NginxDeploymentApiKeyRequestProperties; -} - -export interface NginxDeploymentApiKeyRequestProperties { - /** - * Secret text to be used as a Dataplane API Key. This is a write only property that can never be read back, but the first three characters will be returned in the 'hint' property. - * This value contains a credential. Consider obscuring before showing to users - */ - secretText?: string; - /** The time after which this Dataplane API Key is no longer valid. */ - endDateTime?: Date; -} - -export interface NginxDeploymentApiKeyResponse { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly id?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly type?: string; - properties?: NginxDeploymentApiKeyResponseProperties; -} - -export interface NginxDeploymentApiKeyResponseProperties { - /** - * The first three characters of the secret text to help identify it in use. This property is read-only. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly hint?: string; - /** The time after which this Dataplane API Key is no longer valid. */ - endDateTime?: Date; -} - -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ -export interface ErrorResponse { - /** The error object. */ - error?: ErrorDetail; -} - -/** The error detail. */ -export interface ErrorDetail { - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; - /** - * The error target. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly target?: string; - /** - * The error details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: ErrorDetail[]; - /** - * The error additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfo { - /** - * The additional info type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * The additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly info?: Record; -} - -export interface NginxDeploymentApiKeyListResponse { - value?: NginxDeploymentApiKeyResponse[]; - nextLink?: string; -} - -export interface NginxCertificate { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly id?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly type?: string; - properties?: NginxCertificateProperties; - location?: string; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -export interface NginxCertificateProperties { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly provisioningState?: ProvisioningState; - keyVirtualPath?: string; - certificateVirtualPath?: string; - keyVaultSecretId?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly sha1Thumbprint?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly keyVaultSecretVersion?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly keyVaultSecretCreated?: Date; - certificateError?: NginxCertificateErrorResponseBody; -} - -export interface NginxCertificateErrorResponseBody { - code?: string; - message?: string; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -export interface NginxCertificateListResponse { - value?: NginxCertificate[]; - nextLink?: string; -} - -/** Response of a list operation. */ -export interface NginxConfigurationListResponse { - /** Results of a list operation. */ - value?: NginxConfigurationResponse[]; - /** Link to the next set of results, if any. */ - nextLink?: string; -} - -export interface NginxConfigurationResponse { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly id?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly type?: string; - properties?: NginxConfigurationResponseProperties; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -export interface NginxConfigurationResponseProperties { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly provisioningState?: ProvisioningState; - files?: NginxConfigurationFile[]; - protectedFiles?: NginxConfigurationProtectedFileResponse[]; - package?: NginxConfigurationPackage; - rootFile?: string; -} - -export interface NginxConfigurationFile { - content?: string; - virtualPath?: string; -} - -export interface NginxConfigurationProtectedFileResponse { - /** The virtual path of the protected file. */ - virtualPath?: string; - /** The hash of the content of the file. This value is used to determine if the file has changed. */ - contentHash?: string; -} - -export interface NginxConfigurationPackage { - data?: string; - protectedFiles?: string[]; -} - -export interface NginxConfigurationRequest { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly id?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly type?: string; - properties?: NginxConfigurationRequestProperties; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -export interface NginxConfigurationRequestProperties { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly provisioningState?: ProvisioningState; - files?: NginxConfigurationFile[]; - protectedFiles?: NginxConfigurationProtectedFileRequest[]; - package?: NginxConfigurationPackage; - rootFile?: string; -} - -export interface NginxConfigurationProtectedFileRequest { - /** The content of the protected file. This value is a PUT only value. If you perform a GET request on this value, it will be empty because it is a protected file. */ - content?: string; - /** The virtual path of the protected file. */ - virtualPath?: string; - /** The hash of the content of the file. This value is used to determine if the file has changed. */ - contentHash?: string; -} - -/** The request body for creating an analysis for an NGINX configuration. */ -export interface AnalysisCreate { - config: AnalysisCreateConfig; -} - -export interface AnalysisCreateConfig { - /** The root file of the NGINX config file(s). It must match one of the files' filepath. */ - rootFile?: string; - files?: NginxConfigurationFile[]; - protectedFiles?: NginxConfigurationProtectedFileRequest[]; - package?: NginxConfigurationPackage; -} - -/** The response body for an analysis request. Contains the status of the analysis and any errors. */ -export interface AnalysisResult { - /** The status of the analysis. */ - status: string; - data?: AnalysisResultData; -} - -export interface AnalysisResultData { - errors?: AnalysisDiagnostic[]; - diagnostics?: DiagnosticItem[]; -} - -/** An error object found during the analysis of an NGINX configuration. */ -export interface AnalysisDiagnostic { - /** Unique identifier for the error */ - id?: string; - directive: string; - description: string; - /** the filepath of the most relevant config file */ - file: string; - line: number; - message: string; - rule: string; -} - -/** A diagnostic is a message associated with an NGINX config. The Analyzer returns diagnostics with a level indicating the importance of the diagnostic with optional category. */ -export interface DiagnosticItem { - /** Unique identifier for the diagnostic. */ - id?: string; - directive: string; - description: string; - /** The filepath of the most relevant config file. */ - file: string; - line: number; - message: string; - rule: string; - /** Warning or Info */ - level: Level; - /** Category of warning like Best-practices, Recommendation, Security etc. */ - category?: string; -} - -export interface NginxDeployment { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly id?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly type?: string; - identity?: IdentityProperties; - properties?: NginxDeploymentProperties; - /** Dictionary of */ - tags?: { [propertyName: string]: string }; - sku?: ResourceSku; - location?: string; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -export interface IdentityProperties { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly principalId?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly tenantId?: string; - type?: IdentityType; - /** Dictionary of */ - userAssignedIdentities?: { [propertyName: string]: UserIdentityProperties }; -} - -export interface UserIdentityProperties { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly principalId?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly clientId?: string; -} - -export interface NginxDeploymentProperties { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly provisioningState?: ProvisioningState; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly nginxVersion?: string; - networkProfile?: NginxNetworkProfile; - /** - * The IP address of the deployment. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly ipAddress?: string; - enableDiagnosticsSupport?: boolean; - logging?: NginxLogging; - /** Information on how the deployment will be scaled. */ - scalingProperties?: NginxDeploymentScalingProperties; - /** Autoupgrade settings of a deployment. */ - autoUpgradeProfile?: AutoUpgradeProfile; - userProfile?: NginxDeploymentUserProfile; - /** Settings for NGINX App Protect (NAP) */ - nginxAppProtect?: NginxDeploymentPropertiesNginxAppProtect; - /** - * Dataplane API endpoint for the caller to update the NGINX state of the deployment. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly dataplaneApiEndpoint?: string; -} - -export interface NginxNetworkProfile { - frontEndIPConfiguration?: NginxFrontendIPConfiguration; - networkInterfaceConfiguration?: NginxNetworkInterfaceConfiguration; -} - -export interface NginxFrontendIPConfiguration { - publicIPAddresses?: NginxPublicIPAddress[]; - privateIPAddresses?: NginxPrivateIPAddress[]; -} - -export interface NginxPublicIPAddress { - id?: string; -} - -export interface NginxPrivateIPAddress { - privateIPAddress?: string; - privateIPAllocationMethod?: NginxPrivateIPAllocationMethod; - subnetId?: string; -} - -export interface NginxNetworkInterfaceConfiguration { - subnetId?: string; -} - -export interface NginxLogging { - storageAccount?: NginxStorageAccount; -} - -export interface NginxStorageAccount { - accountName?: string; - containerName?: string; -} - -/** Information on how the deployment will be scaled. */ -export interface NginxDeploymentScalingProperties { - capacity?: number; - profiles?: ScaleProfile[]; -} - -/** The autoscale profile. */ -export interface ScaleProfile { - name: string; - /** The capacity parameters of the profile. */ - capacity: ScaleProfileCapacity; -} - -/** The capacity parameters of the profile. */ -export interface ScaleProfileCapacity { - /** The minimum number of NCUs the deployment can be autoscaled to. */ - min: number; - /** The maximum number of NCUs the deployment can be autoscaled to. */ - max: number; -} - -/** Autoupgrade settings of a deployment. */ -export interface AutoUpgradeProfile { - /** Channel used for autoupgrade. */ - upgradeChannel: string; -} - -export interface NginxDeploymentUserProfile { - /** The preferred support contact email address of the user used for sending alerts and notification. Can be an empty string or a valid email address. */ - preferredEmail?: string; -} - -/** Settings for NGINX App Protect (NAP) */ -export interface NginxDeploymentPropertiesNginxAppProtect { - /** Settings for the NGINX App Protect Web Application Firewall (WAF) */ - webApplicationFirewallSettings: WebApplicationFirewallSettings; - /** - * The status of the NGINX App Protect Web Application Firewall - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly webApplicationFirewallStatus?: WebApplicationFirewallStatus; -} - -/** Settings for the NGINX App Protect Web Application Firewall (WAF) */ -export interface WebApplicationFirewallSettings { - /** The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it. */ - activationState?: ActivationState; -} - -/** The status of the NGINX App Protect Web Application Firewall */ -export interface WebApplicationFirewallStatus { - /** - * Package containing attack signatures for the NGINX App Protect Web Application Firewall (WAF). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly attackSignaturesPackage?: WebApplicationFirewallPackage; - /** - * Package containing bot signatures for the NGINX App Protect Web Application Firewall (WAF). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly botSignaturesPackage?: WebApplicationFirewallPackage; - /** - * Package containing threat campaigns for the NGINX App Protect Web Application Firewall (WAF). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly threatCampaignsPackage?: WebApplicationFirewallPackage; - /** - * Versions of the NGINX App Protect Web Application Firewall (WAF) components. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly componentVersions?: WebApplicationFirewallComponentVersions; -} - -/** NGINX App Protect Web Application Firewall (WAF) Package. Contains the version and revision date of the package. */ -export interface WebApplicationFirewallPackage { - /** The version of the NGINX App Protect Web Application Firewall (WAF) package. */ - version: string; - /** The date and time of the package revision. */ - revisionDatetime: Date; -} - -/** Versions of the NGINX App Protect Web Application Firewall (WAF) components. */ -export interface WebApplicationFirewallComponentVersions { - /** The version of the NGINX App Protect Web Application Firewall (WAF) engine. */ - wafEngineVersion: string; - /** The version of the NGINX App Protect Web Application Firewall (WAF) module for NGINX. */ - wafNginxVersion: string; -} - -export interface ResourceSku { - /** Name of the SKU. */ - name: string; -} - -export interface NginxDeploymentUpdateParameters { - identity?: IdentityProperties; - /** Dictionary of */ - tags?: { [propertyName: string]: string }; - sku?: ResourceSku; - location?: string; - properties?: NginxDeploymentUpdateProperties; -} - -export interface NginxDeploymentUpdateProperties { - enableDiagnosticsSupport?: boolean; - logging?: NginxLogging; - /** Information on how the deployment will be scaled. */ - scalingProperties?: NginxDeploymentScalingProperties; - userProfile?: NginxDeploymentUserProfile; - networkProfile?: NginxNetworkProfile; - /** Autoupgrade settings of a deployment. */ - autoUpgradeProfile?: AutoUpgradeProfile; - /** Update settings for NGINX App Protect (NAP) */ - nginxAppProtect?: NginxDeploymentUpdatePropertiesNginxAppProtect; -} - -/** Update settings for NGINX App Protect (NAP) */ -export interface NginxDeploymentUpdatePropertiesNginxAppProtect { - /** Settings for the NGINX App Protect Web Application Firewall (WAF) */ - webApplicationFirewallSettings?: WebApplicationFirewallSettings; -} - -export interface NginxDeploymentListResponse { - value?: NginxDeployment[]; - nextLink?: string; -} - -/** Result of GET request to list Nginx.NginxPlus operations. */ -export interface OperationListResult { - /** List of operations supported by the Nginx.NginxPlus provider. */ - value?: OperationResult[]; - /** URL to get the next set of operation list results if there are any. */ - nextLink?: string; -} - -/** A Nginx.NginxPlus REST API operation. */ -export interface OperationResult { - /** Operation name: {provider}/{resource}/{operation} */ - name?: string; - /** The object that represents the operation. */ - display?: OperationDisplay; - /** Indicates whether the operation is a data action */ - isDataAction?: boolean; -} - -/** The object that represents the operation. */ -export interface OperationDisplay { - /** Service provider: Nginx.NginxPlus */ - provider?: string; - /** Type on which the operation is performed, e.g., 'deployments'. */ - resource?: string; - /** Operation type, e.g., read, write, delete, etc. */ - operation?: string; - /** Description of the operation, e.g., 'Write deployments'. */ - description?: string; -} - -/** Known values of {@link ProvisioningState} that the service accepts. */ -export enum KnownProvisioningState { - /** Accepted */ - Accepted = "Accepted", - /** Creating */ - Creating = "Creating", - /** Updating */ - Updating = "Updating", - /** Deleting */ - Deleting = "Deleting", - /** Succeeded */ - Succeeded = "Succeeded", - /** Failed */ - Failed = "Failed", - /** Canceled */ - Canceled = "Canceled", - /** Deleted */ - Deleted = "Deleted", - /** NotSpecified */ - NotSpecified = "NotSpecified", -} - -/** - * Defines values for ProvisioningState. \ - * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Accepted** \ - * **Creating** \ - * **Updating** \ - * **Deleting** \ - * **Succeeded** \ - * **Failed** \ - * **Canceled** \ - * **Deleted** \ - * **NotSpecified** - */ -export type ProvisioningState = string; - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key", -} - -/** - * Defines values for CreatedByType. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** Known values of {@link Level} that the service accepts. */ -export enum KnownLevel { - /** Info */ - Info = "Info", - /** Warning */ - Warning = "Warning", -} - -/** - * Defines values for Level. \ - * {@link KnownLevel} can be used interchangeably with Level, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Info** \ - * **Warning** - */ -export type Level = string; - -/** Known values of {@link IdentityType} that the service accepts. */ -export enum KnownIdentityType { - /** SystemAssigned */ - SystemAssigned = "SystemAssigned", - /** UserAssigned */ - UserAssigned = "UserAssigned", - /** SystemAssignedUserAssigned */ - SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", - /** None */ - None = "None", -} - -/** - * Defines values for IdentityType. \ - * {@link KnownIdentityType} can be used interchangeably with IdentityType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **SystemAssigned** \ - * **UserAssigned** \ - * **SystemAssigned, UserAssigned** \ - * **None** - */ -export type IdentityType = string; - -/** Known values of {@link NginxPrivateIPAllocationMethod} that the service accepts. */ -export enum KnownNginxPrivateIPAllocationMethod { - /** Static */ - Static = "Static", - /** Dynamic */ - Dynamic = "Dynamic", -} - -/** - * Defines values for NginxPrivateIPAllocationMethod. \ - * {@link KnownNginxPrivateIPAllocationMethod} can be used interchangeably with NginxPrivateIPAllocationMethod, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Static** \ - * **Dynamic** - */ -export type NginxPrivateIPAllocationMethod = string; - -/** Known values of {@link ActivationState} that the service accepts. */ -export enum KnownActivationState { - /** Enabled */ - Enabled = "Enabled", - /** Disabled */ - Disabled = "Disabled", -} - -/** - * Defines values for ActivationState. \ - * {@link KnownActivationState} can be used interchangeably with ActivationState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled** \ - * **Disabled** - */ -export type ActivationState = string; - -/** Optional parameters. */ -export interface ApiKeysCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** The API Key object containing fields (e.g. secret text, expiration date) to upsert the key. */ - body?: NginxDeploymentApiKeyRequest; -} - -/** Contains response data for the createOrUpdate operation. */ -export type ApiKeysCreateOrUpdateResponse = NginxDeploymentApiKeyResponse; - -/** Optional parameters. */ -export interface ApiKeysDeleteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface ApiKeysGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type ApiKeysGetResponse = NginxDeploymentApiKeyResponse; - -/** Optional parameters. */ -export interface ApiKeysListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type ApiKeysListResponse = NginxDeploymentApiKeyListResponse; - -/** Optional parameters. */ -export interface ApiKeysListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type ApiKeysListNextResponse = NginxDeploymentApiKeyListResponse; - -/** Optional parameters. */ -export interface CertificatesGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type CertificatesGetResponse = NginxCertificate; - -/** Optional parameters. */ -export interface CertificatesCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** The certificate */ - body?: NginxCertificate; - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type CertificatesCreateOrUpdateResponse = NginxCertificate; - -/** Optional parameters. */ -export interface CertificatesDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Optional parameters. */ -export interface CertificatesListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type CertificatesListResponse = NginxCertificateListResponse; - -/** Optional parameters. */ -export interface CertificatesListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type CertificatesListNextResponse = NginxCertificateListResponse; - -/** Optional parameters. */ -export interface ConfigurationsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type ConfigurationsListResponse = NginxConfigurationListResponse; - -/** Optional parameters. */ -export interface ConfigurationsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type ConfigurationsGetResponse = NginxConfigurationResponse; - -/** Optional parameters. */ -export interface ConfigurationsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** The NGINX configuration */ - body?: NginxConfigurationRequest; - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type ConfigurationsCreateOrUpdateResponse = NginxConfigurationResponse; - -/** Optional parameters. */ -export interface ConfigurationsDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Optional parameters. */ -export interface ConfigurationsAnalysisOptionalParams - extends coreClient.OperationOptions { - /** The NGINX configuration to analyze */ - body?: AnalysisCreate; -} - -/** Contains response data for the analysis operation. */ -export type ConfigurationsAnalysisResponse = AnalysisResult; - -/** Optional parameters. */ -export interface ConfigurationsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type ConfigurationsListNextResponse = NginxConfigurationListResponse; - -/** Optional parameters. */ -export interface DeploymentsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type DeploymentsGetResponse = NginxDeployment; - -/** Optional parameters. */ -export interface DeploymentsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - body?: NginxDeployment; - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type DeploymentsCreateOrUpdateResponse = NginxDeployment; - -/** Optional parameters. */ -export interface DeploymentsUpdateOptionalParams - extends coreClient.OperationOptions { - body?: NginxDeploymentUpdateParameters; - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type DeploymentsUpdateResponse = NginxDeployment; - -/** Optional parameters. */ -export interface DeploymentsDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Optional parameters. */ -export interface DeploymentsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type DeploymentsListResponse = NginxDeploymentListResponse; - -/** Optional parameters. */ -export interface DeploymentsListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type DeploymentsListByResourceGroupResponse = - NginxDeploymentListResponse; - -/** Optional parameters. */ -export interface DeploymentsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type DeploymentsListNextResponse = NginxDeploymentListResponse; - -/** Optional parameters. */ -export interface DeploymentsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type DeploymentsListByResourceGroupNextResponse = - NginxDeploymentListResponse; - -/** Optional parameters. */ -export interface OperationsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type OperationsListResponse = OperationListResult; - -/** Optional parameters. */ -export interface OperationsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type OperationsListNextResponse = OperationListResult; - -/** Optional parameters. */ -export interface NginxManagementClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + NginxDeploymentApiKeyResponse, + NginxDeploymentApiKeyResponseProperties, + ProxyResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + NginxDeploymentApiKeyRequest, + NginxDeploymentApiKeyRequestProperties, + NginxDeployment, + NginxDeploymentProperties, + KnownProvisioningState, + ProvisioningState, + NginxNetworkProfile, + NginxFrontendIPConfiguration, + NginxPublicIPAddress, + NginxPrivateIPAddress, + KnownNginxPrivateIPAllocationMethod, + NginxPrivateIPAllocationMethod, + NginxNetworkInterfaceConfiguration, + NginxLogging, + NginxStorageAccount, + NginxDeploymentScalingProperties, + NginxDeploymentScalingPropertiesAutoScaleSettings, + ScaleProfile, + ScaleProfileCapacity, + AutoUpgradeProfile, + NginxDeploymentUserProfile, + NginxDeploymentPropertiesNginxAppProtect, + WebApplicationFirewallSettings, + KnownActivationState, + ActivationState, + WebApplicationFirewallStatus, + WebApplicationFirewallPackage, + WebApplicationFirewallComponentVersions, + IdentityProperties, + KnownIdentityType, + IdentityType, + UserIdentityProperties, + ResourceSku, + TrackedResource, + NginxDeploymentUpdateParameters, + NginxDeploymentUpdateProperties, + NginxDeploymentUpdatePropertiesNginxAppProtect, + NginxDeploymentWafPolicyMetadata, + NginxDeploymentWafPolicyMetadataProperties, + NginxDeploymentWafPolicyCompilingStatus, + KnownNginxDeploymentWafPolicyCompilingStatusCode, + NginxDeploymentWafPolicyCompilingStatusCode, + NginxDeploymentWafPolicyApplyingStatus, + KnownNginxDeploymentWafPolicyApplyingStatusCode, + NginxDeploymentWafPolicyApplyingStatusCode, + NginxDeploymentWafPolicy, + NginxDeploymentWafPolicyProperties, + NginxDeploymentDefaultWafPolicyListResponse, + NginxDeploymentDefaultWafPolicyProperties, + NginxCertificate, + NginxCertificateProperties, + NginxCertificateErrorResponseBody, + NginxConfiguration, + NginxConfigurationProperties, + NginxConfigurationFile, + NginxConfigurationProtectedFileResponse, + NginxConfigurationPackage, + NginxConfigurationRequest, + NginxConfigurationRequestProperties, + NginxConfigurationProtectedFileRequest, + AnalysisCreate, + AnalysisCreateConfig, + AnalysisResult, + AnalysisResultData, + AnalysisDiagnostic, + DiagnosticItem, + KnownLevel, + Level, + KnownVersions, +} from "./models.js"; diff --git a/sdk/nginx/arm-nginx/src/models/mappers.ts b/sdk/nginx/arm-nginx/src/models/mappers.ts deleted file mode 100644 index 378a2c6f29c8..000000000000 --- a/sdk/nginx/arm-nginx/src/models/mappers.ts +++ /dev/null @@ -1,1873 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -export const NginxDeploymentApiKeyRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeploymentApiKeyRequest", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "NginxDeploymentApiKeyRequestProperties", - }, - }, - }, - }, -}; - -export const NginxDeploymentApiKeyRequestProperties: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "NginxDeploymentApiKeyRequestProperties", - modelProperties: { - secretText: { - serializedName: "secretText", - type: { - name: "String", - }, - }, - endDateTime: { - serializedName: "endDateTime", - type: { - name: "DateTime", - }, - }, - }, - }, - }; - -export const NginxDeploymentApiKeyResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeploymentApiKeyResponse", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "NginxDeploymentApiKeyResponseProperties", - }, - }, - }, - }, -}; - -export const NginxDeploymentApiKeyResponseProperties: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "NginxDeploymentApiKeyResponseProperties", - modelProperties: { - hint: { - serializedName: "hint", - readOnly: true, - type: { - name: "String", - }, - }, - endDateTime: { - serializedName: "endDateTime", - type: { - name: "DateTime", - }, - }, - }, - }, - }; - -export const ErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, -}; - -export const ErrorDetail: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorDetail", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String", - }, - }, - target: { - serializedName: "target", - readOnly: true, - type: { - name: "String", - }, - }, - details: { - serializedName: "details", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, - additionalInfo: { - serializedName: "additionalInfo", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - }, - }, - }, - }, - }, - }, -}; - -export const ErrorAdditionalInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - modelProperties: { - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - info: { - serializedName: "info", - readOnly: true, - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - }, - }, -}; - -export const NginxDeploymentApiKeyListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeploymentApiKeyListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxDeploymentApiKeyResponse", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxCertificate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxCertificate", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "NginxCertificateProperties", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - }, - }, -}; - -export const NginxCertificateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxCertificateProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - keyVirtualPath: { - serializedName: "keyVirtualPath", - type: { - name: "String", - }, - }, - certificateVirtualPath: { - serializedName: "certificateVirtualPath", - type: { - name: "String", - }, - }, - keyVaultSecretId: { - serializedName: "keyVaultSecretId", - type: { - name: "String", - }, - }, - sha1Thumbprint: { - serializedName: "sha1Thumbprint", - readOnly: true, - type: { - name: "String", - }, - }, - keyVaultSecretVersion: { - serializedName: "keyVaultSecretVersion", - readOnly: true, - type: { - name: "String", - }, - }, - keyVaultSecretCreated: { - serializedName: "keyVaultSecretCreated", - readOnly: true, - type: { - name: "DateTime", - }, - }, - certificateError: { - serializedName: "certificateError", - type: { - name: "Composite", - className: "NginxCertificateErrorResponseBody", - }, - }, - }, - }, -}; - -export const NginxCertificateErrorResponseBody: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxCertificateErrorResponseBody", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String", - }, - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String", - }, - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime", - }, - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String", - }, - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String", - }, - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const NginxCertificateListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxCertificateListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxCertificate", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxConfigurationListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxConfigurationListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxConfigurationResponse", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxConfigurationResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxConfigurationResponse", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "NginxConfigurationResponseProperties", - }, - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - }, - }, -}; - -export const NginxConfigurationResponseProperties: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "NginxConfigurationResponseProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - files: { - serializedName: "files", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxConfigurationFile", - }, - }, - }, - }, - protectedFiles: { - serializedName: "protectedFiles", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxConfigurationProtectedFileResponse", - }, - }, - }, - }, - package: { - serializedName: "package", - type: { - name: "Composite", - className: "NginxConfigurationPackage", - }, - }, - rootFile: { - serializedName: "rootFile", - type: { - name: "String", - }, - }, - }, - }, - }; - -export const NginxConfigurationFile: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxConfigurationFile", - modelProperties: { - content: { - serializedName: "content", - type: { - name: "String", - }, - }, - virtualPath: { - serializedName: "virtualPath", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxConfigurationProtectedFileResponse: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "NginxConfigurationProtectedFileResponse", - modelProperties: { - virtualPath: { - serializedName: "virtualPath", - type: { - name: "String", - }, - }, - contentHash: { - serializedName: "contentHash", - type: { - name: "String", - }, - }, - }, - }, - }; - -export const NginxConfigurationPackage: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxConfigurationPackage", - modelProperties: { - data: { - serializedName: "data", - type: { - name: "String", - }, - }, - protectedFiles: { - serializedName: "protectedFiles", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const NginxConfigurationRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxConfigurationRequest", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "NginxConfigurationRequestProperties", - }, - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - }, - }, -}; - -export const NginxConfigurationRequestProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxConfigurationRequestProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - files: { - serializedName: "files", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxConfigurationFile", - }, - }, - }, - }, - protectedFiles: { - serializedName: "protectedFiles", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxConfigurationProtectedFileRequest", - }, - }, - }, - }, - package: { - serializedName: "package", - type: { - name: "Composite", - className: "NginxConfigurationPackage", - }, - }, - rootFile: { - serializedName: "rootFile", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxConfigurationProtectedFileRequest: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "NginxConfigurationProtectedFileRequest", - modelProperties: { - content: { - serializedName: "content", - type: { - name: "String", - }, - }, - virtualPath: { - serializedName: "virtualPath", - type: { - name: "String", - }, - }, - contentHash: { - serializedName: "contentHash", - type: { - name: "String", - }, - }, - }, - }, - }; - -export const AnalysisCreate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AnalysisCreate", - modelProperties: { - config: { - serializedName: "config", - type: { - name: "Composite", - className: "AnalysisCreateConfig", - }, - }, - }, - }, -}; - -export const AnalysisCreateConfig: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AnalysisCreateConfig", - modelProperties: { - rootFile: { - serializedName: "rootFile", - type: { - name: "String", - }, - }, - files: { - serializedName: "files", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxConfigurationFile", - }, - }, - }, - }, - protectedFiles: { - serializedName: "protectedFiles", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxConfigurationProtectedFileRequest", - }, - }, - }, - }, - package: { - serializedName: "package", - type: { - name: "Composite", - className: "NginxConfigurationPackage", - }, - }, - }, - }, -}; - -export const AnalysisResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AnalysisResult", - modelProperties: { - status: { - serializedName: "status", - required: true, - type: { - name: "String", - }, - }, - data: { - serializedName: "data", - type: { - name: "Composite", - className: "AnalysisResultData", - }, - }, - }, - }, -}; - -export const AnalysisResultData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AnalysisResultData", - modelProperties: { - errors: { - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AnalysisDiagnostic", - }, - }, - }, - }, - diagnostics: { - serializedName: "diagnostics", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DiagnosticItem", - }, - }, - }, - }, - }, - }, -}; - -export const AnalysisDiagnostic: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AnalysisDiagnostic", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - directive: { - serializedName: "directive", - required: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - required: true, - type: { - name: "String", - }, - }, - file: { - serializedName: "file", - required: true, - type: { - name: "String", - }, - }, - line: { - serializedName: "line", - required: true, - type: { - name: "Number", - }, - }, - message: { - serializedName: "message", - required: true, - type: { - name: "String", - }, - }, - rule: { - serializedName: "rule", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DiagnosticItem: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DiagnosticItem", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - directive: { - serializedName: "directive", - required: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - required: true, - type: { - name: "String", - }, - }, - file: { - serializedName: "file", - required: true, - type: { - name: "String", - }, - }, - line: { - serializedName: "line", - required: true, - type: { - name: "Number", - }, - }, - message: { - serializedName: "message", - required: true, - type: { - name: "String", - }, - }, - rule: { - serializedName: "rule", - required: true, - type: { - name: "String", - }, - }, - level: { - serializedName: "level", - required: true, - type: { - name: "String", - }, - }, - category: { - serializedName: "category", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxDeployment: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeployment", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "IdentityProperties", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "NginxDeploymentProperties", - }, - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "ResourceSku", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - }, - }, -}; - -export const IdentityProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IdentityProperties", - modelProperties: { - principalId: { - serializedName: "principalId", - readOnly: true, - type: { - name: "String", - }, - }, - tenantId: { - serializedName: "tenantId", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - type: { - name: "String", - }, - }, - userAssignedIdentities: { - serializedName: "userAssignedIdentities", - type: { - name: "Dictionary", - value: { - type: { name: "Composite", className: "UserIdentityProperties" }, - }, - }, - }, - }, - }, -}; - -export const UserIdentityProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserIdentityProperties", - modelProperties: { - principalId: { - serializedName: "principalId", - readOnly: true, - type: { - name: "String", - }, - }, - clientId: { - serializedName: "clientId", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxDeploymentProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeploymentProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - nginxVersion: { - serializedName: "nginxVersion", - readOnly: true, - type: { - name: "String", - }, - }, - networkProfile: { - serializedName: "networkProfile", - type: { - name: "Composite", - className: "NginxNetworkProfile", - }, - }, - ipAddress: { - serializedName: "ipAddress", - readOnly: true, - type: { - name: "String", - }, - }, - enableDiagnosticsSupport: { - serializedName: "enableDiagnosticsSupport", - type: { - name: "Boolean", - }, - }, - logging: { - serializedName: "logging", - type: { - name: "Composite", - className: "NginxLogging", - }, - }, - scalingProperties: { - serializedName: "scalingProperties", - type: { - name: "Composite", - className: "NginxDeploymentScalingProperties", - }, - }, - autoUpgradeProfile: { - serializedName: "autoUpgradeProfile", - type: { - name: "Composite", - className: "AutoUpgradeProfile", - }, - }, - userProfile: { - serializedName: "userProfile", - type: { - name: "Composite", - className: "NginxDeploymentUserProfile", - }, - }, - nginxAppProtect: { - serializedName: "nginxAppProtect", - type: { - name: "Composite", - className: "NginxDeploymentPropertiesNginxAppProtect", - }, - }, - dataplaneApiEndpoint: { - serializedName: "dataplaneApiEndpoint", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxNetworkProfile: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxNetworkProfile", - modelProperties: { - frontEndIPConfiguration: { - serializedName: "frontEndIPConfiguration", - type: { - name: "Composite", - className: "NginxFrontendIPConfiguration", - }, - }, - networkInterfaceConfiguration: { - serializedName: "networkInterfaceConfiguration", - type: { - name: "Composite", - className: "NginxNetworkInterfaceConfiguration", - }, - }, - }, - }, -}; - -export const NginxFrontendIPConfiguration: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxFrontendIPConfiguration", - modelProperties: { - publicIPAddresses: { - serializedName: "publicIPAddresses", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxPublicIPAddress", - }, - }, - }, - }, - privateIPAddresses: { - serializedName: "privateIPAddresses", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxPrivateIPAddress", - }, - }, - }, - }, - }, - }, -}; - -export const NginxPublicIPAddress: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxPublicIPAddress", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxPrivateIPAddress: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxPrivateIPAddress", - modelProperties: { - privateIPAddress: { - serializedName: "privateIPAddress", - type: { - name: "String", - }, - }, - privateIPAllocationMethod: { - serializedName: "privateIPAllocationMethod", - type: { - name: "String", - }, - }, - subnetId: { - serializedName: "subnetId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxNetworkInterfaceConfiguration: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxNetworkInterfaceConfiguration", - modelProperties: { - subnetId: { - serializedName: "subnetId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxLogging: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxLogging", - modelProperties: { - storageAccount: { - serializedName: "storageAccount", - type: { - name: "Composite", - className: "NginxStorageAccount", - }, - }, - }, - }, -}; - -export const NginxStorageAccount: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxStorageAccount", - modelProperties: { - accountName: { - serializedName: "accountName", - type: { - name: "String", - }, - }, - containerName: { - serializedName: "containerName", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxDeploymentScalingProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeploymentScalingProperties", - modelProperties: { - capacity: { - serializedName: "capacity", - type: { - name: "Number", - }, - }, - profiles: { - serializedName: "autoScaleSettings.profiles", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ScaleProfile", - }, - }, - }, - }, - }, - }, -}; - -export const ScaleProfile: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ScaleProfile", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - capacity: { - serializedName: "capacity", - type: { - name: "Composite", - className: "ScaleProfileCapacity", - }, - }, - }, - }, -}; - -export const ScaleProfileCapacity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ScaleProfileCapacity", - modelProperties: { - min: { - constraints: { - InclusiveMinimum: 0, - }, - serializedName: "min", - required: true, - type: { - name: "Number", - }, - }, - max: { - constraints: { - InclusiveMinimum: 0, - }, - serializedName: "max", - required: true, - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const AutoUpgradeProfile: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AutoUpgradeProfile", - modelProperties: { - upgradeChannel: { - serializedName: "upgradeChannel", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxDeploymentUserProfile: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeploymentUserProfile", - modelProperties: { - preferredEmail: { - constraints: { - Pattern: new RegExp( - "^$|^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$", - ), - }, - serializedName: "preferredEmail", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxDeploymentPropertiesNginxAppProtect: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "NginxDeploymentPropertiesNginxAppProtect", - modelProperties: { - webApplicationFirewallSettings: { - serializedName: "webApplicationFirewallSettings", - type: { - name: "Composite", - className: "WebApplicationFirewallSettings", - }, - }, - webApplicationFirewallStatus: { - serializedName: "webApplicationFirewallStatus", - type: { - name: "Composite", - className: "WebApplicationFirewallStatus", - }, - }, - }, - }, - }; - -export const WebApplicationFirewallSettings: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "WebApplicationFirewallSettings", - modelProperties: { - activationState: { - serializedName: "activationState", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const WebApplicationFirewallStatus: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "WebApplicationFirewallStatus", - modelProperties: { - attackSignaturesPackage: { - serializedName: "attackSignaturesPackage", - type: { - name: "Composite", - className: "WebApplicationFirewallPackage", - }, - }, - botSignaturesPackage: { - serializedName: "botSignaturesPackage", - type: { - name: "Composite", - className: "WebApplicationFirewallPackage", - }, - }, - threatCampaignsPackage: { - serializedName: "threatCampaignsPackage", - type: { - name: "Composite", - className: "WebApplicationFirewallPackage", - }, - }, - componentVersions: { - serializedName: "componentVersions", - type: { - name: "Composite", - className: "WebApplicationFirewallComponentVersions", - }, - }, - }, - }, -}; - -export const WebApplicationFirewallPackage: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "WebApplicationFirewallPackage", - modelProperties: { - version: { - serializedName: "version", - required: true, - type: { - name: "String", - }, - }, - revisionDatetime: { - serializedName: "revisionDatetime", - required: true, - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const WebApplicationFirewallComponentVersions: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "WebApplicationFirewallComponentVersions", - modelProperties: { - wafEngineVersion: { - serializedName: "wafEngineVersion", - required: true, - type: { - name: "String", - }, - }, - wafNginxVersion: { - serializedName: "wafNginxVersion", - required: true, - type: { - name: "String", - }, - }, - }, - }, - }; - -export const ResourceSku: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ResourceSku", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NginxDeploymentUpdateParameters: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeploymentUpdateParameters", - modelProperties: { - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "IdentityProperties", - }, - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "ResourceSku", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "NginxDeploymentUpdateProperties", - }, - }, - }, - }, -}; - -export const NginxDeploymentUpdateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeploymentUpdateProperties", - modelProperties: { - enableDiagnosticsSupport: { - serializedName: "enableDiagnosticsSupport", - type: { - name: "Boolean", - }, - }, - logging: { - serializedName: "logging", - type: { - name: "Composite", - className: "NginxLogging", - }, - }, - scalingProperties: { - serializedName: "scalingProperties", - type: { - name: "Composite", - className: "NginxDeploymentScalingProperties", - }, - }, - userProfile: { - serializedName: "userProfile", - type: { - name: "Composite", - className: "NginxDeploymentUserProfile", - }, - }, - networkProfile: { - serializedName: "networkProfile", - type: { - name: "Composite", - className: "NginxNetworkProfile", - }, - }, - autoUpgradeProfile: { - serializedName: "autoUpgradeProfile", - type: { - name: "Composite", - className: "AutoUpgradeProfile", - }, - }, - nginxAppProtect: { - serializedName: "nginxAppProtect", - type: { - name: "Composite", - className: "NginxDeploymentUpdatePropertiesNginxAppProtect", - }, - }, - }, - }, -}; - -export const NginxDeploymentUpdatePropertiesNginxAppProtect: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "NginxDeploymentUpdatePropertiesNginxAppProtect", - modelProperties: { - webApplicationFirewallSettings: { - serializedName: "webApplicationFirewallSettings", - type: { - name: "Composite", - className: "WebApplicationFirewallSettings", - }, - }, - }, - }, - }; - -export const NginxDeploymentListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NginxDeploymentListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NginxDeployment", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const OperationListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationResult", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const OperationResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationResult", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay", - }, - }, - isDataAction: { - serializedName: "isDataAction", - type: { - name: "Boolean", - }, - }, - }, - }, -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - type: { - name: "String", - }, - }, - resource: { - serializedName: "resource", - type: { - name: "String", - }, - }, - operation: { - serializedName: "operation", - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - type: { - name: "String", - }, - }, - }, - }, -}; diff --git a/sdk/nginx/arm-nginx/src/models/models.ts b/sdk/nginx/arm-nginx/src/models/models.ts new file mode 100644 index 000000000000..7d3fd0c5e4a7 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/models/models.ts @@ -0,0 +1,2053 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { areAllPropsUndefined } from "../static-helpers/serialization/check-prop-undefined.js"; +import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util"; + +/** + * This file contains only generated model types and their (de)serializers. + * Disable the following rules for internal models with '_' prefix and deserializers which require 'any' for raw JSON input. + */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface _OperationListResult { + /** The Operation items on this page */ + value: Operation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _operationListResultDeserializer(item: any): _OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + readonly actionType?: ActionType; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + +/** Localized display information for an operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + readonly provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + readonly resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + readonly operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +export enum KnownOrigin { + /** Indicates the operation is initiated by a user. */ + User = "user", + /** Indicates the operation is initiated by a system. */ + System = "system", + /** Indicates the operation is initiated by a user or system. */ + UserSystem = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. + */ +export type Origin = string; + +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +export enum KnownActionType { + /** Actions are for internal-only APIs. */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal**: Actions are for internal-only APIs. + */ +export type ActionType = string; + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + }; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] ? item["details"] : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: any; +} + +export function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo { + return { + type: item["type"], + info: item["info"], + }; +} + +/** Nginx Deployment Api Key Response */ +export interface NginxDeploymentApiKeyResponse extends ProxyResource { + /** Nginx Deployment Api Key Response Properties */ + properties?: NginxDeploymentApiKeyResponseProperties; +} + +export function nginxDeploymentApiKeyResponseDeserializer( + item: any, +): NginxDeploymentApiKeyResponse { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : nginxDeploymentApiKeyResponsePropertiesDeserializer(item["properties"]), + }; +} + +/** Nginx Deployment Api Key Response Properties */ +export interface NginxDeploymentApiKeyResponseProperties { + /** The first three characters of the secret text to help identify it in use. This property is read-only. */ + readonly hint?: string; + /** The time after which this Dataplane API Key is no longer valid. */ + endDateTime?: Date; +} + +export function nginxDeploymentApiKeyResponsePropertiesDeserializer( + item: any, +): NginxDeploymentApiKeyResponseProperties { + return { + hint: item["hint"], + endDateTime: !item["endDateTime"] ? item["endDateTime"] : new Date(item["endDateTime"]), + }; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(item: ProxyResource): any { + return item; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** Nginx Deployment Api Key Request */ +export interface NginxDeploymentApiKeyRequest { + readonly id?: string; + readonly name?: string; + readonly type?: string; + /** Nginx Deployment Api Key Request Properties */ + properties?: NginxDeploymentApiKeyRequestProperties; + /** Metadata pertaining to creation and last modification of the resource. */ + readonly systemData?: SystemData; +} + +export function nginxDeploymentApiKeyRequestSerializer(item: NginxDeploymentApiKeyRequest): any { + return { + properties: !item["properties"] + ? item["properties"] + : nginxDeploymentApiKeyRequestPropertiesSerializer(item["properties"]), + }; +} + +/** Nginx Deployment Api Key Request Properties */ +export interface NginxDeploymentApiKeyRequestProperties { + /** Secret text to be used as a Dataplane API Key. This is a write only property that can never be read back, but the first three characters will be returned in the 'hint' property. */ + secretText?: string; + /** The time after which this Dataplane API Key is no longer valid. */ + endDateTime?: Date; +} + +export function nginxDeploymentApiKeyRequestPropertiesSerializer( + item: NginxDeploymentApiKeyRequestProperties, +): any { + return { + secretText: item["secretText"], + endDateTime: !item["endDateTime"] ? item["endDateTime"] : item["endDateTime"].toISOString(), + }; +} + +/** Nginx Deployment Api Key List Response */ +export interface _NginxDeploymentApiKeyListResponse { + /** The NginxDeploymentApiKeyResponse items on this page */ + value: NginxDeploymentApiKeyResponse[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _nginxDeploymentApiKeyListResponseDeserializer( + item: any, +): _NginxDeploymentApiKeyListResponse { + return { + value: nginxDeploymentApiKeyResponseArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function nginxDeploymentApiKeyResponseArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return nginxDeploymentApiKeyResponseDeserializer(item); + }); +} + +/** Nginx Deployment */ +export interface NginxDeployment extends TrackedResource { + /** Nginx Deployment Properties */ + properties?: NginxDeploymentProperties; + /** Identity Properties */ + identity?: IdentityProperties; + /** Resource Sku */ + sku?: ResourceSku; +} + +export function nginxDeploymentSerializer(item: NginxDeployment): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : nginxDeploymentPropertiesSerializer(item["properties"]), + identity: !item["identity"] ? item["identity"] : identityPropertiesSerializer(item["identity"]), + sku: !item["sku"] ? item["sku"] : resourceSkuSerializer(item["sku"]), + }; +} + +export function nginxDeploymentDeserializer(item: any): NginxDeployment { + return { + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : nginxDeploymentPropertiesDeserializer(item["properties"]), + identity: !item["identity"] + ? item["identity"] + : identityPropertiesDeserializer(item["identity"]), + sku: !item["sku"] ? item["sku"] : resourceSkuDeserializer(item["sku"]), + }; +} + +/** Nginx Deployment Properties */ +export interface NginxDeploymentProperties { + /** Provisioning State */ + readonly provisioningState?: ProvisioningState; + readonly nginxVersion?: string; + /** Nginx Network Profile */ + networkProfile?: NginxNetworkProfile; + /** The IP address of the deployment. */ + readonly ipAddress?: string; + enableDiagnosticsSupport?: boolean; + /** Nginx Logging */ + logging?: NginxLogging; + /** Information on how the deployment will be scaled. */ + scalingProperties?: NginxDeploymentScalingProperties; + /** Autoupgrade settings of a deployment. */ + autoUpgradeProfile?: AutoUpgradeProfile; + /** Nginx Deployment User Profile */ + userProfile?: NginxDeploymentUserProfile; + /** Settings for NGINX App Protect (NAP) */ + nginxAppProtect?: NginxDeploymentPropertiesNginxAppProtect; + /** Dataplane API endpoint for the caller to update the NGINX state of the deployment. */ + readonly dataplaneApiEndpoint?: string; +} + +export function nginxDeploymentPropertiesSerializer(item: NginxDeploymentProperties): any { + return { + networkProfile: !item["networkProfile"] + ? item["networkProfile"] + : nginxNetworkProfileSerializer(item["networkProfile"]), + enableDiagnosticsSupport: item["enableDiagnosticsSupport"], + logging: !item["logging"] ? item["logging"] : nginxLoggingSerializer(item["logging"]), + scalingProperties: !item["scalingProperties"] + ? item["scalingProperties"] + : nginxDeploymentScalingPropertiesSerializer(item["scalingProperties"]), + autoUpgradeProfile: !item["autoUpgradeProfile"] + ? item["autoUpgradeProfile"] + : autoUpgradeProfileSerializer(item["autoUpgradeProfile"]), + userProfile: !item["userProfile"] + ? item["userProfile"] + : nginxDeploymentUserProfileSerializer(item["userProfile"]), + nginxAppProtect: !item["nginxAppProtect"] + ? item["nginxAppProtect"] + : nginxDeploymentPropertiesNginxAppProtectSerializer(item["nginxAppProtect"]), + }; +} + +export function nginxDeploymentPropertiesDeserializer(item: any): NginxDeploymentProperties { + return { + provisioningState: item["provisioningState"], + nginxVersion: item["nginxVersion"], + networkProfile: !item["networkProfile"] + ? item["networkProfile"] + : nginxNetworkProfileDeserializer(item["networkProfile"]), + ipAddress: item["ipAddress"], + enableDiagnosticsSupport: item["enableDiagnosticsSupport"], + logging: !item["logging"] ? item["logging"] : nginxLoggingDeserializer(item["logging"]), + scalingProperties: !item["scalingProperties"] + ? item["scalingProperties"] + : nginxDeploymentScalingPropertiesDeserializer(item["scalingProperties"]), + autoUpgradeProfile: !item["autoUpgradeProfile"] + ? item["autoUpgradeProfile"] + : autoUpgradeProfileDeserializer(item["autoUpgradeProfile"]), + userProfile: !item["userProfile"] + ? item["userProfile"] + : nginxDeploymentUserProfileDeserializer(item["userProfile"]), + nginxAppProtect: !item["nginxAppProtect"] + ? item["nginxAppProtect"] + : nginxDeploymentPropertiesNginxAppProtectDeserializer(item["nginxAppProtect"]), + dataplaneApiEndpoint: item["dataplaneApiEndpoint"], + }; +} + +/** Provisioning State */ +export enum KnownProvisioningState { + /** Accepted */ + Accepted = "Accepted", + /** Creating */ + Creating = "Creating", + /** Updating */ + Updating = "Updating", + /** Deleting */ + Deleting = "Deleting", + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed", + /** Canceled */ + Canceled = "Canceled", + /** Deleted */ + Deleted = "Deleted", + /** NotSpecified */ + NotSpecified = "NotSpecified", +} + +/** + * Provisioning State \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted** \ + * **Creating** \ + * **Updating** \ + * **Deleting** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Deleted** \ + * **NotSpecified** + */ +export type ProvisioningState = string; + +/** Nginx Network Profile */ +export interface NginxNetworkProfile { + /** Nginx Frontend IP Configuration */ + frontEndIPConfiguration?: NginxFrontendIPConfiguration; + /** Nginx Network Interface Configuration */ + networkInterfaceConfiguration?: NginxNetworkInterfaceConfiguration; +} + +export function nginxNetworkProfileSerializer(item: NginxNetworkProfile): any { + return { + frontEndIPConfiguration: !item["frontEndIPConfiguration"] + ? item["frontEndIPConfiguration"] + : nginxFrontendIPConfigurationSerializer(item["frontEndIPConfiguration"]), + networkInterfaceConfiguration: !item["networkInterfaceConfiguration"] + ? item["networkInterfaceConfiguration"] + : nginxNetworkInterfaceConfigurationSerializer(item["networkInterfaceConfiguration"]), + }; +} + +export function nginxNetworkProfileDeserializer(item: any): NginxNetworkProfile { + return { + frontEndIPConfiguration: !item["frontEndIPConfiguration"] + ? item["frontEndIPConfiguration"] + : nginxFrontendIPConfigurationDeserializer(item["frontEndIPConfiguration"]), + networkInterfaceConfiguration: !item["networkInterfaceConfiguration"] + ? item["networkInterfaceConfiguration"] + : nginxNetworkInterfaceConfigurationDeserializer(item["networkInterfaceConfiguration"]), + }; +} + +/** Nginx Frontend IP Configuration */ +export interface NginxFrontendIPConfiguration { + publicIPAddresses?: NginxPublicIPAddress[]; + privateIPAddresses?: NginxPrivateIPAddress[]; +} + +export function nginxFrontendIPConfigurationSerializer(item: NginxFrontendIPConfiguration): any { + return { + publicIPAddresses: !item["publicIPAddresses"] + ? item["publicIPAddresses"] + : nginxPublicIPAddressArraySerializer(item["publicIPAddresses"]), + privateIPAddresses: !item["privateIPAddresses"] + ? item["privateIPAddresses"] + : nginxPrivateIPAddressArraySerializer(item["privateIPAddresses"]), + }; +} + +export function nginxFrontendIPConfigurationDeserializer(item: any): NginxFrontendIPConfiguration { + return { + publicIPAddresses: !item["publicIPAddresses"] + ? item["publicIPAddresses"] + : nginxPublicIPAddressArrayDeserializer(item["publicIPAddresses"]), + privateIPAddresses: !item["privateIPAddresses"] + ? item["privateIPAddresses"] + : nginxPrivateIPAddressArrayDeserializer(item["privateIPAddresses"]), + }; +} + +export function nginxPublicIPAddressArraySerializer(result: Array): any[] { + return result.map((item) => { + return nginxPublicIPAddressSerializer(item); + }); +} + +export function nginxPublicIPAddressArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return nginxPublicIPAddressDeserializer(item); + }); +} + +/** Nginx Public IP Address */ +export interface NginxPublicIPAddress { + id?: string; +} + +export function nginxPublicIPAddressSerializer(item: NginxPublicIPAddress): any { + return { id: item["id"] }; +} + +export function nginxPublicIPAddressDeserializer(item: any): NginxPublicIPAddress { + return { + id: item["id"], + }; +} + +export function nginxPrivateIPAddressArraySerializer(result: Array): any[] { + return result.map((item) => { + return nginxPrivateIPAddressSerializer(item); + }); +} + +export function nginxPrivateIPAddressArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return nginxPrivateIPAddressDeserializer(item); + }); +} + +/** Nginx Private IP Address */ +export interface NginxPrivateIPAddress { + privateIPAddress?: string; + /** Nginx Private IP Allocation Method */ + privateIPAllocationMethod?: NginxPrivateIPAllocationMethod; + subnetId?: string; +} + +export function nginxPrivateIPAddressSerializer(item: NginxPrivateIPAddress): any { + return { + privateIPAddress: item["privateIPAddress"], + privateIPAllocationMethod: item["privateIPAllocationMethod"], + subnetId: item["subnetId"], + }; +} + +export function nginxPrivateIPAddressDeserializer(item: any): NginxPrivateIPAddress { + return { + privateIPAddress: item["privateIPAddress"], + privateIPAllocationMethod: item["privateIPAllocationMethod"], + subnetId: item["subnetId"], + }; +} + +/** Nginx Private IP Allocation Method */ +export enum KnownNginxPrivateIPAllocationMethod { + /** Static */ + Static = "Static", + /** Dynamic */ + Dynamic = "Dynamic", +} + +/** + * Nginx Private IP Allocation Method \ + * {@link KnownNginxPrivateIPAllocationMethod} can be used interchangeably with NginxPrivateIPAllocationMethod, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Static** \ + * **Dynamic** + */ +export type NginxPrivateIPAllocationMethod = string; + +/** Nginx Network Interface Configuration */ +export interface NginxNetworkInterfaceConfiguration { + subnetId?: string; +} + +export function nginxNetworkInterfaceConfigurationSerializer( + item: NginxNetworkInterfaceConfiguration, +): any { + return { subnetId: item["subnetId"] }; +} + +export function nginxNetworkInterfaceConfigurationDeserializer( + item: any, +): NginxNetworkInterfaceConfiguration { + return { + subnetId: item["subnetId"], + }; +} + +/** Nginx Logging */ +export interface NginxLogging { + /** Nginx Storage Account */ + storageAccount?: NginxStorageAccount; +} + +export function nginxLoggingSerializer(item: NginxLogging): any { + return { + storageAccount: !item["storageAccount"] + ? item["storageAccount"] + : nginxStorageAccountSerializer(item["storageAccount"]), + }; +} + +export function nginxLoggingDeserializer(item: any): NginxLogging { + return { + storageAccount: !item["storageAccount"] + ? item["storageAccount"] + : nginxStorageAccountDeserializer(item["storageAccount"]), + }; +} + +/** Nginx Storage Account */ +export interface NginxStorageAccount { + accountName?: string; + containerName?: string; +} + +export function nginxStorageAccountSerializer(item: NginxStorageAccount): any { + return { accountName: item["accountName"], containerName: item["containerName"] }; +} + +export function nginxStorageAccountDeserializer(item: any): NginxStorageAccount { + return { + accountName: item["accountName"], + containerName: item["containerName"], + }; +} + +/** Information on how the deployment will be scaled. */ +export interface NginxDeploymentScalingProperties { + capacity?: number; + profiles?: ScaleProfile[]; +} + +export function nginxDeploymentScalingPropertiesSerializer( + item: NginxDeploymentScalingProperties, +): any { + return { + capacity: item["capacity"], + autoScaleSettings: areAllPropsUndefined(item, ["profiles"]) + ? undefined + : _nginxDeploymentScalingPropertiesAutoScaleSettingsSerializer(item), + }; +} + +export function nginxDeploymentScalingPropertiesDeserializer( + item: any, +): NginxDeploymentScalingProperties { + return { + capacity: item["capacity"], + ...(!item["autoScaleSettings"] + ? item["autoScaleSettings"] + : _nginxDeploymentScalingPropertiesAutoScaleSettingsDeserializer(item["autoScaleSettings"])), + }; +} + +/** The settings for enabling automatic scaling of the deployment. If this field is specified, 'scale.capacity' must be empty. */ +export interface NginxDeploymentScalingPropertiesAutoScaleSettings { + profiles: ScaleProfile[]; +} + +export function nginxDeploymentScalingPropertiesAutoScaleSettingsSerializer( + item: NginxDeploymentScalingPropertiesAutoScaleSettings, +): any { + return { profiles: scaleProfileArraySerializer(item["profiles"]) }; +} + +export function nginxDeploymentScalingPropertiesAutoScaleSettingsDeserializer( + item: any, +): NginxDeploymentScalingPropertiesAutoScaleSettings { + return { + profiles: scaleProfileArrayDeserializer(item["profiles"]), + }; +} + +export function scaleProfileArraySerializer(result: Array): any[] { + return result.map((item) => { + return scaleProfileSerializer(item); + }); +} + +export function scaleProfileArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return scaleProfileDeserializer(item); + }); +} + +/** The autoscale profile. */ +export interface ScaleProfile { + name: string; + /** The capacity parameters of the profile. */ + capacity: ScaleProfileCapacity; +} + +export function scaleProfileSerializer(item: ScaleProfile): any { + return { name: item["name"], capacity: scaleProfileCapacitySerializer(item["capacity"]) }; +} + +export function scaleProfileDeserializer(item: any): ScaleProfile { + return { + name: item["name"], + capacity: scaleProfileCapacityDeserializer(item["capacity"]), + }; +} + +/** The capacity parameters of the profile. */ +export interface ScaleProfileCapacity { + /** The minimum number of NCUs the deployment can be autoscaled to. */ + min: number; + /** The maximum number of NCUs the deployment can be autoscaled to. */ + max: number; +} + +export function scaleProfileCapacitySerializer(item: ScaleProfileCapacity): any { + return { min: item["min"], max: item["max"] }; +} + +export function scaleProfileCapacityDeserializer(item: any): ScaleProfileCapacity { + return { + min: item["min"], + max: item["max"], + }; +} + +/** Autoupgrade settings of a deployment. */ +export interface AutoUpgradeProfile { + /** Channel used for autoupgrade. */ + upgradeChannel: string; +} + +export function autoUpgradeProfileSerializer(item: AutoUpgradeProfile): any { + return { upgradeChannel: item["upgradeChannel"] }; +} + +export function autoUpgradeProfileDeserializer(item: any): AutoUpgradeProfile { + return { + upgradeChannel: item["upgradeChannel"], + }; +} + +/** Nginx Deployment User Profile */ +export interface NginxDeploymentUserProfile { + /** The preferred support contact email address of the user used for sending alerts and notification. Can be an empty string or a valid email address. */ + preferredEmail?: string; +} + +export function nginxDeploymentUserProfileSerializer(item: NginxDeploymentUserProfile): any { + return { preferredEmail: item["preferredEmail"] }; +} + +export function nginxDeploymentUserProfileDeserializer(item: any): NginxDeploymentUserProfile { + return { + preferredEmail: item["preferredEmail"], + }; +} + +/** Settings for NGINX App Protect (NAP) */ +export interface NginxDeploymentPropertiesNginxAppProtect { + /** Settings for the NGINX App Protect Web Application Firewall (WAF) */ + webApplicationFirewallSettings: WebApplicationFirewallSettings; + /** The status of the NGINX App Protect Web Application Firewall */ + readonly webApplicationFirewallStatus?: WebApplicationFirewallStatus; +} + +export function nginxDeploymentPropertiesNginxAppProtectSerializer( + item: NginxDeploymentPropertiesNginxAppProtect, +): any { + return { + webApplicationFirewallSettings: webApplicationFirewallSettingsSerializer( + item["webApplicationFirewallSettings"], + ), + }; +} + +export function nginxDeploymentPropertiesNginxAppProtectDeserializer( + item: any, +): NginxDeploymentPropertiesNginxAppProtect { + return { + webApplicationFirewallSettings: webApplicationFirewallSettingsDeserializer( + item["webApplicationFirewallSettings"], + ), + webApplicationFirewallStatus: !item["webApplicationFirewallStatus"] + ? item["webApplicationFirewallStatus"] + : webApplicationFirewallStatusDeserializer(item["webApplicationFirewallStatus"]), + }; +} + +/** Settings for the NGINX App Protect Web Application Firewall (WAF) */ +export interface WebApplicationFirewallSettings { + /** The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it. */ + activationState?: ActivationState; +} + +export function webApplicationFirewallSettingsSerializer( + item: WebApplicationFirewallSettings, +): any { + return { activationState: item["activationState"] }; +} + +export function webApplicationFirewallSettingsDeserializer( + item: any, +): WebApplicationFirewallSettings { + return { + activationState: item["activationState"], + }; +} + +/** The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it. */ +export enum KnownActivationState { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * The activation state of the WAF. Use 'Enabled' to enable the WAF and 'Disabled' to disable it. \ + * {@link KnownActivationState} can be used interchangeably with ActivationState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type ActivationState = string; + +/** The status of the NGINX App Protect Web Application Firewall */ +export interface WebApplicationFirewallStatus { + /** NGINX App Protect WAF release version */ + wafRelease?: string; + /** Package containing attack signatures for the NGINX App Protect Web Application Firewall (WAF). */ + readonly attackSignaturesPackage?: WebApplicationFirewallPackage; + /** Package containing bot signatures for the NGINX App Protect Web Application Firewall (WAF). */ + readonly botSignaturesPackage?: WebApplicationFirewallPackage; + /** Package containing threat campaigns for the NGINX App Protect Web Application Firewall (WAF). */ + readonly threatCampaignsPackage?: WebApplicationFirewallPackage; + /** Versions of the NGINX App Protect Web Application Firewall (WAF) components. */ + readonly componentVersions?: WebApplicationFirewallComponentVersions; +} + +export function webApplicationFirewallStatusDeserializer(item: any): WebApplicationFirewallStatus { + return { + wafRelease: item["wafRelease"], + attackSignaturesPackage: !item["attackSignaturesPackage"] + ? item["attackSignaturesPackage"] + : webApplicationFirewallPackageDeserializer(item["attackSignaturesPackage"]), + botSignaturesPackage: !item["botSignaturesPackage"] + ? item["botSignaturesPackage"] + : webApplicationFirewallPackageDeserializer(item["botSignaturesPackage"]), + threatCampaignsPackage: !item["threatCampaignsPackage"] + ? item["threatCampaignsPackage"] + : webApplicationFirewallPackageDeserializer(item["threatCampaignsPackage"]), + componentVersions: !item["componentVersions"] + ? item["componentVersions"] + : webApplicationFirewallComponentVersionsDeserializer(item["componentVersions"]), + }; +} + +/** NGINX App Protect Web Application Firewall (WAF) Package. Contains the version and revision date of the package. */ +export interface WebApplicationFirewallPackage { + /** The version of the NGINX App Protect Web Application Firewall (WAF) package. */ + version: string; + /** The date and time of the package revision. */ + revisionDatetime: Date; +} + +export function webApplicationFirewallPackageDeserializer( + item: any, +): WebApplicationFirewallPackage { + return { + version: item["version"], + revisionDatetime: new Date(item["revisionDatetime"]), + }; +} + +/** Versions of the NGINX App Protect Web Application Firewall (WAF) components. */ +export interface WebApplicationFirewallComponentVersions { + /** The version of the NGINX App Protect Web Application Firewall (WAF) engine. */ + wafEngineVersion: string; + /** The version of the NGINX App Protect Web Application Firewall (WAF) module for NGINX. */ + wafNginxVersion: string; +} + +export function webApplicationFirewallComponentVersionsDeserializer( + item: any, +): WebApplicationFirewallComponentVersions { + return { + wafEngineVersion: item["wafEngineVersion"], + wafNginxVersion: item["wafNginxVersion"], + }; +} + +/** Identity Properties */ +export interface IdentityProperties { + readonly principalId?: string; + readonly tenantId?: string; + /** Identity Type */ + type?: IdentityType; + /** Dictionary of */ + userAssignedIdentities?: Record; +} + +export function identityPropertiesSerializer(item: IdentityProperties): any { + return { + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userIdentityPropertiesRecordSerializer(item["userAssignedIdentities"]), + }; +} + +export function identityPropertiesDeserializer(item: any): IdentityProperties { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userIdentityPropertiesRecordDeserializer(item["userAssignedIdentities"]), + }; +} + +/** Identity Type */ +export enum KnownIdentityType { + /** SystemAssigned */ + SystemAssigned = "SystemAssigned", + /** UserAssigned */ + UserAssigned = "UserAssigned", + /** SystemAssigned, UserAssigned */ + SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", + /** None */ + None = "None", +} + +/** + * Identity Type \ + * {@link KnownIdentityType} can be used interchangeably with IdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SystemAssigned** \ + * **UserAssigned** \ + * **SystemAssigned, UserAssigned** \ + * **None** + */ +export type IdentityType = string; + +export function userIdentityPropertiesRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : userIdentityPropertiesSerializer(item[key]); + }); + return result; +} + +export function userIdentityPropertiesRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : userIdentityPropertiesDeserializer(item[key]); + }); + return result; +} + +/** User Identity Properties */ +export interface UserIdentityProperties { + readonly principalId?: string; + readonly clientId?: string; +} + +export function userIdentityPropertiesSerializer(item: UserIdentityProperties): any { + return item; +} + +export function userIdentityPropertiesDeserializer(item: any): UserIdentityProperties { + return { + principalId: item["principalId"], + clientId: item["clientId"], + }; +} + +/** Resource Sku */ +export interface ResourceSku { + /** Name of the SKU. */ + name: string; +} + +export function resourceSkuSerializer(item: ResourceSku): any { + return { name: item["name"] }; +} + +export function resourceSkuDeserializer(item: any): ResourceSku { + return { + name: item["name"], + }; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + location: item["location"], + }; +} + +/** Nginx Deployment Update Parameters */ +export interface NginxDeploymentUpdateParameters { + /** Identity Properties */ + identity?: IdentityProperties; + /** Dictionary of */ + tags?: Record; + /** Resource Sku */ + sku?: ResourceSku; + /** The geo-location where the resource lives */ + location?: string; + /** Nginx Deployment Update Properties */ + properties?: NginxDeploymentUpdateProperties; +} + +export function nginxDeploymentUpdateParametersSerializer( + item: NginxDeploymentUpdateParameters, +): any { + return { + identity: !item["identity"] ? item["identity"] : identityPropertiesSerializer(item["identity"]), + tags: item["tags"], + sku: !item["sku"] ? item["sku"] : resourceSkuSerializer(item["sku"]), + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : nginxDeploymentUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** Nginx Deployment Update Properties */ +export interface NginxDeploymentUpdateProperties { + enableDiagnosticsSupport?: boolean; + /** Nginx Logging */ + logging?: NginxLogging; + /** Information on how the deployment will be scaled. */ + scalingProperties?: NginxDeploymentScalingProperties; + /** Nginx Deployment User Profile */ + userProfile?: NginxDeploymentUserProfile; + /** Nginx Network Profile */ + networkProfile?: NginxNetworkProfile; + /** Autoupgrade settings of a deployment. */ + autoUpgradeProfile?: AutoUpgradeProfile; + /** Settings for the NGINX App Protect Web Application Firewall (WAF) */ + webApplicationFirewallSettings?: WebApplicationFirewallSettings; +} + +export function nginxDeploymentUpdatePropertiesSerializer( + item: NginxDeploymentUpdateProperties, +): any { + return { + enableDiagnosticsSupport: item["enableDiagnosticsSupport"], + logging: !item["logging"] ? item["logging"] : nginxLoggingSerializer(item["logging"]), + scalingProperties: !item["scalingProperties"] + ? item["scalingProperties"] + : nginxDeploymentScalingPropertiesSerializer(item["scalingProperties"]), + userProfile: !item["userProfile"] + ? item["userProfile"] + : nginxDeploymentUserProfileSerializer(item["userProfile"]), + networkProfile: !item["networkProfile"] + ? item["networkProfile"] + : nginxNetworkProfileSerializer(item["networkProfile"]), + autoUpgradeProfile: !item["autoUpgradeProfile"] + ? item["autoUpgradeProfile"] + : autoUpgradeProfileSerializer(item["autoUpgradeProfile"]), + nginxAppProtect: areAllPropsUndefined(item, ["webApplicationFirewallSettings"]) + ? undefined + : _nginxDeploymentUpdatePropertiesNginxAppProtectSerializer(item), + }; +} + +/** Update settings for NGINX App Protect (NAP) */ +export interface NginxDeploymentUpdatePropertiesNginxAppProtect { + /** Settings for the NGINX App Protect Web Application Firewall (WAF) */ + webApplicationFirewallSettings?: WebApplicationFirewallSettings; +} + +export function nginxDeploymentUpdatePropertiesNginxAppProtectSerializer( + item: NginxDeploymentUpdatePropertiesNginxAppProtect, +): any { + return { + webApplicationFirewallSettings: !item["webApplicationFirewallSettings"] + ? item["webApplicationFirewallSettings"] + : webApplicationFirewallSettingsSerializer(item["webApplicationFirewallSettings"]), + }; +} + +/** Nginx Deployment List Response */ +export interface _NginxDeploymentListResponse { + /** The NginxDeployment items on this page */ + value: NginxDeployment[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _nginxDeploymentListResponseDeserializer(item: any): _NginxDeploymentListResponse { + return { + value: nginxDeploymentArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function nginxDeploymentArraySerializer(result: Array): any[] { + return result.map((item) => { + return nginxDeploymentSerializer(item); + }); +} + +export function nginxDeploymentArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return nginxDeploymentDeserializer(item); + }); +} + +/** Nginx Deployment Waf Policy List Response */ +export interface _NginxDeploymentWafPolicyListResponse { + /** The NginxDeploymentWafPolicyMetadata items on this page */ + value: NginxDeploymentWafPolicyMetadata[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _nginxDeploymentWafPolicyListResponseDeserializer( + item: any, +): _NginxDeploymentWafPolicyListResponse { + return { + value: nginxDeploymentWafPolicyMetadataArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function nginxDeploymentWafPolicyMetadataArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return nginxDeploymentWafPolicyMetadataDeserializer(item); + }); +} + +/** Nginx Deployment Waf Policy Metadata */ +export interface NginxDeploymentWafPolicyMetadata { + readonly id?: string; + readonly name?: string; + readonly type?: string; + /** Nginx Deployment Waf Policy Metadata Properties */ + properties?: NginxDeploymentWafPolicyMetadataProperties; + /** Metadata pertaining to creation and last modification of the resource. */ + readonly systemData?: SystemData; +} + +export function nginxDeploymentWafPolicyMetadataDeserializer( + item: any, +): NginxDeploymentWafPolicyMetadata { + return { + id: item["id"], + name: item["name"], + type: item["type"], + properties: !item["properties"] + ? item["properties"] + : nginxDeploymentWafPolicyMetadataPropertiesDeserializer(item["properties"]), + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Nginx Deployment Waf Policy Metadata Properties */ +export interface NginxDeploymentWafPolicyMetadataProperties { + readonly filepath?: string; + /** Provisioning State */ + readonly provisioningState?: ProvisioningState; + /** Nginx Deployment Waf Policy Compiling Status */ + readonly compilingState?: NginxDeploymentWafPolicyCompilingStatus; + /** Nginx Deployment Waf Policy Applying Status */ + readonly applyingState?: NginxDeploymentWafPolicyApplyingStatus; +} + +export function nginxDeploymentWafPolicyMetadataPropertiesDeserializer( + item: any, +): NginxDeploymentWafPolicyMetadataProperties { + return { + filepath: item["filepath"], + provisioningState: item["provisioningState"], + compilingState: !item["compilingState"] + ? item["compilingState"] + : nginxDeploymentWafPolicyCompilingStatusDeserializer(item["compilingState"]), + applyingState: !item["applyingState"] + ? item["applyingState"] + : nginxDeploymentWafPolicyApplyingStatusDeserializer(item["applyingState"]), + }; +} + +/** Nginx Deployment Waf Policy Compiling Status */ +export interface NginxDeploymentWafPolicyCompilingStatus { + /** Machine readable code indicating the compilation status of a WAF Policy. */ + readonly code?: NginxDeploymentWafPolicyCompilingStatusCode; + /** A readable string of the current status, and sometimes have the reason for the current state. If the CompilingStatus is Failed the Display Status will be The waf Policy failed to compile. */ + readonly displayStatus?: string; + /** The date and time the policy was compiled in UTC. */ + readonly time?: string; +} + +export function nginxDeploymentWafPolicyCompilingStatusDeserializer( + item: any, +): NginxDeploymentWafPolicyCompilingStatus { + return { + code: item["code"], + displayStatus: item["displayStatus"], + time: item["time"], + }; +} + +/** Machine readable code indicating the compilation status of a WAF Policy. */ +export enum KnownNginxDeploymentWafPolicyCompilingStatusCode { + /** The compilation of the custom waf policy has not started */ + NotStarted = "NotStarted", + /** The compilation of the custom waf policy is in progress */ + InProgress = "InProgress", + /** The compilation of the custom waf policy is completed successfully and can now be referenced in the nginx config. */ + Succeeded = "Succeeded", + /** The compilation of the custom waf policy failed. */ + Failed = "Failed", +} + +/** + * Machine readable code indicating the compilation status of a WAF Policy. \ + * {@link KnownNginxDeploymentWafPolicyCompilingStatusCode} can be used interchangeably with NginxDeploymentWafPolicyCompilingStatusCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotStarted**: The compilation of the custom waf policy has not started \ + * **InProgress**: The compilation of the custom waf policy is in progress \ + * **Succeeded**: The compilation of the custom waf policy is completed successfully and can now be referenced in the nginx config. \ + * **Failed**: The compilation of the custom waf policy failed. + */ +export type NginxDeploymentWafPolicyCompilingStatusCode = string; + +/** Nginx Deployment Waf Policy Applying Status */ +export interface NginxDeploymentWafPolicyApplyingStatus { + /** Machine readable code indicating the applying status code of a WAF Policy. */ + readonly code?: NginxDeploymentWafPolicyApplyingStatusCode; + /** A readable string of the current status, and sometimes have the reason for the current state. */ + readonly displayStatus?: string; + /** The date and time in UTC the current applying status was set. */ + readonly time?: string; +} + +export function nginxDeploymentWafPolicyApplyingStatusDeserializer( + item: any, +): NginxDeploymentWafPolicyApplyingStatus { + return { + code: item["code"], + displayStatus: item["displayStatus"], + time: item["time"], + }; +} + +/** Machine readable code indicating the applying status code of a WAF Policy. */ +export enum KnownNginxDeploymentWafPolicyApplyingStatusCode { + /** The policy is not referenced in the nginx config and not applied. */ + NotApplied = "NotApplied", + /** The policy is referenced in the nginx config and is applying. */ + Applying = "Applying", + /** The policy is referenced in the nginx config and that config has been successfully applied. */ + Succeeded = "Succeeded", + /** The policy is referenced in the nginx config and that config failed to apply. */ + Failed = "Failed", + /** The policy is now not referenced in the nginx config and its being removed from the applied nginx config. */ + Removing = "Removing", +} + +/** + * Machine readable code indicating the applying status code of a WAF Policy. \ + * {@link KnownNginxDeploymentWafPolicyApplyingStatusCode} can be used interchangeably with NginxDeploymentWafPolicyApplyingStatusCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotApplied**: The policy is not referenced in the nginx config and not applied. \ + * **Applying**: The policy is referenced in the nginx config and is applying. \ + * **Succeeded**: The policy is referenced in the nginx config and that config has been successfully applied. \ + * **Failed**: The policy is referenced in the nginx config and that config failed to apply. \ + * **Removing**: The policy is now not referenced in the nginx config and its being removed from the applied nginx config. + */ +export type NginxDeploymentWafPolicyApplyingStatusCode = string; + +/** Nginx Deployment Waf Policy */ +export interface NginxDeploymentWafPolicy extends ProxyResource { + /** Nginx Deployment Waf Policy Properties */ + properties?: NginxDeploymentWafPolicyProperties; +} + +export function nginxDeploymentWafPolicySerializer(item: NginxDeploymentWafPolicy): any { + return { + properties: !item["properties"] + ? item["properties"] + : nginxDeploymentWafPolicyPropertiesSerializer(item["properties"]), + }; +} + +export function nginxDeploymentWafPolicyDeserializer(item: any): NginxDeploymentWafPolicy { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : nginxDeploymentWafPolicyPropertiesDeserializer(item["properties"]), + }; +} + +/** Nginx Deployment Waf Policy Properties */ +export interface NginxDeploymentWafPolicyProperties { + /** Provisioning State */ + readonly provisioningState?: ProvisioningState; + /** The byte content of the Policy */ + content?: Uint8Array; + /** The file path where the Policy is to be saved */ + filepath?: string; + /** Nginx Deployment Waf Policy Compiling Status */ + readonly compilingState?: NginxDeploymentWafPolicyCompilingStatus; + /** Nginx Deployment Waf Policy Applying Status */ + readonly applyingState?: NginxDeploymentWafPolicyApplyingStatus; +} + +export function nginxDeploymentWafPolicyPropertiesSerializer( + item: NginxDeploymentWafPolicyProperties, +): any { + return { + content: !item["content"] ? item["content"] : uint8ArrayToString(item["content"], "base64"), + filepath: item["filepath"], + }; +} + +export function nginxDeploymentWafPolicyPropertiesDeserializer( + item: any, +): NginxDeploymentWafPolicyProperties { + return { + provisioningState: item["provisioningState"], + content: !item["content"] + ? item["content"] + : typeof item["content"] === "string" + ? stringToUint8Array(item["content"], "base64") + : item["content"], + filepath: item["filepath"], + compilingState: !item["compilingState"] + ? item["compilingState"] + : nginxDeploymentWafPolicyCompilingStatusDeserializer(item["compilingState"]), + applyingState: !item["applyingState"] + ? item["applyingState"] + : nginxDeploymentWafPolicyApplyingStatusDeserializer(item["applyingState"]), + }; +} + +/** Nginx Deployment Default Waf Policy List Response */ +export interface NginxDeploymentDefaultWafPolicyListResponse { + value?: NginxDeploymentDefaultWafPolicyProperties[]; + nextLink?: string; +} + +export function nginxDeploymentDefaultWafPolicyListResponseDeserializer( + item: any, +): NginxDeploymentDefaultWafPolicyListResponse { + return { + value: !item["value"] + ? item["value"] + : nginxDeploymentDefaultWafPolicyPropertiesArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function nginxDeploymentDefaultWafPolicyPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return nginxDeploymentDefaultWafPolicyPropertiesDeserializer(item); + }); +} + +/** Nginx Deployment Default Waf Policy Properties */ +export interface NginxDeploymentDefaultWafPolicyProperties { + readonly content?: Uint8Array; + readonly filepath?: string; +} + +export function nginxDeploymentDefaultWafPolicyPropertiesDeserializer( + item: any, +): NginxDeploymentDefaultWafPolicyProperties { + return { + content: !item["content"] + ? item["content"] + : typeof item["content"] === "string" + ? stringToUint8Array(item["content"], "base64") + : item["content"], + filepath: item["filepath"], + }; +} + +/** Nginx Certificate */ +export interface NginxCertificate extends ProxyResource { + /** Nginx Certificate Properties */ + properties?: NginxCertificateProperties; + /** The geo-location where the resource lives */ + location?: string; +} + +export function nginxCertificateSerializer(item: NginxCertificate): any { + return { + properties: !item["properties"] + ? item["properties"] + : nginxCertificatePropertiesSerializer(item["properties"]), + location: item["location"], + }; +} + +export function nginxCertificateDeserializer(item: any): NginxCertificate { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : nginxCertificatePropertiesDeserializer(item["properties"]), + location: item["location"], + }; +} + +/** Nginx Certificate Properties */ +export interface NginxCertificateProperties { + /** Provisioning State */ + readonly provisioningState?: ProvisioningState; + keyVirtualPath?: string; + certificateVirtualPath?: string; + keyVaultSecretId?: string; + readonly sha1Thumbprint?: string; + readonly keyVaultSecretVersion?: string; + readonly keyVaultSecretCreated?: Date; + /** Nginx Certificate Error Response Body */ + certificateError?: NginxCertificateErrorResponseBody; +} + +export function nginxCertificatePropertiesSerializer(item: NginxCertificateProperties): any { + return { + keyVirtualPath: item["keyVirtualPath"], + certificateVirtualPath: item["certificateVirtualPath"], + keyVaultSecretId: item["keyVaultSecretId"], + certificateError: !item["certificateError"] + ? item["certificateError"] + : nginxCertificateErrorResponseBodySerializer(item["certificateError"]), + }; +} + +export function nginxCertificatePropertiesDeserializer(item: any): NginxCertificateProperties { + return { + provisioningState: item["provisioningState"], + keyVirtualPath: item["keyVirtualPath"], + certificateVirtualPath: item["certificateVirtualPath"], + keyVaultSecretId: item["keyVaultSecretId"], + sha1Thumbprint: item["sha1Thumbprint"], + keyVaultSecretVersion: item["keyVaultSecretVersion"], + keyVaultSecretCreated: !item["keyVaultSecretCreated"] + ? item["keyVaultSecretCreated"] + : new Date(item["keyVaultSecretCreated"]), + certificateError: !item["certificateError"] + ? item["certificateError"] + : nginxCertificateErrorResponseBodyDeserializer(item["certificateError"]), + }; +} + +/** Nginx Certificate Error Response Body */ +export interface NginxCertificateErrorResponseBody { + code?: string; + message?: string; +} + +export function nginxCertificateErrorResponseBodySerializer( + item: NginxCertificateErrorResponseBody, +): any { + return { code: item["code"], message: item["message"] }; +} + +export function nginxCertificateErrorResponseBodyDeserializer( + item: any, +): NginxCertificateErrorResponseBody { + return { + code: item["code"], + message: item["message"], + }; +} + +/** Nginx Certificate List Response */ +export interface _NginxCertificateListResponse { + /** The NginxCertificate items on this page */ + value: NginxCertificate[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _nginxCertificateListResponseDeserializer( + item: any, +): _NginxCertificateListResponse { + return { + value: nginxCertificateArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function nginxCertificateArraySerializer(result: Array): any[] { + return result.map((item) => { + return nginxCertificateSerializer(item); + }); +} + +export function nginxCertificateArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return nginxCertificateDeserializer(item); + }); +} + +/** Nginx Configuration Response */ +export interface NginxConfiguration extends ProxyResource { + /** Nginx Configuration Response Properties */ + properties?: NginxConfigurationProperties; +} + +export function nginxConfigurationDeserializer(item: any): NginxConfiguration { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : nginxConfigurationPropertiesDeserializer(item["properties"]), + }; +} + +/** Nginx Configuration Response Properties */ +export interface NginxConfigurationProperties { + /** Provisioning State */ + readonly provisioningState?: ProvisioningState; + files?: NginxConfigurationFile[]; + protectedFiles?: NginxConfigurationProtectedFileResponse[]; + /** Nginx Configuration Package */ + package?: NginxConfigurationPackage; + rootFile?: string; +} + +export function nginxConfigurationPropertiesDeserializer(item: any): NginxConfigurationProperties { + return { + provisioningState: item["provisioningState"], + files: !item["files"] ? item["files"] : nginxConfigurationFileArrayDeserializer(item["files"]), + protectedFiles: !item["protectedFiles"] + ? item["protectedFiles"] + : nginxConfigurationProtectedFileResponseArrayDeserializer(item["protectedFiles"]), + package: !item["package"] + ? item["package"] + : nginxConfigurationPackageDeserializer(item["package"]), + rootFile: item["rootFile"], + }; +} + +export function nginxConfigurationFileArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return nginxConfigurationFileSerializer(item); + }); +} + +export function nginxConfigurationFileArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return nginxConfigurationFileDeserializer(item); + }); +} + +/** Nginx Configuration File */ +export interface NginxConfigurationFile { + content?: string; + virtualPath?: string; +} + +export function nginxConfigurationFileSerializer(item: NginxConfigurationFile): any { + return { content: item["content"], virtualPath: item["virtualPath"] }; +} + +export function nginxConfigurationFileDeserializer(item: any): NginxConfigurationFile { + return { + content: item["content"], + virtualPath: item["virtualPath"], + }; +} + +export function nginxConfigurationProtectedFileResponseArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return nginxConfigurationProtectedFileResponseDeserializer(item); + }); +} + +/** Nginx Configuration Protected File Response */ +export interface NginxConfigurationProtectedFileResponse { + /** The virtual path of the protected file. */ + virtualPath?: string; + /** The hash of the content of the file. This value is used to determine if the file has changed. */ + contentHash?: string; +} + +export function nginxConfigurationProtectedFileResponseDeserializer( + item: any, +): NginxConfigurationProtectedFileResponse { + return { + virtualPath: item["virtualPath"], + contentHash: item["contentHash"], + }; +} + +/** Nginx Configuration Package */ +export interface NginxConfigurationPackage { + data?: string; + protectedFiles?: string[]; +} + +export function nginxConfigurationPackageSerializer(item: NginxConfigurationPackage): any { + return { + data: item["data"], + protectedFiles: !item["protectedFiles"] + ? item["protectedFiles"] + : item["protectedFiles"].map((p: any) => { + return p; + }), + }; +} + +export function nginxConfigurationPackageDeserializer(item: any): NginxConfigurationPackage { + return { + data: item["data"], + protectedFiles: !item["protectedFiles"] + ? item["protectedFiles"] + : item["protectedFiles"].map((p: any) => { + return p; + }), + }; +} + +/** Nginx Configuration Request */ +export interface NginxConfigurationRequest { + readonly id?: string; + readonly name?: string; + readonly type?: string; + /** Nginx Configuration Request Properties */ + properties?: NginxConfigurationRequestProperties; + /** Metadata pertaining to creation and last modification of the resource. */ + readonly systemData?: SystemData; +} + +export function nginxConfigurationRequestSerializer(item: NginxConfigurationRequest): any { + return { + properties: !item["properties"] + ? item["properties"] + : nginxConfigurationRequestPropertiesSerializer(item["properties"]), + }; +} + +/** Nginx Configuration Request Properties */ +export interface NginxConfigurationRequestProperties { + /** Provisioning State */ + readonly provisioningState?: ProvisioningState; + files?: NginxConfigurationFile[]; + protectedFiles?: NginxConfigurationProtectedFileRequest[]; + /** Nginx Configuration Package */ + package?: NginxConfigurationPackage; + rootFile?: string; +} + +export function nginxConfigurationRequestPropertiesSerializer( + item: NginxConfigurationRequestProperties, +): any { + return { + files: !item["files"] ? item["files"] : nginxConfigurationFileArraySerializer(item["files"]), + protectedFiles: !item["protectedFiles"] + ? item["protectedFiles"] + : nginxConfigurationProtectedFileRequestArraySerializer(item["protectedFiles"]), + package: !item["package"] + ? item["package"] + : nginxConfigurationPackageSerializer(item["package"]), + rootFile: item["rootFile"], + }; +} + +export function nginxConfigurationProtectedFileRequestArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return nginxConfigurationProtectedFileRequestSerializer(item); + }); +} + +/** Nginx Configuration Protected File Request */ +export interface NginxConfigurationProtectedFileRequest { + /** The content of the protected file. This value is a PUT only value. If you perform a GET request on this value, it will be empty because it is a protected file. */ + content?: string; + /** The virtual path of the protected file. */ + virtualPath?: string; + /** The hash of the content of the file. This value is used to determine if the file has changed. */ + contentHash?: string; +} + +export function nginxConfigurationProtectedFileRequestSerializer( + item: NginxConfigurationProtectedFileRequest, +): any { + return { + content: item["content"], + virtualPath: item["virtualPath"], + contentHash: item["contentHash"], + }; +} + +/** Response of a list operation. */ +export interface _NginxConfigurationListResponse { + /** The NginxConfigurationResponse items on this page */ + value: NginxConfiguration[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _nginxConfigurationListResponseDeserializer( + item: any, +): _NginxConfigurationListResponse { + return { + value: nginxConfigurationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function nginxConfigurationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return nginxConfigurationDeserializer(item); + }); +} + +/** The request body for creating an analysis for an NGINX configuration. */ +export interface AnalysisCreate { + config: AnalysisCreateConfig; +} + +export function analysisCreateSerializer(item: AnalysisCreate): any { + return { config: analysisCreateConfigSerializer(item["config"]) }; +} + +/** model interface AnalysisCreateConfig */ +export interface AnalysisCreateConfig { + /** The root file of the NGINX config file(s). It must match one of the files' filepath. */ + rootFile?: string; + files?: NginxConfigurationFile[]; + protectedFiles?: NginxConfigurationProtectedFileRequest[]; + /** Nginx Configuration Package */ + package?: NginxConfigurationPackage; +} + +export function analysisCreateConfigSerializer(item: AnalysisCreateConfig): any { + return { + rootFile: item["rootFile"], + files: !item["files"] ? item["files"] : nginxConfigurationFileArraySerializer(item["files"]), + protectedFiles: !item["protectedFiles"] + ? item["protectedFiles"] + : nginxConfigurationProtectedFileRequestArraySerializer(item["protectedFiles"]), + package: !item["package"] + ? item["package"] + : nginxConfigurationPackageSerializer(item["package"]), + }; +} + +/** The response body for an analysis request. Contains the status of the analysis and any errors. */ +export interface AnalysisResult { + /** The status of the analysis. */ + status: string; + data?: AnalysisResultData; +} + +export function analysisResultDeserializer(item: any): AnalysisResult { + return { + status: item["status"], + data: !item["data"] ? item["data"] : analysisResultDataDeserializer(item["data"]), + }; +} + +/** model interface AnalysisResultData */ +export interface AnalysisResultData { + errors?: AnalysisDiagnostic[]; + diagnostics?: DiagnosticItem[]; +} + +export function analysisResultDataDeserializer(item: any): AnalysisResultData { + return { + errors: !item["errors"] ? item["errors"] : analysisDiagnosticArrayDeserializer(item["errors"]), + diagnostics: !item["diagnostics"] + ? item["diagnostics"] + : diagnosticItemArrayDeserializer(item["diagnostics"]), + }; +} + +export function analysisDiagnosticArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return analysisDiagnosticDeserializer(item); + }); +} + +/** An error object found during the analysis of an NGINX configuration. */ +export interface AnalysisDiagnostic { + /** Unique identifier for the error */ + id?: string; + directive: string; + description: string; + /** the filepath of the most relevant config file */ + file: string; + line: number; + message: string; + rule: string; +} + +export function analysisDiagnosticDeserializer(item: any): AnalysisDiagnostic { + return { + id: item["id"], + directive: item["directive"], + description: item["description"], + file: item["file"], + line: item["line"], + message: item["message"], + rule: item["rule"], + }; +} + +export function diagnosticItemArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return diagnosticItemDeserializer(item); + }); +} + +/** A diagnostic is a message associated with an NGINX config. The Analyzer returns diagnostics with a level indicating the importance of the diagnostic with optional category. */ +export interface DiagnosticItem { + /** Unique identifier for the diagnostic. */ + id?: string; + directive: string; + description: string; + /** The filepath of the most relevant config file. */ + file: string; + line: number; + message: string; + rule: string; + /** Warning or Info */ + level: Level; + /** Category of warning like Best-practices, Recommendation, Security etc. */ + category?: string; +} + +export function diagnosticItemDeserializer(item: any): DiagnosticItem { + return { + id: item["id"], + directive: item["directive"], + description: item["description"], + file: item["file"], + line: item["line"], + message: item["message"], + rule: item["rule"], + level: item["level"], + category: item["category"], + }; +} + +/** Warning or Info */ +export enum KnownLevel { + /** Info */ + Info = "Info", + /** Warning */ + Warning = "Warning", +} + +/** + * Warning or Info \ + * {@link KnownLevel} can be used interchangeably with Level, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Info** \ + * **Warning** + */ +export type Level = string; + +/** The available API versions. */ +export enum KnownVersions { + /** The 2025-03-01-preview API version. */ + V20250301Preview = "2025-03-01-preview", +} + +export function _nginxDeploymentScalingPropertiesAutoScaleSettingsSerializer( + item: NginxDeploymentScalingProperties, +): any { + return { + profiles: !item["profiles"] ? item["profiles"] : scaleProfileArraySerializer(item["profiles"]), + }; +} + +export function _nginxDeploymentScalingPropertiesAutoScaleSettingsDeserializer(item: any) { + return { + profiles: !item["profiles"] + ? item["profiles"] + : scaleProfileArrayDeserializer(item["profiles"]), + }; +} + +export function _nginxDeploymentUpdatePropertiesNginxAppProtectSerializer( + item: NginxDeploymentUpdateProperties, +): any { + return { + webApplicationFirewallSettings: !item["webApplicationFirewallSettings"] + ? item["webApplicationFirewallSettings"] + : webApplicationFirewallSettingsSerializer(item["webApplicationFirewallSettings"]), + }; +} diff --git a/sdk/nginx/arm-nginx/src/models/parameters.ts b/sdk/nginx/arm-nginx/src/models/parameters.ts deleted file mode 100644 index 2085ddb4e2e3..000000000000 --- a/sdk/nginx/arm-nginx/src/models/parameters.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - OperationParameter, - OperationURLParameter, - OperationQueryParameter, -} from "@azure/core-client"; -import { - NginxDeploymentApiKeyRequest as NginxDeploymentApiKeyRequestMapper, - NginxCertificate as NginxCertificateMapper, - NginxConfigurationRequest as NginxConfigurationRequestMapper, - AnalysisCreate as AnalysisCreateMapper, - NginxDeployment as NginxDeploymentMapper, - NginxDeploymentUpdateParameters as NginxDeploymentUpdateParametersMapper, -} from "../models/mappers.js"; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String", - }, - }, -}; - -export const body: OperationParameter = { - parameterPath: ["options", "body"], - mapper: NginxDeploymentApiKeyRequestMapper, -}; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String", - }, - }, -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const subscriptionId: OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - serializedName: "subscriptionId", - required: true, - type: { - name: "Uuid", - }, - }, -}; - -export const resourceGroupName: OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - constraints: { - MaxLength: 90, - MinLength: 1, - }, - serializedName: "resourceGroupName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const deploymentName: OperationURLParameter = { - parameterPath: "deploymentName", - mapper: { - constraints: { - Pattern: new RegExp( - "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - }, - serializedName: "deploymentName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const apiKeyName: OperationURLParameter = { - parameterPath: "apiKeyName", - mapper: { - constraints: { - Pattern: new RegExp( - "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", - ), - }, - serializedName: "apiKeyName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2024-11-01-preview", - isConstant: true, - serializedName: "api-version", - type: { - name: "String", - }, - }, -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const certificateName: OperationURLParameter = { - parameterPath: "certificateName", - mapper: { - serializedName: "certificateName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const body1: OperationParameter = { - parameterPath: ["options", "body"], - mapper: NginxCertificateMapper, -}; - -export const configurationName: OperationURLParameter = { - parameterPath: "configurationName", - mapper: { - serializedName: "configurationName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const body2: OperationParameter = { - parameterPath: ["options", "body"], - mapper: NginxConfigurationRequestMapper, -}; - -export const body3: OperationParameter = { - parameterPath: ["options", "body"], - mapper: AnalysisCreateMapper, -}; - -export const configurationName1: OperationURLParameter = { - parameterPath: "configurationName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-z][a-z0-9]*$"), - }, - serializedName: "configurationName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const body4: OperationParameter = { - parameterPath: ["options", "body"], - mapper: NginxDeploymentMapper, -}; - -export const body5: OperationParameter = { - parameterPath: ["options", "body"], - mapper: NginxDeploymentUpdateParametersMapper, -}; diff --git a/sdk/nginx/arm-nginx/src/nginxManagementClient.ts b/sdk/nginx/arm-nginx/src/nginxManagementClient.ts index 55a18a2bb9ba..0183bb1dbee7 100644 --- a/sdk/nginx/arm-nginx/src/nginxManagementClient.ts +++ b/sdk/nginx/arm-nginx/src/nginxManagementClient.ts @@ -1,161 +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 * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; -import { - PipelineRequest, - PipelineResponse, - SendRequest, -} from "@azure/core-rest-pipeline"; -import * as coreAuth from "@azure/core-auth"; -import { - ApiKeysImpl, - CertificatesImpl, - ConfigurationsImpl, - DeploymentsImpl, - OperationsImpl, -} from "./operations/index.js"; -import { - ApiKeys, - Certificates, - Configurations, - Deployments, - Operations, -} from "./operationsInterfaces/index.js"; -import { NginxManagementClientOptionalParams } from "./models/index.js"; +import type { NginxManagementContext, NginxManagementClientOptionalParams } from "./api/index.js"; +import { createNginxManagement } from "./api/index.js"; +import type { ApiKeysOperations } from "./classic/apiKeys/index.js"; +import { _getApiKeysOperations } from "./classic/apiKeys/index.js"; +import type { CertificatesOperations } from "./classic/certificates/index.js"; +import { _getCertificatesOperations } from "./classic/certificates/index.js"; +import type { ConfigurationsOperations } from "./classic/configurations/index.js"; +import { _getConfigurationsOperations } from "./classic/configurations/index.js"; +import type { DefaultWafPolicyOperations } from "./classic/defaultWafPolicy/index.js"; +import { _getDefaultWafPolicyOperations } from "./classic/defaultWafPolicy/index.js"; +import type { DeploymentsOperations } from "./classic/deployments/index.js"; +import { _getDeploymentsOperations } from "./classic/deployments/index.js"; +import type { OperationsOperations } from "./classic/operations/index.js"; +import { _getOperationsOperations } from "./classic/operations/index.js"; +import type { WafPolicyOperations } from "./classic/wafPolicy/index.js"; +import { _getWafPolicyOperations } from "./classic/wafPolicy/index.js"; +import type { TokenCredential } from "@azure/core-auth"; +import type { Pipeline } from "@azure/core-rest-pipeline"; -export class NginxManagementClient extends coreClient.ServiceClient { - $host: string; - subscriptionId: string; - apiVersion: string; +export { NginxManagementClientOptionalParams } from "./api/nginxManagementContext.js"; + +export class NginxManagementClient { + private _client: NginxManagementContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; - /** - * Initializes a new instance of the NginxManagementClient class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param options The parameter options - */ constructor( - credentials: coreAuth.TokenCredential, + credential: TokenCredential, subscriptionId: string, - options?: NginxManagementClientOptionalParams, + options: NginxManagementClientOptionalParams = {}, ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } - if (subscriptionId === undefined) { - throw new Error("'subscriptionId' cannot be null"); - } - - // Initializing default values for options - if (!options) { - options = {}; - } - const defaults: NginxManagementClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials, - }; - - const packageDetails = `azsdk-js-arm-nginx/4.0.0-beta.2`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createNginxManagement(credential, subscriptionId, { ...options, - userAgentOptions: { - userAgentPrefix, - }, - endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com", - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = - options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName, - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName, - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? - `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge, - }, - }), - ); - } - // Parameter assignments - this.subscriptionId = subscriptionId; - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2024-11-01-preview"; - this.apiKeys = new ApiKeysImpl(this); - this.certificates = new CertificatesImpl(this); - this.configurations = new ConfigurationsImpl(this); - this.deployments = new DeploymentsImpl(this); - this.operations = new OperationsImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest( - request: PipelineRequest, - next: SendRequest, - ): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - }, - }; - this.pipeline.addPolicy(apiVersionPolicy); + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.configurations = _getConfigurationsOperations(this._client); + this.certificates = _getCertificatesOperations(this._client); + this.defaultWafPolicy = _getDefaultWafPolicyOperations(this._client); + this.wafPolicy = _getWafPolicyOperations(this._client); + this.deployments = _getDeploymentsOperations(this._client); + this.apiKeys = _getApiKeysOperations(this._client); + this.operations = _getOperationsOperations(this._client); } - apiKeys: ApiKeys; - certificates: Certificates; - configurations: Configurations; - deployments: Deployments; - operations: Operations; + /** The operation groups for configurations */ + public readonly configurations: ConfigurationsOperations; + /** The operation groups for certificates */ + public readonly certificates: CertificatesOperations; + /** The operation groups for defaultWafPolicy */ + public readonly defaultWafPolicy: DefaultWafPolicyOperations; + /** The operation groups for wafPolicy */ + public readonly wafPolicy: WafPolicyOperations; + /** The operation groups for deployments */ + public readonly deployments: DeploymentsOperations; + /** The operation groups for apiKeys */ + public readonly apiKeys: ApiKeysOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; } diff --git a/sdk/nginx/arm-nginx/src/operations/apiKeys.ts b/sdk/nginx/arm-nginx/src/operations/apiKeys.ts deleted file mode 100644 index a168f0b77090..000000000000 --- a/sdk/nginx/arm-nginx/src/operations/apiKeys.ts +++ /dev/null @@ -1,325 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { ApiKeys } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { NginxManagementClient } from "../nginxManagementClient.js"; -import { - NginxDeploymentApiKeyResponse, - ApiKeysListNextOptionalParams, - ApiKeysListOptionalParams, - ApiKeysListResponse, - ApiKeysCreateOrUpdateOptionalParams, - ApiKeysCreateOrUpdateResponse, - ApiKeysDeleteOptionalParams, - ApiKeysGetOptionalParams, - ApiKeysGetResponse, - ApiKeysListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing ApiKeys operations. */ -export class ApiKeysImpl implements ApiKeys { - private readonly client: NginxManagementClient; - - /** - * Initialize a new instance of the class ApiKeys class. - * @param client Reference to the service client - */ - constructor(client: NginxManagementClient) { - this.client = client; - } - - /** - * List all API Keys of the given Nginx deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - deploymentName: string, - options?: ApiKeysListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(resourceGroupName, deploymentName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - resourceGroupName, - deploymentName, - options, - settings, - ); - }, - }; - } - - private async *listPagingPage( - resourceGroupName: string, - deploymentName: string, - options?: ApiKeysListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ApiKeysListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(resourceGroupName, deploymentName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - resourceGroupName, - deploymentName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - resourceGroupName: string, - deploymentName: string, - options?: ApiKeysListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - resourceGroupName, - deploymentName, - options, - )) { - yield* page; - } - } - - /** - * Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param apiKeyName The resource name of the API key - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - deploymentName: string, - apiKeyName: string, - options?: ApiKeysCreateOrUpdateOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, apiKeyName, options }, - createOrUpdateOperationSpec, - ); - } - - /** - * Delete API key for Nginx deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param apiKeyName The resource name of the API key - * @param options The options parameters. - */ - delete( - resourceGroupName: string, - deploymentName: string, - apiKeyName: string, - options?: ApiKeysDeleteOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, apiKeyName, options }, - deleteOperationSpec, - ); - } - - /** - * Get the specified API Key of the given Nginx deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param apiKeyName The resource name of the API key - * @param options The options parameters. - */ - get( - resourceGroupName: string, - deploymentName: string, - apiKeyName: string, - options?: ApiKeysGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, apiKeyName, options }, - getOperationSpec, - ); - } - - /** - * List all API Keys of the given Nginx deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - deploymentName: string, - options?: ApiKeysListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, options }, - listOperationSpec, - ); - } - - /** - * ListNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - resourceGroupName: string, - deploymentName: string, - nextLink: string, - options?: ApiKeysListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.NginxDeploymentApiKeyResponse, - }, - 201: { - bodyMapper: Mappers.NginxDeploymentApiKeyResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.body, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.apiKeyName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.apiKeyName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys/{apiKeyName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxDeploymentApiKeyResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.apiKeyName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/apiKeys", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxDeploymentApiKeyListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxDeploymentApiKeyListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/nginx/arm-nginx/src/operations/certificates.ts b/sdk/nginx/arm-nginx/src/operations/certificates.ts deleted file mode 100644 index b36c5d0a4b09..000000000000 --- a/sdk/nginx/arm-nginx/src/operations/certificates.ts +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Certificates } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { NginxManagementClient } from "../nginxManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - NginxCertificate, - CertificatesListNextOptionalParams, - CertificatesListOptionalParams, - CertificatesListResponse, - CertificatesGetOptionalParams, - CertificatesGetResponse, - CertificatesCreateOrUpdateOptionalParams, - CertificatesCreateOrUpdateResponse, - CertificatesDeleteOptionalParams, - CertificatesListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Certificates operations. */ -export class CertificatesImpl implements Certificates { - private readonly client: NginxManagementClient; - - /** - * Initialize a new instance of the class Certificates class. - * @param client Reference to the service client - */ - constructor(client: NginxManagementClient) { - this.client = client; - } - - /** - * List all certificates of given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - deploymentName: string, - options?: CertificatesListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(resourceGroupName, deploymentName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - resourceGroupName, - deploymentName, - options, - settings, - ); - }, - }; - } - - private async *listPagingPage( - resourceGroupName: string, - deploymentName: string, - options?: CertificatesListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CertificatesListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(resourceGroupName, deploymentName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - resourceGroupName, - deploymentName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - resourceGroupName: string, - deploymentName: string, - options?: CertificatesListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - resourceGroupName, - deploymentName, - options, - )) { - yield* page; - } - } - - /** - * Get a certificate of given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - get( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, certificateName, options }, - getOperationSpec, - ); - } - - /** - * Create or update the NGINX certificates for given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - CertificatesCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, deploymentName, certificateName, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - CertificatesCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create or update the NGINX certificates for given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - deploymentName, - certificateName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Deletes a certificate from the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, deploymentName, certificateName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Deletes a certificate from the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - deploymentName, - certificateName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * List all certificates of given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - deploymentName: string, - options?: CertificatesListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, options }, - listOperationSpec, - ); - } - - /** - * ListNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - resourceGroupName: string, - deploymentName: string, - nextLink: string, - options?: CertificatesListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxCertificate, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.certificateName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.NginxCertificate, - }, - 201: { - bodyMapper: Mappers.NginxCertificate, - }, - 202: { - bodyMapper: Mappers.NginxCertificate, - }, - 204: { - bodyMapper: Mappers.NginxCertificate, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.body1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.certificateName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.certificateName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxCertificateListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxCertificateListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/nginx/arm-nginx/src/operations/configurations.ts b/sdk/nginx/arm-nginx/src/operations/configurations.ts deleted file mode 100644 index ce5419552ec2..000000000000 --- a/sdk/nginx/arm-nginx/src/operations/configurations.ts +++ /dev/null @@ -1,533 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Configurations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { NginxManagementClient } from "../nginxManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - NginxConfigurationResponse, - ConfigurationsListNextOptionalParams, - ConfigurationsListOptionalParams, - ConfigurationsListResponse, - ConfigurationsGetOptionalParams, - ConfigurationsGetResponse, - ConfigurationsCreateOrUpdateOptionalParams, - ConfigurationsCreateOrUpdateResponse, - ConfigurationsDeleteOptionalParams, - ConfigurationsAnalysisOptionalParams, - ConfigurationsAnalysisResponse, - ConfigurationsListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Configurations operations. */ -export class ConfigurationsImpl implements Configurations { - private readonly client: NginxManagementClient; - - /** - * Initialize a new instance of the class Configurations class. - * @param client Reference to the service client - */ - constructor(client: NginxManagementClient) { - this.client = client; - } - - /** - * List the NGINX configuration of given NGINX deployment. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - deploymentName: string, - options?: ConfigurationsListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(resourceGroupName, deploymentName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - resourceGroupName, - deploymentName, - options, - settings, - ); - }, - }; - } - - private async *listPagingPage( - resourceGroupName: string, - deploymentName: string, - options?: ConfigurationsListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ConfigurationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(resourceGroupName, deploymentName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - resourceGroupName, - deploymentName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - resourceGroupName: string, - deploymentName: string, - options?: ConfigurationsListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - resourceGroupName, - deploymentName, - options, - )) { - yield* page; - } - } - - /** - * List the NGINX configuration of given NGINX deployment. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - deploymentName: string, - options?: ConfigurationsListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, options }, - listOperationSpec, - ); - } - - /** - * Get the NGINX configuration of given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - get( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, configurationName, options }, - getOperationSpec, - ); - } - - /** - * Create or update the NGINX configuration for given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ConfigurationsCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, deploymentName, configurationName, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - ConfigurationsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create or update the NGINX configuration for given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - deploymentName, - configurationName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Reset the NGINX configuration of given NGINX deployment to default - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, deploymentName, configurationName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Reset the NGINX configuration of given NGINX deployment to default - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - deploymentName, - configurationName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Analyze an NGINX configuration without applying it to the NGINXaaS deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - analysis( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsAnalysisOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, configurationName, options }, - analysisOperationSpec, - ); - } - - /** - * ListNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - resourceGroupName: string, - deploymentName: string, - nextLink: string, - options?: ConfigurationsListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxConfigurationListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxConfigurationResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.configurationName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.NginxConfigurationResponse, - }, - 201: { - bodyMapper: Mappers.NginxConfigurationResponse, - }, - 202: { - bodyMapper: Mappers.NginxConfigurationResponse, - }, - 204: { - bodyMapper: Mappers.NginxConfigurationResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.body2, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.configurationName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.configurationName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const analysisOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.AnalysisResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.body3, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.configurationName1, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxConfigurationListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/nginx/arm-nginx/src/operations/deployments.ts b/sdk/nginx/arm-nginx/src/operations/deployments.ts deleted file mode 100644 index 1c3dd87ae62e..000000000000 --- a/sdk/nginx/arm-nginx/src/operations/deployments.ts +++ /dev/null @@ -1,695 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Deployments } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { NginxManagementClient } from "../nginxManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - NginxDeployment, - DeploymentsListNextOptionalParams, - DeploymentsListOptionalParams, - DeploymentsListResponse, - DeploymentsListByResourceGroupNextOptionalParams, - DeploymentsListByResourceGroupOptionalParams, - DeploymentsListByResourceGroupResponse, - DeploymentsGetOptionalParams, - DeploymentsGetResponse, - DeploymentsCreateOrUpdateOptionalParams, - DeploymentsCreateOrUpdateResponse, - DeploymentsUpdateOptionalParams, - DeploymentsUpdateResponse, - DeploymentsDeleteOptionalParams, - DeploymentsListNextResponse, - DeploymentsListByResourceGroupNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Deployments operations. */ -export class DeploymentsImpl implements Deployments { - private readonly client: NginxManagementClient; - - /** - * Initialize a new instance of the class Deployments class. - * @param client Reference to the service client - */ - constructor(client: NginxManagementClient) { - this.client = client; - } - - /** - * List the NGINX deployments resources - * @param options The options parameters. - */ - public list( - options?: DeploymentsListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - }, - }; - } - - private async *listPagingPage( - options?: DeploymentsListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: DeploymentsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: DeploymentsListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * List all NGINX deployments under the specified resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - public listByResourceGroup( - resourceGroupName: string, - options?: DeploymentsListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByResourceGroupPagingPage( - resourceGroupName, - options, - settings, - ); - }, - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroupName: string, - options?: DeploymentsListByResourceGroupOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: DeploymentsListByResourceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByResourceGroup(resourceGroupName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByResourceGroupNext( - resourceGroupName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByResourceGroupPagingAll( - resourceGroupName: string, - options?: DeploymentsListByResourceGroupOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage( - resourceGroupName, - options, - )) { - yield* page; - } - } - - /** - * Get the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - get( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, deploymentName, options }, - getOperationSpec, - ); - } - - /** - * Create or update the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeploymentsCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, deploymentName, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - DeploymentsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create or update the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - deploymentName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Update the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeploymentsUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, deploymentName, options }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - DeploymentsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Update the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - deploymentName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete the NGINX deployment resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, deploymentName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Delete the NGINX deployment resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - deploymentName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * List the NGINX deployments resources - * @param options The options parameters. - */ - private _list( - options?: DeploymentsListOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * List all NGINX deployments under the specified resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - private _listByResourceGroup( - resourceGroupName: string, - options?: DeploymentsListByResourceGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec, - ); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: DeploymentsListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec, - ); - } - - /** - * ListByResourceGroupNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. - * @param options The options parameters. - */ - private _listByResourceGroupNext( - resourceGroupName: string, - nextLink: string, - options?: DeploymentsListByResourceGroupNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxDeployment, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.NginxDeployment, - }, - 201: { - bodyMapper: Mappers.NginxDeployment, - }, - 202: { - bodyMapper: Mappers.NginxDeployment, - }, - 204: { - bodyMapper: Mappers.NginxDeployment, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.body4, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.NginxDeployment, - }, - 201: { - bodyMapper: Mappers.NginxDeployment, - }, - 202: { - bodyMapper: Mappers.NginxDeployment, - }, - 204: { - bodyMapper: Mappers.NginxDeployment, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.body5, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxDeploymentListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxDeploymentListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxDeploymentListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.NginxDeploymentListResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/nginx/arm-nginx/src/operations/index.ts b/sdk/nginx/arm-nginx/src/operations/index.ts deleted file mode 100644 index e5c75732300e..000000000000 --- a/sdk/nginx/arm-nginx/src/operations/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./apiKeys.js"; -export * from "./certificates.js"; -export * from "./configurations.js"; -export * from "./deployments.js"; -export * from "./operations.js"; diff --git a/sdk/nginx/arm-nginx/src/operations/operations.ts b/sdk/nginx/arm-nginx/src/operations/operations.ts deleted file mode 100644 index 806107727a10..000000000000 --- a/sdk/nginx/arm-nginx/src/operations/operations.ts +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Operations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { NginxManagementClient } from "../nginxManagementClient.js"; -import { - OperationResult, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: NginxManagementClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: NginxManagementClient) { - this.client = client; - } - - /** - * List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. - * @param options The options parameters. - */ - public list( - options?: OperationsListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - }, - }; - } - - private async *listPagingPage( - options?: OperationsListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: OperationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: OperationsListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. - * @param options The options parameters. - */ - private _list( - options?: OperationsListOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: OperationsListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Nginx.NginxPlus/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/nginx/arm-nginx/src/operationsInterfaces/apiKeys.ts b/sdk/nginx/arm-nginx/src/operationsInterfaces/apiKeys.ts deleted file mode 100644 index 354e105437de..000000000000 --- a/sdk/nginx/arm-nginx/src/operationsInterfaces/apiKeys.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - NginxDeploymentApiKeyResponse, - ApiKeysListOptionalParams, - ApiKeysCreateOrUpdateOptionalParams, - ApiKeysCreateOrUpdateResponse, - ApiKeysDeleteOptionalParams, - ApiKeysGetOptionalParams, - ApiKeysGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a ApiKeys. */ -export interface ApiKeys { - /** - * List all API Keys of the given Nginx deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - list( - resourceGroupName: string, - deploymentName: string, - options?: ApiKeysListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param apiKeyName The resource name of the API key - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - deploymentName: string, - apiKeyName: string, - options?: ApiKeysCreateOrUpdateOptionalParams, - ): Promise; - /** - * Delete API key for Nginx deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param apiKeyName The resource name of the API key - * @param options The options parameters. - */ - delete( - resourceGroupName: string, - deploymentName: string, - apiKeyName: string, - options?: ApiKeysDeleteOptionalParams, - ): Promise; - /** - * Get the specified API Key of the given Nginx deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param apiKeyName The resource name of the API key - * @param options The options parameters. - */ - get( - resourceGroupName: string, - deploymentName: string, - apiKeyName: string, - options?: ApiKeysGetOptionalParams, - ): Promise; -} diff --git a/sdk/nginx/arm-nginx/src/operationsInterfaces/certificates.ts b/sdk/nginx/arm-nginx/src/operationsInterfaces/certificates.ts deleted file mode 100644 index 6e3b78ffd049..000000000000 --- a/sdk/nginx/arm-nginx/src/operationsInterfaces/certificates.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - NginxCertificate, - CertificatesListOptionalParams, - CertificatesGetOptionalParams, - CertificatesGetResponse, - CertificatesCreateOrUpdateOptionalParams, - CertificatesCreateOrUpdateResponse, - CertificatesDeleteOptionalParams, -} from "../models/index.js"; - -/// -/** Interface representing a Certificates. */ -export interface Certificates { - /** - * List all certificates of given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - list( - resourceGroupName: string, - deploymentName: string, - options?: CertificatesListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a certificate of given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - get( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesGetOptionalParams, - ): Promise; - /** - * Create or update the NGINX certificates for given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - CertificatesCreateOrUpdateResponse - > - >; - /** - * Create or update the NGINX certificates for given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesCreateOrUpdateOptionalParams, - ): Promise; - /** - * Deletes a certificate from the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesDeleteOptionalParams, - ): Promise, void>>; - /** - * Deletes a certificate from the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param certificateName The name of certificate - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - deploymentName: string, - certificateName: string, - options?: CertificatesDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/nginx/arm-nginx/src/operationsInterfaces/configurations.ts b/sdk/nginx/arm-nginx/src/operationsInterfaces/configurations.ts deleted file mode 100644 index c38a55543ed9..000000000000 --- a/sdk/nginx/arm-nginx/src/operationsInterfaces/configurations.ts +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - NginxConfigurationResponse, - ConfigurationsListOptionalParams, - ConfigurationsGetOptionalParams, - ConfigurationsGetResponse, - ConfigurationsCreateOrUpdateOptionalParams, - ConfigurationsCreateOrUpdateResponse, - ConfigurationsDeleteOptionalParams, - ConfigurationsAnalysisOptionalParams, - ConfigurationsAnalysisResponse, -} from "../models/index.js"; - -/// -/** Interface representing a Configurations. */ -export interface Configurations { - /** - * List the NGINX configuration of given NGINX deployment. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - list( - resourceGroupName: string, - deploymentName: string, - options?: ConfigurationsListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get the NGINX configuration of given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - get( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsGetOptionalParams, - ): Promise; - /** - * Create or update the NGINX configuration for given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ConfigurationsCreateOrUpdateResponse - > - >; - /** - * Create or update the NGINX configuration for given NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsCreateOrUpdateOptionalParams, - ): Promise; - /** - * Reset the NGINX configuration of given NGINX deployment to default - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsDeleteOptionalParams, - ): Promise, void>>; - /** - * Reset the NGINX configuration of given NGINX deployment to default - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsDeleteOptionalParams, - ): Promise; - /** - * Analyze an NGINX configuration without applying it to the NGINXaaS deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param configurationName The name of configuration, only 'default' is supported value due to the - * singleton of NGINX conf - * @param options The options parameters. - */ - analysis( - resourceGroupName: string, - deploymentName: string, - configurationName: string, - options?: ConfigurationsAnalysisOptionalParams, - ): Promise; -} diff --git a/sdk/nginx/arm-nginx/src/operationsInterfaces/deployments.ts b/sdk/nginx/arm-nginx/src/operationsInterfaces/deployments.ts deleted file mode 100644 index 7bf3636f1878..000000000000 --- a/sdk/nginx/arm-nginx/src/operationsInterfaces/deployments.ts +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - NginxDeployment, - DeploymentsListOptionalParams, - DeploymentsListByResourceGroupOptionalParams, - DeploymentsGetOptionalParams, - DeploymentsGetResponse, - DeploymentsCreateOrUpdateOptionalParams, - DeploymentsCreateOrUpdateResponse, - DeploymentsUpdateOptionalParams, - DeploymentsUpdateResponse, - DeploymentsDeleteOptionalParams, -} from "../models/index.js"; - -/// -/** Interface representing a Deployments. */ -export interface Deployments { - /** - * List the NGINX deployments resources - * @param options The options parameters. - */ - list( - options?: DeploymentsListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * List all NGINX deployments under the specified resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - listByResourceGroup( - resourceGroupName: string, - options?: DeploymentsListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - get( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsGetOptionalParams, - ): Promise; - /** - * Create or update the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeploymentsCreateOrUpdateResponse - > - >; - /** - * Create or update the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsCreateOrUpdateOptionalParams, - ): Promise; - /** - * Update the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeploymentsUpdateResponse - > - >; - /** - * Update the NGINX deployment - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsUpdateOptionalParams, - ): Promise; - /** - * Delete the NGINX deployment resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsDeleteOptionalParams, - ): Promise, void>>; - /** - * Delete the NGINX deployment resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param deploymentName The name of targeted NGINX deployment - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - deploymentName: string, - options?: DeploymentsDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/nginx/arm-nginx/src/operationsInterfaces/index.ts b/sdk/nginx/arm-nginx/src/operationsInterfaces/index.ts deleted file mode 100644 index e5c75732300e..000000000000 --- a/sdk/nginx/arm-nginx/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./apiKeys.js"; -export * from "./certificates.js"; -export * from "./configurations.js"; -export * from "./deployments.js"; -export * from "./operations.js"; diff --git a/sdk/nginx/arm-nginx/src/operationsInterfaces/operations.ts b/sdk/nginx/arm-nginx/src/operationsInterfaces/operations.ts deleted file mode 100644 index 460847601c45..000000000000 --- a/sdk/nginx/arm-nginx/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { OperationResult, OperationsListOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * List all operations provided by Nginx.NginxPlus for the 2024-11-01-preview api version. - * @param options The options parameters. - */ - list( - options?: OperationsListOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/nginx/arm-nginx/src/pagingHelper.ts b/sdk/nginx/arm-nginx/src/pagingHelper.ts deleted file mode 100644 index 205cccc26592..000000000000 --- a/sdk/nginx/arm-nginx/src/pagingHelper.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken( - page: unknown, - continuationToken: string | undefined, -): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/nginx/arm-nginx/src/restorePollerHelpers.ts b/sdk/nginx/arm-nginx/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..5f9439614f44 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/restorePollerHelpers.ts @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { NginxManagementClient } from "./nginxManagementClient.js"; +import { + _$deleteDeserialize, + _createOrUpdateDeserialize, +} from "./api/configurations/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeCertificates, + _createOrUpdateDeserialize as _createOrUpdateDeserializeCertificates, +} from "./api/certificates/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeWafPolicy, + _createDeserialize, +} from "./api/wafPolicy/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeDeployments, + _updateDeserialize, + _createOrUpdateDeserialize as _createOrUpdateDeserializeDeployments, +} from "./api/deployments/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import type { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { PollerLike, OperationState, ResourceLocationConfig } from "@azure/core-lro"; +import { deserializeState } from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: NginxManagementClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + const apiVersion = getApiVersionFromUrl(initialRequestUrl); + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + apiVersion, + }, + ); +} + +interface DeserializationHelper { + deserializer: (result: PathUncheckedResponse) => Promise; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}": + { deserializer: _$deleteDeserialize, expectedStatuses: ["202", "204", "200"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}": + { deserializer: _createOrUpdateDeserialize, expectedStatuses: ["200", "201", "202"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}": + { deserializer: _$deleteDeserializeCertificates, expectedStatuses: ["202", "204", "200"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}": + { + deserializer: _createOrUpdateDeserializeCertificates, + expectedStatuses: ["200", "201", "202"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}": + { deserializer: _$deleteDeserializeWafPolicy, expectedStatuses: ["202", "204", "200"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/wafPolicies/{wafPolicyName}": + { deserializer: _createDeserialize, expectedStatuses: ["200", "201", "202"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}": + { deserializer: _$deleteDeserializeDeployments, expectedStatuses: ["202", "204", "200"] }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}": + { deserializer: _updateDeserialize, expectedStatuses: ["200", "202", "201"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}": + { + deserializer: _createOrUpdateDeserializeDeployments, + expectedStatuses: ["200", "201", "202"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} + +function getApiVersionFromUrl(urlStr: string): string | undefined { + const url = new URL(urlStr); + return url.searchParams.get("api-version") ?? undefined; +} diff --git a/sdk/nginx/arm-nginx/src/static-helpers/cloudSettingHelpers.ts b/sdk/nginx/arm-nginx/src/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 000000000000..613112c6e397 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * An enum to describe Azure Cloud environments. + * @enum {string} + */ +export enum AzureClouds { + /** Azure public cloud, which is the default cloud for Azure SDKs. */ + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + /** Azure China cloud */ + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + /** Azure US government cloud */ + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT", +} + +/** The supported values for cloud setting as a string literal type */ +export type AzureSupportedClouds = `${AzureClouds}`; + +/** + * Gets the Azure Resource Manager endpoint URL for the specified cloud setting. + * @param cloudSetting - The Azure cloud environment setting. Use one of the AzureClouds enum values. + * @returns The ARM endpoint URL for the specified cloud, or undefined if cloudSetting is undefined. + * @throws {Error} Throws an error if an unknown cloud setting is provided. + */ +export function getArmEndpoint(cloudSetting?: AzureSupportedClouds): string | undefined { + if (cloudSetting === undefined) { + return undefined; + } + const cloudEndpoints: Record = { + AZURE_CHINA_CLOUD: "https://management.chinacloudapi.cn/", + AZURE_US_GOVERNMENT: "https://management.usgovcloudapi.net/", + AZURE_PUBLIC_CLOUD: "https://management.azure.com/", + }; + if (cloudSetting in cloudEndpoints) { + return cloudEndpoints[cloudSetting]; + } else { + throw new Error( + `Unknown cloud setting: ${cloudSetting}. Please refer to the enum AzureClouds for possible values.`, + ); + } +} diff --git a/sdk/nginx/arm-nginx/src/static-helpers/pagingHelpers.ts b/sdk/nginx/arm-nginx/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..9258ba95eda8 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; + nextLinkMethod?: "GET" | "POST"; + apiVersion?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const nextLinkMethod = options.nextLinkMethod ?? "GET"; + const apiVersion = options.apiVersion; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + let result; + if (pageLink === undefined) { + result = await getInitialResponse(); + } else { + const resolvedPageLink = apiVersion ? addApiVersionToUrl(pageLink, apiVersion) : pageLink; + result = + nextLinkMethod === "POST" + ? await client.pathUnchecked(resolvedPageLink).post() + : await client.pathUnchecked(resolvedPageLink).get(); + } + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${ + Array.from(urlObj.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/nginx/arm-nginx/src/static-helpers/pollingHelpers.ts b/sdk/nginx/arm-nginx/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..8e36a866edcc --- /dev/null +++ b/sdk/nginx/arm-nginx/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + OperationResponse, +} from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; + /** + * The api-version of the LRO + */ + apiVersion?: string; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse, apiVersion } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + const pollingPath = apiVersion ? addApiVersionToUrl(path, apiVersion) : path; + response = await client.pathUnchecked(pollingPath).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${ + Array.from(urlObj.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/nginx/arm-nginx/src/static-helpers/serialization/check-prop-undefined.ts b/sdk/nginx/arm-nginx/src/static-helpers/serialization/check-prop-undefined.ts new file mode 100644 index 000000000000..50f78829e491 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/static-helpers/serialization/check-prop-undefined.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * Returns true if all specified properties of the item are undefined. + * @param item The object to check. + * @param properties The list of property names to check on the item. + * @returns True if all specified properties are undefined, otherwise false. + */ +export function areAllPropsUndefined(item: Record, properties: string[]): boolean { + for (const property of properties) { + if (item[property] !== undefined) { + return false; + } + } + return true; +} diff --git a/sdk/nginx/arm-nginx/src/static-helpers/simplePollerHelpers.ts b/sdk/nginx/arm-nginx/src/static-helpers/simplePollerHelpers.ts new file mode 100644 index 000000000000..f6996f3cee67 --- /dev/null +++ b/sdk/nginx/arm-nginx/src/static-helpers/simplePollerHelpers.ts @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PollerLike, OperationState, CancelOnProgress } from "@azure/core-lro"; +import type { AbortSignalLike } from "@azure/abort-controller"; + +/** + * A simple poller that can be used to poll a long running operation. + */ +export interface SimplePollerLike, TResult> { + /** + * Returns true if the poller has finished polling. + */ + isDone(): boolean; + /** + * Returns the state of the operation. + */ + getOperationState(): TState; + /** + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. + */ + getResult(): TResult | undefined; + /** + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + */ + poll(options?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Returns a promise that will resolve once the underlying operation is completed. + */ + pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. + */ + onProgress(callback: (state: TState) => void): CancelOnProgress; + + /** + * Returns a promise that could be used for serialized version of the poller's operation + * by invoking the operation's serialize method. + */ + serialize(): Promise; + + /** + * Wait the poller to be submitted. + */ + submitted(): Promise; + + /** + * Returns a string representation of the poller's operation. Similar to serialize but returns a string. + * @deprecated Use serialize() instead. + */ + toString(): string; + + /** + * Stops the poller from continuing to poll. Please note this will only stop the client-side polling + * @deprecated Use abortSignal to stop polling instead. + */ + stopPolling(): void; + + /** + * Returns true if the poller is stopped. + * @deprecated Use abortSignal status to track this instead. + */ + isStopped(): boolean; +} + +/** + * Create the deprecated SimplePollerLike from PollerLike + * @param poller PollerLike to convert + * @returns SimplePollerLike + */ +export function getSimplePoller( + poller: PollerLike, TResult>, +): SimplePollerLike, TResult> { + const simplePoller: SimplePollerLike, TResult> = { + isDone() { + return poller.isDone; + }, + isStopped() { + throw new Error("isStopped is deprecated. Use abortSignal status to track this instead."); + }, + getOperationState() { + if (!poller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return poller.operationState; + }, + getResult() { + return poller.result; + }, + toString() { + if (!poller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return JSON.stringify({ + state: poller.operationState, + }); + }, + stopPolling() { + throw new Error("stopPolling is deprecated. Use abortSignal to stop polling instead."); + }, + onProgress: poller.onProgress, + poll: poller.poll, + pollUntilDone: poller.pollUntilDone, + serialize: poller.serialize, + submitted: poller.submitted, + }; + return simplePoller; +} diff --git a/sdk/nginx/arm-nginx/src/static-helpers/urlTemplate.ts b/sdk/nginx/arm-nginx/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..c7109898692a --- /dev/null +++ b/sdk/nginx/arm-nginx/src/static-helpers/urlTemplate.ts @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// --------------------- +// interfaces +// --------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string): string { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string): string { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string): string { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any): boolean { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false): string { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions): string { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + if (named && val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions): string | undefined { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + const result = template.replace(/\{([^{}]+)\}|([^{}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + op = expr[0]; + expr = expr.slice(1); + } + const varList = expr.split(/,/g); + const result = []; + for (const varSpec of varList) { + const varMatch = /([^:*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: result.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + result.push(varValue); + } + } + return result.join(""); + }); + + return normalizeUnreserved(result); +} + +/** + * Normalize an expanded URI by decoding percent-encoded unreserved characters. + * RFC 3986 unreserved: "-" / "." / "~" + */ +function normalizeUnreserved(uri: string): string { + return uri.replace(/%([0-9A-Fa-f]{2})/g, (match, hex) => { + const char = String.fromCharCode(parseInt(hex, 16)); + // Decode only if it's unreserved + if (/[\-.~]/.test(char)) { + return char; + } + return match; // leave other encodings intact + }); +} diff --git a/sdk/nginx/arm-nginx/test/nginx_examples.spec.ts b/sdk/nginx/arm-nginx/test/nginx_examples.spec.ts index 15eaebfc0275..b792170f7cc9 100644 --- a/sdk/nginx/arm-nginx/test/nginx_examples.spec.ts +++ b/sdk/nginx/arm-nginx/test/nginx_examples.spec.ts @@ -48,7 +48,7 @@ describe("nginx test", () => { subscriptionId, recorder.configureClientOptions({}), ); - resourceGroup = "myjstest"; + resourceGroup = "SSS3PT_myjstest"; }); afterEach(async () => { diff --git a/sdk/nginx/arm-nginx/test/snippets.spec.ts b/sdk/nginx/arm-nginx/test/snippets.spec.ts index 3b0d78c66c70..32c09f5c44d5 100644 --- a/sdk/nginx/arm-nginx/test/snippets.spec.ts +++ b/sdk/nginx/arm-nginx/test/snippets.spec.ts @@ -13,11 +13,11 @@ describe("snippets", () => { }); it("ReadmeSampleCreateClient_Browser", async () => { - const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new NginxManagementClient(credential, subscriptionId); }); diff --git a/sdk/nginx/arm-nginx/tsconfig.json b/sdk/nginx/arm-nginx/tsconfig.json index d466f1460665..0e57dbd186e5 100644 --- a/sdk/nginx/arm-nginx/tsconfig.json +++ b/sdk/nginx/arm-nginx/tsconfig.json @@ -12,6 +12,5 @@ { "path": "./tsconfig.snippets.json" } - ], - "files": [] + ] } diff --git a/sdk/nginx/arm-nginx/tsconfig.samples.json b/sdk/nginx/arm-nginx/tsconfig.samples.json index ecdafb6f71ed..833787e0ebe3 100644 --- a/sdk/nginx/arm-nginx/tsconfig.samples.json +++ b/sdk/nginx/arm-nginx/tsconfig.samples.json @@ -2,9 +2,7 @@ "extends": "../../../tsconfig.samples.base.json", "compilerOptions": { "paths": { - "@azure/arm-nginx": [ - "./dist/esm" - ] + "@azure/arm-nginx": ["./dist/esm"] } } } diff --git a/sdk/nginx/arm-nginx/tsp-location.yaml b/sdk/nginx/arm-nginx/tsp-location.yaml new file mode 100644 index 000000000000..50fba8acbce2 --- /dev/null +++ b/sdk/nginx/arm-nginx/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/nginx/Nginx.Management +commit: 91b5db1facc51f4bf2b44afec16d79d8d92440f5 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/nginx/arm-nginx/vitest.config.ts b/sdk/nginx/arm-nginx/vitest.config.ts index cc5cd85d4131..0dfa15cc4498 100644 --- a/sdk/nginx/arm-nginx/vitest.config.ts +++ b/sdk/nginx/arm-nginx/vitest.config.ts @@ -1,4 +1,3 @@ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/sdk/nginx/arm-nginx/vitest.esm.config.ts b/sdk/nginx/arm-nginx/vitest.esm.config.ts new file mode 100644 index 000000000000..5e9735e9b144 --- /dev/null +++ b/sdk/nginx/arm-nginx/vitest.esm.config.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { mergeConfig } from "vitest/config"; +import vitestConfig from "./vitest.config.ts"; +import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; + +export default mergeConfig(vitestConfig, vitestEsmConfig); diff --git a/sdk/nginx/ci.mgmt.yml b/sdk/nginx/ci.mgmt.yml index 625d0d7ee64d..23f86079c09a 100644 --- a/sdk/nginx/ci.mgmt.yml +++ b/sdk/nginx/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -13,7 +13,6 @@ trigger: include: - sdk/nginx/arm-nginx - sdk/nginx/ci.mgmt.yml - pr: branches: include: @@ -27,7 +26,6 @@ pr: include: - sdk/nginx/arm-nginx - sdk/nginx/ci.mgmt.yml - extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -35,4 +33,3 @@ extends: Artifacts: - name: azure-arm-nginx safeName: azurearmnginx - \ No newline at end of file